author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
98 files changed, 1095 insertions, 882 deletions
diff --git a/kaddressbook/addresseditwidget.cpp b/kaddressbook/addresseditwidget.cpp index 3dcd592..83908d0 100644 --- a/kaddressbook/addresseditwidget.cpp +++ b/kaddressbook/addresseditwidget.cpp | |||
@@ -13,42 +13,49 @@ | |||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qbuttongroup.h> | 25 | #include <q3buttongroup.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qhbox.h> | 27 | #include <q3hbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlistbox.h> | 30 | #include <q3listbox.h> |
31 | #include <qlistview.h> | 31 | #include <q3listview.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qsignal.h> | 33 | #include <q3signal.h> |
34 | #include <qstring.h> | 34 | #include <qstring.h> |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #include <QDesktopWidget> | ||
37 | |||
38 | #include <Q3VBoxLayout> | ||
39 | #include <Q3GridLayout> | ||
36 | 40 | ||
37 | #ifndef KAB_EMBEDDED | 41 | #ifndef KAB_EMBEDDED |
38 | #include <qtextedit.h> | 42 | #include <q3textedit.h> |
43 | //Added by qt3to4: | ||
44 | #include <Q3ValueList> | ||
45 | #include <Q3VBoxLayout> | ||
39 | #include <kaccelmanager.h> | 46 | #include <kaccelmanager.h> |
40 | #include <kbuttonbox.h> | 47 | #include <kbuttonbox.h> |
41 | #else //KAB_EMBEDDED | 48 | #else //KAB_EMBEDDED |
42 | #include <qmultilineedit.h> | 49 | #include <q3multilineedit.h> |
43 | #endif //KAB_EMBEDDED | 50 | #endif //KAB_EMBEDDED |
44 | 51 | ||
45 | #include <qtoolbutton.h> | 52 | #include <qtoolbutton.h> |
46 | #include <qtooltip.h> | 53 | #include <qtooltip.h> |
47 | 54 | ||
48 | #include <kapplication.h> | 55 | #include <kapplication.h> |
49 | #include <kcombobox.h> | 56 | #include <kcombobox.h> |
50 | #include <kconfig.h> | 57 | #include <kconfig.h> |
51 | #include <kdebug.h> | 58 | #include <kdebug.h> |
52 | #include <kdialog.h> | 59 | #include <kdialog.h> |
53 | #include <kiconloader.h> | 60 | #include <kiconloader.h> |
54 | #include <klineedit.h> | 61 | #include <klineedit.h> |
@@ -58,46 +65,46 @@ | |||
58 | #include <kmessagebox.h> | 65 | #include <kmessagebox.h> |
59 | #include <kseparator.h> | 66 | #include <kseparator.h> |
60 | 67 | ||
61 | #include "addresseditwidget.h" | 68 | #include "addresseditwidget.h" |
62 | 69 | ||
63 | 70 | ||
64 | 71 | ||
65 | AddressEditWidget::AddressEditWidget( QWidget *parent, const char *name ) | 72 | AddressEditWidget::AddressEditWidget( QWidget *parent, const char *name ) |
66 | : QWidget( parent, name ) | 73 | : QWidget( parent, name ) |
67 | { | 74 | { |
68 | 75 | ||
69 | mConfig = AddresseeConfig::instance(); | 76 | mConfig = AddresseeConfig::instance(); |
70 | QVBoxLayout *layout = new QVBoxLayout( this ); | 77 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
71 | layout->setSpacing( KDialog::spacingHintSmall() ); | 78 | layout->setSpacing( KDialog::spacingHintSmall() ); |
72 | QHBox *b1 = new QHBox( this); | 79 | Q3HBox *b1 = new Q3HBox( this); |
73 | //QLabel * label = new QLabel( b1 ); | 80 | //QLabel * label = new QLabel( b1 ); |
74 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); | 81 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) ); |
75 | 82 | ||
76 | 83 | ||
77 | //label->setAlignment( AlignCenter); | 84 | //label->setAlignment( AlignCenter); |
78 | layout->addWidget( b1 ); | 85 | layout->addWidget( b1 ); |
79 | mTypeCombo = new AddressTypeCombo( mAddressList, b1 ); | 86 | mTypeCombo = new AddressTypeCombo( mAddressList, b1 ); |
80 | QPushButton *editButton = new QPushButton( i18n( "&Edit Addresses..." ), | 87 | QPushButton *editButton = new QPushButton( i18n( "&Edit Addresses..." ), |
81 | b1 ); | 88 | b1 ); |
82 | connect( mTypeCombo, SIGNAL( activated( int ) ), | 89 | connect( mTypeCombo, SIGNAL( activated( int ) ), |
83 | SLOT( updateAddressEdit() ) ); | 90 | SLOT( updateAddressEdit() ) ); |
84 | // layout->addWidget( mTypeCombo ); | 91 | // layout->addWidget( mTypeCombo ); |
85 | 92 | ||
86 | #ifndef KAB_EMBEDDED | 93 | #ifndef KAB_EMBEDDED |
87 | mAddressTextEdit = new QTextEdit( this ); | 94 | mAddressTextEdit = new Q3TextEdit( this ); |
88 | mAddressTextEdit->setReadOnly( true ); | 95 | mAddressTextEdit->setReadOnly( true ); |
89 | mAddressTextEdit->setMinimumHeight( 20 ); | 96 | mAddressTextEdit->setMinimumHeight( 20 ); |
90 | #else //KAB_EMBEDDED | 97 | #else //KAB_EMBEDDED |
91 | mAddressTextEdit = new QMultiLineEdit( this ); | 98 | mAddressTextEdit = new Q3MultiLineEdit( this ); |
92 | mAddressTextEdit->setReadOnly( true ); | 99 | mAddressTextEdit->setReadOnly( true ); |
93 | mAddressTextEdit->setMinimumHeight( 20 ); | 100 | mAddressTextEdit->setMinimumHeight( 20 ); |
94 | #endif //KAB_EMBEDDED | 101 | #endif //KAB_EMBEDDED |
95 | 102 | ||
96 | layout->addWidget( mAddressTextEdit ); | 103 | layout->addWidget( mAddressTextEdit ); |
97 | 104 | ||
98 | 105 | ||
99 | connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); | 106 | connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) ); |
100 | } | 107 | } |
101 | 108 | ||
102 | AddressEditWidget::~AddressEditWidget() | 109 | AddressEditWidget::~AddressEditWidget() |
103 | { | 110 | { |
@@ -117,31 +124,31 @@ KABC::Address::List AddressEditWidget::addresses() | |||
117 | } | 124 | } |
118 | 125 | ||
119 | void AddressEditWidget::setAddresses( const KABC::Addressee &addr, | 126 | void AddressEditWidget::setAddresses( const KABC::Addressee &addr, |
120 | const KABC::Address::List &list ) | 127 | const KABC::Address::List &list ) |
121 | { | 128 | { |
122 | mAddressee = addr; | 129 | mAddressee = addr; |
123 | 130 | ||
124 | mAddressList.clear(); | 131 | mAddressList.clear(); |
125 | 132 | ||
126 | // Insert types for existing numbers. | 133 | // Insert types for existing numbers. |
127 | mTypeCombo->insertTypeList( list ); | 134 | mTypeCombo->insertTypeList( list ); |
128 | 135 | ||
129 | QValueList<int> defaultTypes; | 136 | Q3ValueList<int> defaultTypes; |
130 | defaultTypes << KABC::Address::Home; | 137 | defaultTypes << KABC::Address::Home; |
131 | defaultTypes << KABC::Address::Work; | 138 | defaultTypes << KABC::Address::Work; |
132 | 139 | ||
133 | mConfig->setUid( mAddressee.uid() ); | 140 | mConfig->setUid( mAddressee.uid() ); |
134 | QValueList<int> configList = mConfig->noDefaultAddrTypes(); | 141 | Q3ValueList<int> configList = mConfig->noDefaultAddrTypes(); |
135 | QValueList<int>::ConstIterator it; | 142 | Q3ValueList<int>::ConstIterator it; |
136 | for ( it = configList.begin(); it != configList.end(); ++it ) | 143 | for ( it = configList.begin(); it != configList.end(); ++it ) |
137 | defaultTypes.remove( *it ); | 144 | defaultTypes.remove( *it ); |
138 | 145 | ||
139 | // Insert default types. | 146 | // Insert default types. |
140 | // Doing this for mPrefCombo is enough because the list is shared by all | 147 | // Doing this for mPrefCombo is enough because the list is shared by all |
141 | // combos. | 148 | // combos. |
142 | for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { | 149 | for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { |
143 | if ( !mTypeCombo->hasType( *it ) ) | 150 | if ( !mTypeCombo->hasType( *it ) ) |
144 | mTypeCombo->insertType( list, *it, Address( *it ) ); | 151 | mTypeCombo->insertType( list, *it, Address( *it ) ); |
145 | } | 152 | } |
146 | 153 | ||
147 | mTypeCombo->updateTypes(); | 154 | mTypeCombo->updateTypes(); |
@@ -172,25 +179,25 @@ void AddressEditWidget::edit() | |||
172 | for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) { | 179 | for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) { |
173 | if ( (*it).type() == KABC::Address::Home ) { | 180 | if ( (*it).type() == KABC::Address::Home ) { |
174 | if ( !(*it).isEmpty() ) | 181 | if ( !(*it).isEmpty() ) |
175 | hasHome = true; | 182 | hasHome = true; |
176 | } | 183 | } |
177 | if ( (*it).type() == KABC::Address::Work ) { | 184 | if ( (*it).type() == KABC::Address::Work ) { |
178 | if ( !(*it).isEmpty() ) | 185 | if ( !(*it).isEmpty() ) |
179 | hasWork = true; | 186 | hasWork = true; |
180 | } | 187 | } |
181 | } | 188 | } |
182 | 189 | ||
183 | mConfig->setUid( mAddressee.uid() ); | 190 | mConfig->setUid( mAddressee.uid() ); |
184 | QValueList<int> configList; | 191 | Q3ValueList<int> configList; |
185 | if ( !hasHome ) { | 192 | if ( !hasHome ) { |
186 | configList << KABC::Address::Home; | 193 | configList << KABC::Address::Home; |
187 | } | 194 | } |
188 | if ( !hasWork ) { | 195 | if ( !hasWork ) { |
189 | configList << KABC::Address::Work; | 196 | configList << KABC::Address::Work; |
190 | } | 197 | } |
191 | mConfig->setNoDefaultAddrTypes( configList ); | 198 | mConfig->setNoDefaultAddrTypes( configList ); |
192 | 199 | ||
193 | mTypeCombo->updateTypes(); | 200 | mTypeCombo->updateTypes(); |
194 | updateAddressEdit(); | 201 | updateAddressEdit(); |
195 | emit modified(); | 202 | emit modified(); |
196 | } | 203 | } |
@@ -246,38 +253,38 @@ void AddressEditWidget::updateAddressEdit() | |||
246 | 253 | ||
247 | AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, | 254 | AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, |
248 | int selected, QWidget *parent, | 255 | int selected, QWidget *parent, |
249 | const char *name ) | 256 | const char *name ) |
250 | : KDialogBase( Plain, i18n( "Edit Address" ), Ok | Cancel, Ok, | 257 | : KDialogBase( Plain, i18n( "Edit Address" ), Ok | Cancel, Ok, |
251 | parent, name, true, true ), | 258 | parent, name, true, true ), |
252 | mPreviousAddress( 0 ) | 259 | mPreviousAddress( 0 ) |
253 | { | 260 | { |
254 | mAddressList = list; | 261 | mAddressList = list; |
255 | 262 | ||
256 | QWidget *page = plainPage(); | 263 | QWidget *page = plainPage(); |
257 | 264 | ||
258 | QGridLayout *topLayout = new QGridLayout( page, 8, 2 ); | 265 | Q3GridLayout *topLayout = new Q3GridLayout( page, 8, 2 ); |
259 | topLayout->setSpacing( spacingHintSmall() ); | 266 | topLayout->setSpacing( spacingHintSmall() ); |
260 | 267 | ||
261 | mTypeCombo = new AddressTypeCombo( mAddressList, page ); | 268 | mTypeCombo = new AddressTypeCombo( mAddressList, page ); |
262 | topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); | 269 | topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); |
263 | 270 | ||
264 | QLabel *label = new QLabel( i18n( "Street:" ), page ); | 271 | QLabel *label = new QLabel( i18n( "Street:" ), page ); |
265 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); | 272 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); |
266 | topLayout->addWidget( label, 1, 0 ); | 273 | topLayout->addWidget( label, 1, 0 ); |
267 | 274 | ||
268 | #ifndef KAB_EMBEDDED | 275 | #ifndef KAB_EMBEDDED |
269 | mStreetTextEdit = new QTextEdit( page ); | 276 | mStreetTextEdit = new Q3TextEdit( page ); |
270 | #else //KAB_EMBEDDED | 277 | #else //KAB_EMBEDDED |
271 | mStreetTextEdit = new QMultiLineEdit( page ); | 278 | mStreetTextEdit = new Q3MultiLineEdit( page ); |
272 | //US qDebug("AddressEditDialog::AddressEditDialog has to be changed"); | 279 | //US qDebug("AddressEditDialog::AddressEditDialog has to be changed"); |
273 | #endif //KAB_EMBEDDED | 280 | #endif //KAB_EMBEDDED |
274 | 281 | ||
275 | label->setBuddy( mStreetTextEdit ); | 282 | label->setBuddy( mStreetTextEdit ); |
276 | topLayout->addWidget( mStreetTextEdit, 1, 1 ); | 283 | topLayout->addWidget( mStreetTextEdit, 1, 1 ); |
277 | 284 | ||
278 | label = new QLabel( i18n( "Post office box:" ), page ); | 285 | label = new QLabel( i18n( "Post office box:" ), page ); |
279 | topLayout->addWidget( label, 2 , 0 ); | 286 | topLayout->addWidget( label, 2 , 0 ); |
280 | mPOBoxEdit = new KLineEdit( page ); | 287 | mPOBoxEdit = new KLineEdit( page ); |
281 | label->setBuddy( mPOBoxEdit ); | 288 | label->setBuddy( mPOBoxEdit ); |
282 | topLayout->addWidget( mPOBoxEdit, 2, 1 ); | 289 | topLayout->addWidget( mPOBoxEdit, 2, 1 ); |
283 | int maxwid = QApplication::desktop()->width(); | 290 | int maxwid = QApplication::desktop()->width(); |
@@ -302,32 +309,32 @@ AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, | |||
302 | 309 | ||
303 | label = new QLabel( i18n( "Country:" ), page ); | 310 | label = new QLabel( i18n( "Country:" ), page ); |
304 | topLayout->addWidget( label, 6, 0 ); | 311 | topLayout->addWidget( label, 6, 0 ); |
305 | mCountryCombo = new KComboBox( page ); | 312 | mCountryCombo = new KComboBox( page ); |
306 | 313 | ||
307 | mCountryCombo->setMaximumWidth( maxwid -10 ); | 314 | mCountryCombo->setMaximumWidth( maxwid -10 ); |
308 | mCountryCombo->setEditable( true ); | 315 | mCountryCombo->setEditable( true ); |
309 | mCountryCombo->setDuplicatesEnabled( false ); | 316 | mCountryCombo->setDuplicatesEnabled( false ); |
310 | mCountryCombo->setAutoCompletion( true ); | 317 | mCountryCombo->setAutoCompletion( true ); |
311 | fillCountryCombo(); | 318 | fillCountryCombo(); |
312 | label->setBuddy( mCountryCombo ); | 319 | label->setBuddy( mCountryCombo ); |
313 | topLayout->addWidget( mCountryCombo, 6, 1 ); | 320 | topLayout->addWidget( mCountryCombo, 6, 1 ); |
314 | mCountryCombo->setSizeLimit( 8); | 321 | mCountryCombo->setMaxVisibleItems( 8); |
315 | mPreferredCheckBox = new QCheckBox( i18n( "This is the preferred address" ), page ); | 322 | mPreferredCheckBox = new QCheckBox( i18n( "This is the preferred address" ), page ); |
316 | topLayout->addMultiCellWidget( mPreferredCheckBox, 7, 7, 0, 1 ); | 323 | topLayout->addMultiCellWidget( mPreferredCheckBox, 7, 7, 0, 1 ); |
317 | /* | 324 | /* |
318 | KSeparator *sep = new KSeparator( KSeparator::HLine, page ); | 325 | KSeparator *sep = new KSeparator( KSeparator::HLine, page ); |
319 | topLayout->addMultiCellWidget( sep, 8, 8, 0, 1 ); | 326 | topLayout->addMultiCellWidget( sep, 8, 8, 0, 1 ); |
320 | */ | 327 | */ |
321 | QHBox *buttonBox = new QHBox( page ); | 328 | Q3HBox *buttonBox = new Q3HBox( page ); |
322 | buttonBox->setSpacing( spacingHint() ); | 329 | buttonBox->setSpacing( spacingHint() ); |
323 | topLayout->addMultiCellWidget( buttonBox, 9, 9, 0, 1 ); | 330 | topLayout->addMultiCellWidget( buttonBox, 9, 9, 0, 1 ); |
324 | 331 | ||
325 | QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); | 332 | QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); |
326 | connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); | 333 | connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); |
327 | 334 | ||
328 | mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); | 335 | mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); |
329 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); | 336 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); |
330 | 337 | ||
331 | mChangeTypeButton = new QPushButton( i18n( "Change Type" ), buttonBox ); | 338 | mChangeTypeButton = new QPushButton( i18n( "Change Type" ), buttonBox ); |
332 | connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); | 339 | connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); |
333 | 340 | ||
@@ -574,27 +581,27 @@ void AddressEditDialog::fillCountryCombo() | |||
574 | 581 | ||
575 | countries.sort(); | 582 | countries.sort(); |
576 | 583 | ||
577 | mCountryCombo->insertStringList( countries ); | 584 | mCountryCombo->insertStringList( countries ); |
578 | } | 585 | } |
579 | 586 | ||
580 | 587 | ||
581 | AddressTypeDialog::AddressTypeDialog( int type, QWidget *parent ) | 588 | AddressTypeDialog::AddressTypeDialog( int type, QWidget *parent ) |
582 | : KDialogBase( Plain, i18n( "Edit Address Type" ), Ok | Cancel, Ok, | 589 | : KDialogBase( Plain, i18n( "Edit Address Type" ), Ok | Cancel, Ok, |
583 | parent, "AddressTypeDialog" ) | 590 | parent, "AddressTypeDialog" ) |
584 | { | 591 | { |
585 | QWidget *page = plainPage(); | 592 | QWidget *page = plainPage(); |
586 | QVBoxLayout *layout = new QVBoxLayout( page ); | 593 | Q3VBoxLayout *layout = new Q3VBoxLayout( page ); |
587 | 594 | ||
588 | mGroup = new QButtonGroup( 2, Horizontal, i18n( "Address Types" ), page ); | 595 | mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Address Types" ), page ); |
589 | layout->addWidget( mGroup ); | 596 | layout->addWidget( mGroup ); |
590 | 597 | ||
591 | mTypeList = KABC::Address::typeList(); | 598 | mTypeList = KABC::Address::typeList(); |
592 | mTypeList.remove( KABC::Address::Pref ); | 599 | mTypeList.remove( KABC::Address::Pref ); |
593 | 600 | ||
594 | KABC::Address::TypeList::Iterator it; | 601 | KABC::Address::TypeList::Iterator it; |
595 | for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) | 602 | for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) |
596 | new QCheckBox( KABC::Address::typeLabel( *it ), mGroup ); | 603 | new QCheckBox( KABC::Address::typeLabel( *it ), mGroup ); |
597 | 604 | ||
598 | for ( int i = 0; i < mGroup->count(); ++i ) { | 605 | for ( int i = 0; i < mGroup->count(); ++i ) { |
599 | QCheckBox *box = (QCheckBox*)mGroup->find( i ); | 606 | QCheckBox *box = (QCheckBox*)mGroup->find( i ); |
600 | box->setChecked( type & mTypeList[ i ] ); | 607 | box->setChecked( type & mTypeList[ i ] ); |
@@ -608,15 +615,15 @@ AddressTypeDialog::~AddressTypeDialog() | |||
608 | int AddressTypeDialog::type() const | 615 | int AddressTypeDialog::type() const |
609 | { | 616 | { |
610 | int type = 0; | 617 | int type = 0; |
611 | for ( int i = 0; i < mGroup->count(); ++i ) { | 618 | for ( int i = 0; i < mGroup->count(); ++i ) { |
612 | QCheckBox *box = (QCheckBox*)mGroup->find( i ); | 619 | QCheckBox *box = (QCheckBox*)mGroup->find( i ); |
613 | if ( box->isChecked() ) | 620 | if ( box->isChecked() ) |
614 | type += mTypeList[ i ]; | 621 | type += mTypeList[ i ]; |
615 | } | 622 | } |
616 | 623 | ||
617 | return type; | 624 | return type; |
618 | } | 625 | } |
619 | 626 | ||
620 | #ifndef KAB_EMBEDDED | 627 | #ifndef KAB_EMBEDDED_ |
621 | #include "addresseditwidget.moc" | 628 | #include "moc_addresseditwidget.cpp" |
622 | #endif //KAB_EMBEDDED | 629 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/addresseditwidget.h b/kaddressbook/addresseditwidget.h index bc96d74..1d4e138 100644 --- a/kaddressbook/addresseditwidget.h +++ b/kaddressbook/addresseditwidget.h | |||
@@ -24,31 +24,31 @@ | |||
24 | #ifndef ADDRESSEDITWIDGET_H | 24 | #ifndef ADDRESSEDITWIDGET_H |
25 | #define ADDRESSEDITWIDGET_H | 25 | #define ADDRESSEDITWIDGET_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | #include <kabc/address.h> | 30 | #include <kabc/address.h> |
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | 32 | ||
33 | #include "addresseeconfig.h" | 33 | #include "addresseeconfig.h" |
34 | #include "typecombo.h" | 34 | #include "typecombo.h" |
35 | 35 | ||
36 | class QButtonGroup; | 36 | class Q3ButtonGroup; |
37 | class QCheckBox; | 37 | class QCheckBox; |
38 | class QListView; | 38 | class Q3ListView; |
39 | #ifndef KAB_EMBEDDED | 39 | #ifndef KAB_EMBEDDED |
40 | class QTextEdit; | 40 | class Q3TextEdit; |
41 | #else //KAB_EMBEDDED | 41 | #else //KAB_EMBEDDED |
42 | class QMultiLineEdit; | 42 | class Q3MultiLineEdit; |
43 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
44 | class QToolButton; | 44 | class QToolButton; |
45 | 45 | ||
46 | class KComboBox; | 46 | class KComboBox; |
47 | class KLineEdit; | 47 | class KLineEdit; |
48 | class KListView; | 48 | class KListView; |
49 | 49 | ||
50 | typedef TypeCombo<KABC::Address> AddressTypeCombo; | 50 | typedef TypeCombo<KABC::Address> AddressTypeCombo; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | Editor widget for addresses. | 53 | Editor widget for addresses. |
54 | */ | 54 | */ |
@@ -72,27 +72,27 @@ class AddressEditWidget : public QWidget | |||
72 | 72 | ||
73 | protected slots: | 73 | protected slots: |
74 | void updateAddressEdit(); | 74 | void updateAddressEdit(); |
75 | 75 | ||
76 | void edit(); | 76 | void edit(); |
77 | 77 | ||
78 | private: | 78 | private: |
79 | AddresseeConfig * mConfig; | 79 | AddresseeConfig * mConfig; |
80 | AddressTypeCombo *mTypeCombo; | 80 | AddressTypeCombo *mTypeCombo; |
81 | 81 | ||
82 | QPushButton *mEditButton; | 82 | QPushButton *mEditButton; |
83 | #ifndef KAB_EMBEDDED | 83 | #ifndef KAB_EMBEDDED |
84 | QTextEdit *mAddressTextEdit; | 84 | Q3TextEdit *mAddressTextEdit; |
85 | #else //KAB_EMBEDDED | 85 | #else //KAB_EMBEDDED |
86 | QMultiLineEdit *mAddressTextEdit; | 86 | Q3MultiLineEdit *mAddressTextEdit; |
87 | #endif //KAB_EMBEDDED | 87 | #endif //KAB_EMBEDDED |
88 | 88 | ||
89 | KABC::Address::List mAddressList; | 89 | KABC::Address::List mAddressList; |
90 | KABC::Addressee mAddressee; | 90 | KABC::Addressee mAddressee; |
91 | int mIndex; | 91 | int mIndex; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | Dialog for editing address details. | 95 | Dialog for editing address details. |
96 | */ | 96 | */ |
97 | class AddressEditDialog : public KDialogBase | 97 | class AddressEditDialog : public KDialogBase |
98 | { | 98 | { |
@@ -111,27 +111,27 @@ class AddressEditDialog : public KDialogBase | |||
111 | void removeAddress(); | 111 | void removeAddress(); |
112 | void changeType(); | 112 | void changeType(); |
113 | 113 | ||
114 | void updateAddressEdits(); | 114 | void updateAddressEdits(); |
115 | void modified(); | 115 | void modified(); |
116 | 116 | ||
117 | private: | 117 | private: |
118 | void saveAddress( KABC::Address &addr ); | 118 | void saveAddress( KABC::Address &addr ); |
119 | void fillCountryCombo(); | 119 | void fillCountryCombo(); |
120 | 120 | ||
121 | AddressTypeCombo *mTypeCombo; | 121 | AddressTypeCombo *mTypeCombo; |
122 | #ifndef KAB_EMBEDDED | 122 | #ifndef KAB_EMBEDDED |
123 | QTextEdit *mStreetTextEdit; | 123 | Q3TextEdit *mStreetTextEdit; |
124 | #else //KAB_EMBEDDED | 124 | #else //KAB_EMBEDDED |
125 | QMultiLineEdit *mStreetTextEdit; | 125 | Q3MultiLineEdit *mStreetTextEdit; |
126 | #endif //KAB_EMBEDDED | 126 | #endif //KAB_EMBEDDED |
127 | KComboBox *mCountryCombo; | 127 | KComboBox *mCountryCombo; |
128 | KLineEdit *mRegionEdit; | 128 | KLineEdit *mRegionEdit; |
129 | KLineEdit *mLocalityEdit; | 129 | KLineEdit *mLocalityEdit; |
130 | KLineEdit *mPostalCodeEdit; | 130 | KLineEdit *mPostalCodeEdit; |
131 | KLineEdit *mPOBoxEdit; | 131 | KLineEdit *mPOBoxEdit; |
132 | QCheckBox *mPreferredCheckBox; | 132 | QCheckBox *mPreferredCheckBox; |
133 | 133 | ||
134 | QPushButton *mRemoveButton; | 134 | QPushButton *mRemoveButton; |
135 | QPushButton *mChangeTypeButton; | 135 | QPushButton *mChangeTypeButton; |
136 | 136 | ||
137 | KABC::Address::List mAddressList; | 137 | KABC::Address::List mAddressList; |
@@ -142,18 +142,18 @@ class AddressEditDialog : public KDialogBase | |||
142 | /** | 142 | /** |
143 | Dialog for selecting an address type. | 143 | Dialog for selecting an address type. |
144 | */ | 144 | */ |
145 | class AddressTypeDialog : public KDialogBase | 145 | class AddressTypeDialog : public KDialogBase |
146 | { | 146 | { |
147 | public: | 147 | public: |
148 | AddressTypeDialog( int type, QWidget *parent ); | 148 | AddressTypeDialog( int type, QWidget *parent ); |
149 | ~AddressTypeDialog(); | 149 | ~AddressTypeDialog(); |
150 | 150 | ||
151 | int type() const; | 151 | int type() const; |
152 | 152 | ||
153 | private: | 153 | private: |
154 | QButtonGroup *mGroup; | 154 | Q3ButtonGroup *mGroup; |
155 | 155 | ||
156 | KABC::Address::TypeList mTypeList; | 156 | KABC::Address::TypeList mTypeList; |
157 | }; | 157 | }; |
158 | 158 | ||
159 | #endif | 159 | #endif |
diff --git a/kaddressbook/addresseeconfig.cpp b/kaddressbook/addresseeconfig.cpp index ea0436f..81b1bf4 100644 --- a/kaddressbook/addresseeconfig.cpp +++ b/kaddressbook/addresseeconfig.cpp | |||
@@ -17,24 +17,26 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "addresseeconfig.h" | 24 | #include "addresseeconfig.h" |
25 | #include "kabprefs.h" | 25 | #include "kabprefs.h" |
26 | //US | 26 | //US |
27 | #include <kstandarddirs.h> | 27 | #include <kstandarddirs.h> |
28 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
29 | 31 | ||
30 | using namespace KABC; | 32 | using namespace KABC; |
31 | 33 | ||
32 | static AddresseeConfig* extern_AddresseeConfig = 0; | 34 | static AddresseeConfig* extern_AddresseeConfig = 0; |
33 | static KConfig * extern_Config = 0; | 35 | static KConfig * extern_Config = 0; |
34 | 36 | ||
35 | AddresseeConfig::AddresseeConfig() | 37 | AddresseeConfig::AddresseeConfig() |
36 | { | 38 | { |
37 | 39 | ||
38 | 40 | ||
39 | } | 41 | } |
40 | AddresseeConfig::~AddresseeConfig() | 42 | AddresseeConfig::~AddresseeConfig() |
@@ -68,27 +70,27 @@ void AddresseeConfig::setUid( const QString & uid ) | |||
68 | void AddresseeConfig::setAutomaticNameParsing( bool value ) | 70 | void AddresseeConfig::setAutomaticNameParsing( bool value ) |
69 | { | 71 | { |
70 | AddresseeConfig::config()->writeEntry( "AutomaticNameParsing", value ); | 72 | AddresseeConfig::config()->writeEntry( "AutomaticNameParsing", value ); |
71 | } | 73 | } |
72 | 74 | ||
73 | bool AddresseeConfig::automaticNameParsing() | 75 | bool AddresseeConfig::automaticNameParsing() |
74 | { | 76 | { |
75 | 77 | ||
76 | return AddresseeConfig::config()->readBoolEntry( "AutomaticNameParsing", | 78 | return AddresseeConfig::config()->readBoolEntry( "AutomaticNameParsing", |
77 | KABPrefs::instance()->mAutomaticNameParsing ); | 79 | KABPrefs::instance()->mAutomaticNameParsing ); |
78 | } | 80 | } |
79 | 81 | ||
80 | void AddresseeConfig::setNoDefaultAddrTypes( const QValueList<int> &types ) | 82 | void AddresseeConfig::setNoDefaultAddrTypes( const Q3ValueList<int> &types ) |
81 | { | 83 | { |
82 | AddresseeConfig::config()->writeEntry( "NoDefaultAddrTypes", types ); | 84 | AddresseeConfig::config()->writeEntry( "NoDefaultAddrTypes", types ); |
83 | AddresseeConfig::config()->sync(); | 85 | AddresseeConfig::config()->sync(); |
84 | } | 86 | } |
85 | 87 | ||
86 | QValueList<int> AddresseeConfig::noDefaultAddrTypes() const | 88 | Q3ValueList<int> AddresseeConfig::noDefaultAddrTypes() const |
87 | { | 89 | { |
88 | return AddresseeConfig::config()->readIntListEntry( "NoDefaultAddrTypes" ); | 90 | return AddresseeConfig::config()->readIntListEntry( "NoDefaultAddrTypes" ); |
89 | } | 91 | } |
90 | 92 | ||
91 | void AddresseeConfig::remove( const QString & uid ) | 93 | void AddresseeConfig::remove( const QString & uid ) |
92 | { | 94 | { |
93 | AddresseeConfig::config()->deleteGroup( uid ); | 95 | AddresseeConfig::config()->deleteGroup( uid ); |
94 | } | 96 | } |
diff --git a/kaddressbook/addresseeconfig.h b/kaddressbook/addresseeconfig.h index 47fbdd6..f6bb3e9 100644 --- a/kaddressbook/addresseeconfig.h +++ b/kaddressbook/addresseeconfig.h | |||
@@ -17,39 +17,41 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADDRESSEECONFIG_H | 24 | #ifndef ADDRESSEECONFIG_H |
25 | #define ADDRESSEECONFIG_H | 25 | #define ADDRESSEECONFIG_H |
26 | 26 | ||
27 | #include <kabc/addressee.h> | 27 | #include <kabc/addressee.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
29 | 31 | ||
30 | using namespace KABC; | 32 | using namespace KABC; |
31 | 33 | ||
32 | class AddresseeConfig | 34 | class AddresseeConfig |
33 | { | 35 | { |
34 | public: | 36 | public: |
35 | AddresseeConfig(); | 37 | AddresseeConfig(); |
36 | ~AddresseeConfig(); | 38 | ~AddresseeConfig(); |
37 | static AddresseeConfig* instance(); | 39 | static AddresseeConfig* instance(); |
38 | static KConfig* config(); | 40 | static KConfig* config(); |
39 | 41 | ||
40 | Addressee addressee(); | 42 | Addressee addressee(); |
41 | 43 | ||
42 | void setUid( const QString & uid ); | 44 | void setUid( const QString & uid ); |
43 | void setAutomaticNameParsing( bool value ); | 45 | void setAutomaticNameParsing( bool value ); |
44 | bool automaticNameParsing(); | 46 | bool automaticNameParsing(); |
45 | 47 | ||
46 | void setNoDefaultAddrTypes( const QValueList<int> &types ); | 48 | void setNoDefaultAddrTypes( const Q3ValueList<int> &types ); |
47 | QValueList<int> noDefaultAddrTypes() const; | 49 | Q3ValueList<int> noDefaultAddrTypes() const; |
48 | 50 | ||
49 | void remove( const QString & uid); | 51 | void remove( const QString & uid); |
50 | 52 | ||
51 | private: | 53 | private: |
52 | QString mUid; | 54 | QString mUid; |
53 | }; | 55 | }; |
54 | 56 | ||
55 | #endif | 57 | #endif |
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp index b5a60f2..b925a07 100644 --- a/kaddressbook/addresseeeditordialog.cpp +++ b/kaddressbook/addresseeeditordialog.cpp | |||
@@ -14,45 +14,48 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include <QDesktopWidget> | ||
27 | //Added by qt3to4: | ||
28 | #include <Q3VBoxLayout> | ||
26 | 29 | ||
27 | #include <kdebug.h> | 30 | #include <kdebug.h> |
28 | #include <klocale.h> | 31 | #include <klocale.h> |
29 | #include <kglobal.h> | 32 | #include <kglobal.h> |
30 | 33 | ||
31 | #include "addresseeeditorwidget.h" | 34 | #include "addresseeeditorwidget.h" |
32 | #include "kabcore.h" | 35 | #include "kabcore.h" |
33 | 36 | ||
34 | #include "addresseeeditordialog.h" | 37 | #include "addresseeeditordialog.h" |
35 | 38 | ||
36 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, | 39 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, |
37 | const char *name ) | 40 | const char *name ) |
38 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), | 41 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), |
39 | KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, | 42 | KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, |
40 | KDialogBase::Ok, parent, name, true ) | 43 | KDialogBase::Ok, parent, name, true ) |
41 | { | 44 | { |
42 | 45 | ||
43 | 46 | ||
44 | QWidget *page = plainPage(); | 47 | QWidget *page = plainPage(); |
45 | 48 | ||
46 | QVBoxLayout *layout = new QVBoxLayout( page ); | 49 | Q3VBoxLayout *layout = new Q3VBoxLayout( page ); |
47 | 50 | ||
48 | mEditorWidget = new AddresseeEditorWidget( core, false, page ); | 51 | mEditorWidget = new AddresseeEditorWidget( core, false, page ); |
49 | connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), | 52 | connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), |
50 | SLOT( widgetModified() ) ); | 53 | SLOT( widgetModified() ) ); |
51 | layout->addWidget( mEditorWidget ); | 54 | layout->addWidget( mEditorWidget ); |
52 | 55 | ||
53 | enableButton( KDialogBase::Apply, false ); | 56 | enableButton( KDialogBase::Apply, false ); |
54 | if ( QApplication::desktop()->width() < 480 ) { | 57 | if ( QApplication::desktop()->width() < 480 ) { |
55 | hideButtons(); | 58 | hideButtons(); |
56 | } | 59 | } |
57 | } | 60 | } |
58 | 61 | ||
@@ -109,15 +112,15 @@ void AddresseeEditorDialog::slotOk() | |||
109 | void AddresseeEditorDialog::widgetModified() | 112 | void AddresseeEditorDialog::widgetModified() |
110 | { | 113 | { |
111 | enableButton( KDialogBase::Apply, true ); | 114 | enableButton( KDialogBase::Apply, true ); |
112 | } | 115 | } |
113 | 116 | ||
114 | void AddresseeEditorDialog::slotCancel() | 117 | void AddresseeEditorDialog::slotCancel() |
115 | { | 118 | { |
116 | KDialogBase::slotCancel(); | 119 | KDialogBase::slotCancel(); |
117 | 120 | ||
118 | 121 | ||
119 | } | 122 | } |
120 | 123 | ||
121 | #ifndef KAB_EMBEDDED | 124 | #ifndef KAB_EMBEDDED_ |
122 | #include "addresseeeditordialog.moc" | 125 | #include "moc_addresseeeditordialog.cpp" |
123 | #endif //KAB_EMBEDDED | 126 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 4313998..a95db03 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -13,41 +13,45 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qhbox.h> | 25 | #include <q3hbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlistbox.h> | 28 | #include <q3listbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #ifndef KAB_EMBEDDED | 33 | #ifndef KAB_EMBEDDED |
34 | #include <qtextedit.h> | 34 | #include <q3textedit.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3PopupMenu> | ||
38 | #include <Q3VBoxLayout> | ||
35 | 39 | ||
36 | #include <kaccelmanager.h> | 40 | #include <kaccelmanager.h> |
37 | #include "keywidget.h" | 41 | #include "keywidget.h" |
38 | #include "soundwidget.h" | 42 | #include "soundwidget.h" |
39 | 43 | ||
40 | #else //KAB_EMBEDDED | 44 | #else //KAB_EMBEDDED |
41 | #include <qmultilineedit.h> | 45 | #include <q3multilineedit.h> |
42 | #endif //KAB_EMBEDDED | 46 | #endif //KAB_EMBEDDED |
43 | 47 | ||
44 | 48 | ||
45 | #include "keywidget.h" | 49 | #include "keywidget.h" |
46 | #include "geowidget.h" | 50 | #include "geowidget.h" |
47 | #include "imagewidget.h" | 51 | #include "imagewidget.h" |
48 | #include "nameeditdialog.h" | 52 | #include "nameeditdialog.h" |
49 | #include "phoneeditwidget.h" | 53 | #include "phoneeditwidget.h" |
50 | #include "secrecywidget.h" | 54 | #include "secrecywidget.h" |
51 | 55 | ||
52 | 56 | ||
53 | #include <qtoolbutton.h> | 57 | #include <qtoolbutton.h> |
@@ -121,25 +125,25 @@ void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) | |||
121 | const KABC::Addressee &AddresseeEditorWidget::addressee() | 125 | const KABC::Addressee &AddresseeEditorWidget::addressee() |
122 | { | 126 | { |
123 | return mAddressee; | 127 | return mAddressee; |
124 | } | 128 | } |
125 | 129 | ||
126 | void AddresseeEditorWidget::textChanged( const QString& ) | 130 | void AddresseeEditorWidget::textChanged( const QString& ) |
127 | { | 131 | { |
128 | emitModified(); | 132 | emitModified(); |
129 | } | 133 | } |
130 | 134 | ||
131 | void AddresseeEditorWidget::initGUI() | 135 | void AddresseeEditorWidget::initGUI() |
132 | { | 136 | { |
133 | QVBoxLayout *layout = new QVBoxLayout( this ); | 137 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
134 | 138 | ||
135 | mTabWidget = new QTabWidget( this ); | 139 | mTabWidget = new QTabWidget( this ); |
136 | layout->addWidget( mTabWidget ); | 140 | layout->addWidget( mTabWidget ); |
137 | 141 | ||
138 | setupTab1(); | 142 | setupTab1(); |
139 | setupTab1_1(); | 143 | setupTab1_1(); |
140 | setupTab2(); | 144 | setupTab2(); |
141 | setupTab2_1(); | 145 | setupTab2_1(); |
142 | setupTab3(); | 146 | setupTab3(); |
143 | setupTab3_1(); | 147 | setupTab3_1(); |
144 | 148 | ||
145 | mNameEdit->setFocus(); | 149 | mNameEdit->setFocus(); |
@@ -151,25 +155,25 @@ void AddresseeEditorWidget::initGUI() | |||
151 | void AddresseeEditorWidget::setupTab1() | 155 | void AddresseeEditorWidget::setupTab1() |
152 | { | 156 | { |
153 | // This is the General tab | 157 | // This is the General tab |
154 | QWidget *tab1 = new QWidget( mTabWidget ); | 158 | QWidget *tab1 = new QWidget( mTabWidget ); |
155 | 159 | ||
156 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); | 160 | //US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); |
157 | bool horLayout = false; | 161 | bool horLayout = false; |
158 | int maxCol = 1; | 162 | int maxCol = 1; |
159 | if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { | 163 | if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) { |
160 | horLayout = true; | 164 | horLayout = true; |
161 | maxCol = 3; | 165 | maxCol = 3; |
162 | } | 166 | } |
163 | QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol ); | 167 | Q3GridLayout *layout = new Q3GridLayout( tab1, 7-maxCol, maxCol ); |
164 | 168 | ||
165 | layout->setMargin( KDialogBase::marginHintSmall() ); | 169 | layout->setMargin( KDialogBase::marginHintSmall() ); |
166 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 170 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
167 | 171 | ||
168 | QLabel *label; | 172 | QLabel *label; |
169 | KSeparator* bar; | 173 | KSeparator* bar; |
170 | QPushButton *button; | 174 | QPushButton *button; |
171 | 175 | ||
172 | ////////////////////////////////// | 176 | ////////////////////////////////// |
173 | // Upper left group (person info) | 177 | // Upper left group (person info) |
174 | 178 | ||
175 | // Person icon | 179 | // Person icon |
@@ -318,35 +322,35 @@ void AddresseeEditorWidget::setupTab1() | |||
318 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), | 322 | connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), |
319 | SLOT( textChanged( const QString& ) ) ); | 323 | SLOT( textChanged( const QString& ) ) ); |
320 | label->setBuddy( mIMAddressEdit ); | 324 | label->setBuddy( mIMAddressEdit ); |
321 | layout->addWidget( label, 9, 4 ); | 325 | layout->addWidget( label, 9, 4 ); |
322 | layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); | 326 | layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); |
323 | 327 | ||
324 | layout->addColSpacing( 6, 50 ); | 328 | layout->addColSpacing( 6, 50 ); |
325 | 329 | ||
326 | bar = new KSeparator( KSeparator::HLine, tab1 ); | 330 | bar = new KSeparator( KSeparator::HLine, tab1 ); |
327 | layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); | 331 | layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); |
328 | */ | 332 | */ |
329 | /////////////////////////////////////// | 333 | /////////////////////////////////////// |
330 | QHBox *categoryBox = new QHBox( tab1 ,"cato"); | 334 | Q3HBox *categoryBox = new Q3HBox( tab1 ,"cato"); |
331 | categoryBox->setSpacing( KDialogBase::spacingHint() ); | 335 | categoryBox->setSpacing( KDialogBase::spacingHint() ); |
332 | categoryBox->setMargin( KDialogBase::marginHintSmall() ); | 336 | categoryBox->setMargin( KDialogBase::marginHintSmall() ); |
333 | 337 | ||
334 | // Categories | 338 | // Categories |
335 | button = new QPushButton( i18n( "Categories" )+":", categoryBox ); | 339 | button = new QPushButton( i18n( "Categories" )+":", categoryBox ); |
336 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); | 340 | connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); |
337 | 341 | ||
338 | mCategoryEdit = new QPushButton ( categoryBox ); | 342 | mCategoryEdit = new QPushButton ( categoryBox ); |
339 | mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); | 343 | mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
340 | mCatPopup = new QPopupMenu ( categoryBox ); | 344 | mCatPopup = new Q3PopupMenu ( categoryBox ); |
341 | mCategoryEdit->setPopup( mCatPopup ); | 345 | mCategoryEdit->setPopup( mCatPopup ); |
342 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 346 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
343 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 347 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
344 | //connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), | 348 | //connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), |
345 | // SLOT( textChanged( const QString& ) ) ); | 349 | // SLOT( textChanged( const QString& ) ) ); |
346 | 350 | ||
347 | mSecrecyWidget = new SecrecyWidget( categoryBox ); | 351 | mSecrecyWidget = new SecrecyWidget( categoryBox ); |
348 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 352 | connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
349 | 353 | ||
350 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); | 354 | //US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); |
351 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); | 355 | layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); |
352 | 356 | ||
@@ -402,25 +406,25 @@ void AddresseeEditorWidget::setCompany2FN() | |||
402 | mFormattedNameType = NameEditDialog::CustomName; | 406 | mFormattedNameType = NameEditDialog::CustomName; |
403 | mAddressee.setFormattedName( mOrgEdit->text() ); | 407 | mAddressee.setFormattedName( mOrgEdit->text() ); |
404 | mFormattedNameLabel->setText( mOrgEdit->text() ); | 408 | mFormattedNameLabel->setText( mOrgEdit->text() ); |
405 | emitModified(); | 409 | emitModified(); |
406 | } | 410 | } |
407 | 411 | ||
408 | void AddresseeEditorWidget::setupTab1_1() | 412 | void AddresseeEditorWidget::setupTab1_1() |
409 | { | 413 | { |
410 | // This is the Address tab | 414 | // This is the Address tab |
411 | QWidget *tab1_1 = new QWidget( mTabWidget ); | 415 | QWidget *tab1_1 = new QWidget( mTabWidget ); |
412 | 416 | ||
413 | //US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); | 417 | //US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); |
414 | QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); | 418 | Q3GridLayout *layout = new Q3GridLayout( tab1_1, 7, 2 ); |
415 | layout->setMargin( KDialogBase::marginHintSmall() ); | 419 | layout->setMargin( KDialogBase::marginHintSmall() ); |
416 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 420 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
417 | 421 | ||
418 | QLabel *label; | 422 | QLabel *label; |
419 | KSeparator* bar; | 423 | KSeparator* bar; |
420 | QPushButton *button; | 424 | QPushButton *button; |
421 | 425 | ||
422 | /*US | 426 | /*US |
423 | ////////////////////////////////// | 427 | ////////////////////////////////// |
424 | // Upper left group (person info) | 428 | // Upper left group (person info) |
425 | 429 | ||
426 | // Person icon | 430 | // Person icon |
@@ -603,25 +607,25 @@ qDebug("AddresseeEditorWidget::setupTab1 has to be changed"); | |||
603 | layout->activate(); // required | 607 | layout->activate(); // required |
604 | 608 | ||
605 | mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); | 609 | mTabWidget->addTab( tab1_1, i18n( "&Address" ) ); |
606 | } | 610 | } |
607 | 611 | ||
608 | 612 | ||
609 | 613 | ||
610 | void AddresseeEditorWidget::setupTab2() | 614 | void AddresseeEditorWidget::setupTab2() |
611 | { | 615 | { |
612 | // This is the Details tab | 616 | // This is the Details tab |
613 | QWidget *tab2 = new QWidget( mTabWidget ); | 617 | QWidget *tab2 = new QWidget( mTabWidget ); |
614 | 618 | ||
615 | QGridLayout *layout = new QGridLayout( tab2, 8, 3 ); | 619 | Q3GridLayout *layout = new Q3GridLayout( tab2, 8, 3 ); |
616 | layout->setMargin( KDialogBase::marginHintSmall() ); | 620 | layout->setMargin( KDialogBase::marginHintSmall() ); |
617 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 621 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
618 | 622 | ||
619 | QLabel *label; | 623 | QLabel *label; |
620 | KSeparator* bar; | 624 | KSeparator* bar; |
621 | 625 | ||
622 | /////////////////////// | 626 | /////////////////////// |
623 | // Office info | 627 | // Office info |
624 | 628 | ||
625 | // Department | 629 | // Department |
626 | label = new QLabel( tab2 ); | 630 | label = new QLabel( tab2 ); |
627 | //US loadIcon call is ambiguous. Add one more parameter | 631 | //US loadIcon call is ambiguous. Add one more parameter |
@@ -682,25 +686,25 @@ void AddresseeEditorWidget::setupTab2() | |||
682 | 686 | ||
683 | //label = new QLabel( tab2 ); | 687 | //label = new QLabel( tab2 ); |
684 | //US loadIcon call is ambiguous. Add one more parameter | 688 | //US loadIcon call is ambiguous. Add one more parameter |
685 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); | 689 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); |
686 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); | 690 | //label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); |
687 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); | 691 | //US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); |
688 | //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); | 692 | //layout->addMultiCellWidget( label, 6, 7, 0, 0 ); |
689 | 693 | ||
690 | 694 | ||
691 | int iii = 6; | 695 | int iii = 6; |
692 | 696 | ||
693 | if ( QApplication::desktop()->width() == 640 ) { | 697 | if ( QApplication::desktop()->width() == 640 ) { |
694 | QHBox * nbox = new QHBox ( tab2 ); | 698 | Q3HBox * nbox = new Q3HBox ( tab2 ); |
695 | label = new QLabel( i18n( "Nick name:" )+" ", nbox ); | 699 | label = new QLabel( i18n( "Nick name:" )+" ", nbox ); |
696 | mNicknameEdit = new KLineEdit( nbox ); | 700 | mNicknameEdit = new KLineEdit( nbox ); |
697 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), | 701 | connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), |
698 | SLOT( textChanged( const QString& ) ) ); | 702 | SLOT( textChanged( const QString& ) ) ); |
699 | label->setBuddy( mNicknameEdit ); | 703 | label->setBuddy( mNicknameEdit ); |
700 | 704 | ||
701 | label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); | 705 | label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox ); |
702 | mSpouseEdit = new KLineEdit( nbox ); | 706 | mSpouseEdit = new KLineEdit( nbox ); |
703 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), | 707 | connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), |
704 | SLOT( textChanged( const QString& ) ) ); | 708 | SLOT( textChanged( const QString& ) ) ); |
705 | label->setBuddy( mSpouseEdit ); | 709 | label->setBuddy( mSpouseEdit ); |
706 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); | 710 | layout->addMultiCellWidget( nbox, iii, iii, 1, 2 ); |
@@ -726,25 +730,25 @@ void AddresseeEditorWidget::setupTab2() | |||
726 | ++iii; | 730 | ++iii; |
727 | } | 731 | } |
728 | 732 | ||
729 | label = new QLabel( i18n( "Children's names:" ), tab2 ); | 733 | label = new QLabel( i18n( "Children's names:" ), tab2 ); |
730 | layout->addWidget( label, iii, 1 ); | 734 | layout->addWidget( label, iii, 1 ); |
731 | mChildEdit = new KLineEdit( tab2 ); | 735 | mChildEdit = new KLineEdit( tab2 ); |
732 | connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), | 736 | connect( mChildEdit, SIGNAL( textChanged( const QString& ) ), |
733 | SLOT( textChanged( const QString& ) ) ); | 737 | SLOT( textChanged( const QString& ) ) ); |
734 | label->setBuddy( mChildEdit ); | 738 | label->setBuddy( mChildEdit ); |
735 | layout->addWidget( mChildEdit, iii, 2 ); | 739 | layout->addWidget( mChildEdit, iii, 2 ); |
736 | ++iii; | 740 | ++iii; |
737 | if ( QApplication::desktop()->width() == 640 ) { | 741 | if ( QApplication::desktop()->width() == 640 ) { |
738 | QHBox * nbox = new QHBox ( tab2 ); | 742 | Q3HBox * nbox = new Q3HBox ( tab2 ); |
739 | label = new QLabel( i18n( "Birthday:" )+" ", nbox ); | 743 | label = new QLabel( i18n( "Birthday:" )+" ", nbox ); |
740 | mBirthdayPicker = new KDateEdit( nbox ); | 744 | mBirthdayPicker = new KDateEdit( nbox ); |
741 | //mBirthdayPicker->toggleDateFormat(); | 745 | //mBirthdayPicker->toggleDateFormat(); |
742 | mBirthdayPicker->setHandleInvalid( true ); | 746 | mBirthdayPicker->setHandleInvalid( true ); |
743 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 747 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
744 | SLOT( dateChanged( QDate ) ) ); | 748 | SLOT( dateChanged( QDate ) ) ); |
745 | 749 | ||
746 | label->setBuddy( mBirthdayPicker ); | 750 | label->setBuddy( mBirthdayPicker ); |
747 | 751 | ||
748 | label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); | 752 | label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox ); |
749 | mAnniversaryPicker = new KDateEdit( nbox ); | 753 | mAnniversaryPicker = new KDateEdit( nbox ); |
750 | mAnniversaryPicker->setHandleInvalid( true ); | 754 | mAnniversaryPicker->setHandleInvalid( true ); |
@@ -795,25 +799,25 @@ void AddresseeEditorWidget::setupTab2() | |||
795 | ++iii; | 799 | ++iii; |
796 | // Build the layout and add to the tab widget | 800 | // Build the layout and add to the tab widget |
797 | layout->activate(); // required | 801 | layout->activate(); // required |
798 | 802 | ||
799 | mTabWidget->addTab( tab2, i18n( "&Details" ) ); | 803 | mTabWidget->addTab( tab2, i18n( "&Details" ) ); |
800 | } | 804 | } |
801 | 805 | ||
802 | void AddresseeEditorWidget::setupTab2_1() | 806 | void AddresseeEditorWidget::setupTab2_1() |
803 | { | 807 | { |
804 | // This is the Details tab | 808 | // This is the Details tab |
805 | QWidget *tab2_2 = new QWidget( mTabWidget ); | 809 | QWidget *tab2_2 = new QWidget( mTabWidget ); |
806 | 810 | ||
807 | QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); | 811 | Q3GridLayout *layout = new Q3GridLayout( tab2_2, 1, 2 ); |
808 | layout->setMargin( KDialogBase::marginHintSmall() ); | 812 | layout->setMargin( KDialogBase::marginHintSmall() ); |
809 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 813 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
810 | 814 | ||
811 | QLabel *label; | 815 | QLabel *label; |
812 | KSeparator* bar; | 816 | KSeparator* bar; |
813 | 817 | ||
814 | /*US | 818 | /*US |
815 | /////////////////////// | 819 | /////////////////////// |
816 | // Office info | 820 | // Office info |
817 | 821 | ||
818 | // Department | 822 | // Department |
819 | label = new QLabel( tab2 ); | 823 | label = new QLabel( tab2 ); |
@@ -917,52 +921,52 @@ void AddresseeEditorWidget::setupTab2_1() | |||
917 | layout->addWidget( mAnniversaryPicker, 5, 4 ); | 921 | layout->addWidget( mAnniversaryPicker, 5, 4 ); |
918 | 922 | ||
919 | bar = new KSeparator( KSeparator::HLine, tab2 ); | 923 | bar = new KSeparator( KSeparator::HLine, tab2 ); |
920 | layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); | 924 | layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); |
921 | */ | 925 | */ |
922 | ////////////////////////////////////// | 926 | ////////////////////////////////////// |
923 | // Notes | 927 | // Notes |
924 | label = new QLabel( i18n( "Note:" ), tab2_2 ); | 928 | label = new QLabel( i18n( "Note:" ), tab2_2 ); |
925 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); | 929 | label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); |
926 | //US layout->addWidget( label, 7, 0 ); | 930 | //US layout->addWidget( label, 7, 0 ); |
927 | layout->addWidget( label, 0, 0 ); | 931 | layout->addWidget( label, 0, 0 ); |
928 | #ifndef KAB_EMBEDDED | 932 | #ifndef KAB_EMBEDDED |
929 | mNoteEdit = new QTextEdit( tab2_2 ); | 933 | mNoteEdit = new Q3TextEdit( tab2_2 ); |
930 | mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); | 934 | mNoteEdit->setWordWrap( Q3TextEdit::WidgetWidth ); |
931 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | 935 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); |
932 | #else //KAB_EMBEDDED | 936 | #else //KAB_EMBEDDED |
933 | mNoteEdit = new QMultiLineEdit( tab2_2 ); | 937 | mNoteEdit = new Q3MultiLineEdit( tab2_2 ); |
934 | mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth ); | 938 | mNoteEdit->setWordWrap( Q3MultiLineEdit::WidgetWidth ); |
935 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); | 939 | mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); |
936 | #endif //KAB_EMBEDDED | 940 | #endif //KAB_EMBEDDED |
937 | 941 | ||
938 | connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); | 942 | connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); |
939 | label->setBuddy( mNoteEdit ); | 943 | label->setBuddy( mNoteEdit ); |
940 | //US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); | 944 | //US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); |
941 | layout->addWidget( mNoteEdit, 1, 0); | 945 | layout->addWidget( mNoteEdit, 1, 0); |
942 | 946 | ||
943 | // Build the layout and add to the tab widget | 947 | // Build the layout and add to the tab widget |
944 | layout->activate(); // required | 948 | layout->activate(); // required |
945 | 949 | ||
946 | mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); | 950 | mTabWidget->addTab( tab2_2, i18n( "&Notes" ) ); |
947 | } | 951 | } |
948 | 952 | ||
949 | 953 | ||
950 | 954 | ||
951 | void AddresseeEditorWidget::setupTab3() | 955 | void AddresseeEditorWidget::setupTab3() |
952 | { | 956 | { |
953 | // This is the Misc tab | 957 | // This is the Misc tab |
954 | QWidget *tab3 = new QWidget( mTabWidget ); | 958 | QWidget *tab3 = new QWidget( mTabWidget ); |
955 | 959 | ||
956 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); | 960 | Q3GridLayout *layout = new Q3GridLayout( tab3, 1, 1 ); |
957 | layout->setMargin( KDialogBase::marginHintSmall() ); | 961 | layout->setMargin( KDialogBase::marginHintSmall() ); |
958 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 962 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
959 | //US layout->setColStretch( 2, 1 ); | 963 | //US layout->setColStretch( 2, 1 ); |
960 | 964 | ||
961 | ////////////////////////////////////// | 965 | ////////////////////////////////////// |
962 | // Geo | 966 | // Geo |
963 | mGeoWidget = new GeoWidget( tab3 ); | 967 | mGeoWidget = new GeoWidget( tab3 ); |
964 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 968 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
965 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 969 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
966 | layout->addWidget( mGeoWidget, 0, 0 ); | 970 | layout->addWidget( mGeoWidget, 0, 0 ); |
967 | /*US | 971 | /*US |
968 | ////////////////////////////////////// | 972 | ////////////////////////////////////// |
@@ -996,25 +1000,25 @@ qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be | |||
996 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); | 1000 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); |
997 | layout->addWidget( mKeyWidget, 1, 0 ); | 1001 | layout->addWidget( mKeyWidget, 1, 0 ); |
998 | 1002 | ||
999 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); | 1003 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); |
1000 | } | 1004 | } |
1001 | 1005 | ||
1002 | void AddresseeEditorWidget::setupTab3_1() | 1006 | void AddresseeEditorWidget::setupTab3_1() |
1003 | { | 1007 | { |
1004 | // This is the Misc tab | 1008 | // This is the Misc tab |
1005 | QWidget *tab3 = new QWidget( mTabWidget ); | 1009 | QWidget *tab3 = new QWidget( mTabWidget ); |
1006 | 1010 | ||
1007 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); | 1011 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); |
1008 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); | 1012 | Q3GridLayout *layout = new Q3GridLayout( tab3, 1, 1 ); |
1009 | layout->setMargin( KDialogBase::marginHint() ); | 1013 | layout->setMargin( KDialogBase::marginHint() ); |
1010 | layout->setSpacing( KDialogBase::spacingHint() ); | 1014 | layout->setSpacing( KDialogBase::spacingHint() ); |
1011 | //US layout->setColStretch( 2, 1 ); | 1015 | //US layout->setColStretch( 2, 1 ); |
1012 | 1016 | ||
1013 | /*US | 1017 | /*US |
1014 | ////////////////////////////////////// | 1018 | ////////////////////////////////////// |
1015 | // Geo | 1019 | // Geo |
1016 | mGeoWidget = new GeoWidget( tab3 ); | 1020 | mGeoWidget = new GeoWidget( tab3 ); |
1017 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 1021 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
1018 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 1022 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
1019 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); | 1023 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); |
1020 | */ | 1024 | */ |
@@ -1421,15 +1425,15 @@ void AddresseeEditorWidget::pageChanged( QWidget *wdg ) | |||
1421 | } | 1425 | } |
1422 | 1426 | ||
1423 | QString AddresseeEditorWidget::title() const | 1427 | QString AddresseeEditorWidget::title() const |
1424 | { | 1428 | { |
1425 | return i18n( "Contact Editor" ); | 1429 | return i18n( "Contact Editor" ); |
1426 | } | 1430 | } |
1427 | 1431 | ||
1428 | QString AddresseeEditorWidget::identifier() const | 1432 | QString AddresseeEditorWidget::identifier() const |
1429 | { | 1433 | { |
1430 | return i18n( "contact_editor" ); | 1434 | return i18n( "contact_editor" ); |
1431 | } | 1435 | } |
1432 | 1436 | ||
1433 | #ifndef KAB_EMBEDDED | 1437 | #ifndef KAB_EMBEDDED_ |
1434 | #include "addresseeeditorwidget.moc" | 1438 | #include "moc_addresseeeditorwidget.cpp" |
1435 | #endif //KAB_EMBEDDED | 1439 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h index 816bbb5..aa1207e 100644 --- a/kaddressbook/addresseeeditorwidget.h +++ b/kaddressbook/addresseeeditorwidget.h | |||
@@ -16,42 +16,42 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADDRESSEEEDITORWIDGET_H | 24 | #ifndef ADDRESSEEEDITORWIDGET_H |
25 | #define ADDRESSEEEDITORWIDGET_H | 25 | #define ADDRESSEEEDITORWIDGET_H |
26 | 26 | ||
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qpopupmenu.h> | 28 | #include <q3popupmenu.h> |
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | 30 | ||
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #include <kdialogbase.h> | 32 | #include <kdialogbase.h> |
33 | #include <kjanuswidget.h> | 33 | #include <kjanuswidget.h> |
34 | 34 | ||
35 | #include "extensionwidget.h" | 35 | #include "extensionwidget.h" |
36 | 36 | ||
37 | class AddresseeConfig; | 37 | class AddresseeConfig; |
38 | class QCheckBox; | 38 | class QCheckBox; |
39 | class QSpinBox; | 39 | class QSpinBox; |
40 | class QTabWidget; | 40 | class QTabWidget; |
41 | 41 | ||
42 | #ifndef KAB_EMBEDDED | 42 | #ifndef KAB_EMBEDDED |
43 | class QTextEdit; | 43 | class Q3TextEdit; |
44 | #else //KAB_EMBEDDED | 44 | #else //KAB_EMBEDDED |
45 | class QMultiLineEdit; | 45 | class Q3MultiLineEdit; |
46 | #endif //KAB_EMBEDDED | 46 | #endif //KAB_EMBEDDED |
47 | 47 | ||
48 | class KComboBox; | 48 | class KComboBox; |
49 | class KDateEdit; | 49 | class KDateEdit; |
50 | class KLineEdit; | 50 | class KLineEdit; |
51 | class KSqueezedTextLabel; | 51 | class KSqueezedTextLabel; |
52 | 52 | ||
53 | class AddressEditWidget; | 53 | class AddressEditWidget; |
54 | class EmailEditWidget; | 54 | class EmailEditWidget; |
55 | class GeoWidget; | 55 | class GeoWidget; |
56 | class ImageWidget; | 56 | class ImageWidget; |
57 | class KABCore; | 57 | class KABCore; |
@@ -146,44 +146,44 @@ class AddresseeEditorWidget : public ExtensionWidget | |||
146 | // Tab1 and Tab1_1 | 146 | // Tab1 and Tab1_1 |
147 | KLineEdit *mNameEdit; | 147 | KLineEdit *mNameEdit; |
148 | KLineEdit *mRoleEdit; | 148 | KLineEdit *mRoleEdit; |
149 | KLineEdit *mOrgEdit; | 149 | KLineEdit *mOrgEdit; |
150 | 150 | ||
151 | KSqueezedTextLabel *mFormattedNameLabel; | 151 | KSqueezedTextLabel *mFormattedNameLabel; |
152 | AddressEditWidget *mAddressEditWidget; | 152 | AddressEditWidget *mAddressEditWidget; |
153 | EmailEditWidget *mEmailWidget; | 153 | EmailEditWidget *mEmailWidget; |
154 | PhoneEditWidget *mPhoneEditWidget; | 154 | PhoneEditWidget *mPhoneEditWidget; |
155 | KLineEdit *mURLEdit; | 155 | KLineEdit *mURLEdit; |
156 | KLineEdit *mIMAddressEdit; | 156 | KLineEdit *mIMAddressEdit; |
157 | QPushButton *mCategoryEdit; | 157 | QPushButton *mCategoryEdit; |
158 | QPopupMenu *mCatPopup; | 158 | Q3PopupMenu *mCatPopup; |
159 | SecrecyWidget *mSecrecyWidget; | 159 | SecrecyWidget *mSecrecyWidget; |
160 | KSqueezedTextLabel *mNameLabel; | 160 | KSqueezedTextLabel *mNameLabel; |
161 | 161 | ||
162 | // Tab2 and Tab2_2 | 162 | // Tab2 and Tab2_2 |
163 | KLineEdit *mDepartmentEdit; | 163 | KLineEdit *mDepartmentEdit; |
164 | KLineEdit *mOfficeEdit; | 164 | KLineEdit *mOfficeEdit; |
165 | KLineEdit *mProfessionEdit; | 165 | KLineEdit *mProfessionEdit; |
166 | KLineEdit *mManagerEdit; | 166 | KLineEdit *mManagerEdit; |
167 | KLineEdit *mAssistantEdit; | 167 | KLineEdit *mAssistantEdit; |
168 | KLineEdit *mNicknameEdit; | 168 | KLineEdit *mNicknameEdit; |
169 | KLineEdit *mSpouseEdit; | 169 | KLineEdit *mSpouseEdit; |
170 | KLineEdit *mChildEdit; | 170 | KLineEdit *mChildEdit; |
171 | QComboBox *mGenderBox; | 171 | QComboBox *mGenderBox; |
172 | KDateEdit *mBirthdayPicker; | 172 | KDateEdit *mBirthdayPicker; |
173 | KDateEdit *mAnniversaryPicker; | 173 | KDateEdit *mAnniversaryPicker; |
174 | #ifndef KAB_EMBEDDED | 174 | #ifndef KAB_EMBEDDED |
175 | QTextEdit *mNoteEdit; | 175 | Q3TextEdit *mNoteEdit; |
176 | #else //KAB_EMBEDDED | 176 | #else //KAB_EMBEDDED |
177 | QMultiLineEdit *mNoteEdit; | 177 | Q3MultiLineEdit *mNoteEdit; |
178 | #endif //KAB_EMBEDDED | 178 | #endif //KAB_EMBEDDED |
179 | 179 | ||
180 | QSpinBox *mTimeZoneSpin; | 180 | QSpinBox *mTimeZoneSpin; |
181 | QSpinBox *mGeoLat; | 181 | QSpinBox *mGeoLat; |
182 | QSpinBox *mGeoLon; | 182 | QSpinBox *mGeoLon; |
183 | 183 | ||
184 | // Tab3 | 184 | // Tab3 |
185 | GeoWidget *mGeoWidget; | 185 | GeoWidget *mGeoWidget; |
186 | ImageWidget *mImageWidget; | 186 | ImageWidget *mImageWidget; |
187 | #ifndef KAB_EMBEDDED | 187 | #ifndef KAB_EMBEDDED |
188 | SoundWidget *mSoundWidget; | 188 | SoundWidget *mSoundWidget; |
189 | #endif //KAB_EMBEDDED | 189 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/addresseeutil.cpp b/kaddressbook/addresseeutil.cpp index 366384a..a860f6d 100644 --- a/kaddressbook/addresseeutil.cpp +++ b/kaddressbook/addresseeutil.cpp | |||
@@ -37,25 +37,25 @@ QString AddresseeUtil::addresseesToClipboard( const KABC::Addressee::List &list | |||
37 | KABC::Addressee::List::ConstIterator it; | 37 | KABC::Addressee::List::ConstIterator it; |
38 | for ( it = list.begin(); it != list.end(); ++it ) { | 38 | for ( it = list.begin(); it != list.end(); ++it ) { |
39 | QString tmp; | 39 | QString tmp; |
40 | if ( converter.addresseeToVCard( *it, tmp ) ) | 40 | if ( converter.addresseeToVCard( *it, tmp ) ) |
41 | vcard += tmp + "\r\n"; | 41 | vcard += tmp + "\r\n"; |
42 | } | 42 | } |
43 | 43 | ||
44 | return vcard; | 44 | return vcard; |
45 | } | 45 | } |
46 | 46 | ||
47 | KABC::Addressee::List AddresseeUtil::clipboardToAddressees( const QString &data ) | 47 | KABC::Addressee::List AddresseeUtil::clipboardToAddressees( const QString &data ) |
48 | { | 48 | { |
49 | uint numVCards = data.contains( "BEGIN:VCARD", false ); | 49 | uint numVCards = data.count( "BEGIN:VCARD", Qt::CaseInsensitive ); |
50 | QStringList dataList = QStringList::split( "\r\n\r\n", data ); | 50 | QStringList dataList = QStringList::split( "\r\n\r\n", data ); |
51 | 51 | ||
52 | KABC::Addressee::List addrList; | 52 | KABC::Addressee::List addrList; |
53 | for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) { | 53 | for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) { |
54 | KABC::VCardConverter converter; | 54 | KABC::VCardConverter converter; |
55 | KABC::Addressee addr; | 55 | KABC::Addressee addr; |
56 | 56 | ||
57 | if ( !converter.vCardToAddressee( dataList[ i ].stripWhiteSpace(), addr ) ) { | 57 | if ( !converter.vCardToAddressee( dataList[ i ].stripWhiteSpace(), addr ) ) { |
58 | KMessageBox::error( 0, i18n( "Invalid vCard format in clipboard" ) ); | 58 | KMessageBox::error( 0, i18n( "Invalid vCard format in clipboard" ) ); |
59 | continue; | 59 | continue; |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/kaddressbook/addviewdialog.cpp b/kaddressbook/addviewdialog.cpp index 6def26b..b52a83c 100644 --- a/kaddressbook/addviewdialog.cpp +++ b/kaddressbook/addviewdialog.cpp | |||
@@ -16,66 +16,68 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #endif //KAB_EMBEDDED | 25 | #endif //KAB_EMBEDDED |
26 | 26 | ||
27 | #include <qradiobutton.h> | 27 | #include <qradiobutton.h> |
28 | #include <qbuttongroup.h> | 28 | #include <q3buttongroup.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3GridLayout> | ||
32 | 34 | ||
33 | #include <klocale.h> | 35 | #include <klocale.h> |
34 | #include <kglobal.h> | 36 | #include <kglobal.h> |
35 | #include "kaddressbookview.h" | 37 | #include "kaddressbookview.h" |
36 | #include "addviewdialog.h" | 38 | #include "addviewdialog.h" |
37 | 39 | ||
38 | AddViewDialog::AddViewDialog( QDict<ViewFactory> *viewFactoryDict, | 40 | AddViewDialog::AddViewDialog( Q3Dict<ViewFactory> *viewFactoryDict, |
39 | QWidget *parent, const char *name ) | 41 | QWidget *parent, const char *name ) |
40 | : KDialogBase( KDialogBase::Plain, i18n( "Add View" ), | 42 | : KDialogBase( KDialogBase::Plain, i18n( "Add View" ), |
41 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 43 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
42 | parent, name ), | 44 | parent, name ), |
43 | mViewFactoryDict( viewFactoryDict ) | 45 | mViewFactoryDict( viewFactoryDict ) |
44 | { | 46 | { |
45 | //US setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 300)); | 47 | //US setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 300)); |
46 | 48 | ||
47 | mTypeId = 0; | 49 | mTypeId = 0; |
48 | 50 | ||
49 | QWidget *page = plainPage(); | 51 | QWidget *page = plainPage(); |
50 | 52 | ||
51 | QGridLayout *layout = new QGridLayout( page, 2, 2 ); | 53 | Q3GridLayout *layout = new Q3GridLayout( page, 2, 2 ); |
52 | layout->setSpacing( spacingHint() ); | 54 | layout->setSpacing( spacingHint() ); |
53 | layout->setRowStretch( 1, 1 ); | 55 | layout->setRowStretch( 1, 1 ); |
54 | layout->setColStretch( 1, 1 ); | 56 | layout->setColStretch( 1, 1 ); |
55 | 57 | ||
56 | QLabel *label = new QLabel( i18n( "View name:" ), page ); | 58 | QLabel *label = new QLabel( i18n( "View name:" ), page ); |
57 | layout->addWidget( label, 0, 0 ); | 59 | layout->addWidget( label, 0, 0 ); |
58 | 60 | ||
59 | mViewNameEdit = new QLineEdit( page ); | 61 | mViewNameEdit = new QLineEdit( page ); |
60 | connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ), | 62 | connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ), |
61 | SLOT( textChanged( const QString& ) ) ); | 63 | SLOT( textChanged( const QString& ) ) ); |
62 | layout->addWidget( mViewNameEdit, 0, 1 ); | 64 | layout->addWidget( mViewNameEdit, 0, 1 ); |
63 | 65 | ||
64 | mTypeGroup = new QButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page ); | 66 | mTypeGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page ); |
65 | connect( mTypeGroup, SIGNAL( clicked( int ) ), this, SLOT( clicked( int ) ) ); | 67 | connect( mTypeGroup, SIGNAL( clicked( int ) ), this, SLOT( clicked( int ) ) ); |
66 | layout->addMultiCellWidget( mTypeGroup, 1, 1, 0, 1 ); | 68 | layout->addMultiCellWidget( mTypeGroup, 1, 1, 0, 1 ); |
67 | 69 | ||
68 | // Now create the radio buttons. This needs some layout work. | 70 | // Now create the radio buttons. This needs some layout work. |
69 | QDictIterator<ViewFactory> iter( *mViewFactoryDict ); | 71 | Q3DictIterator<ViewFactory> iter( *mViewFactoryDict ); |
70 | for ( iter.toFirst(); iter.current(); ++iter ) { | 72 | for ( iter.toFirst(); iter.current(); ++iter ) { |
71 | //US i am not quit sure, why I can nopt use (*iter)-> here | 73 | //US i am not quit sure, why I can nopt use (*iter)-> here |
72 | //US new QRadioButton( (*iter)->type(), mTypeGroup ); | 74 | //US new QRadioButton( (*iter)->type(), mTypeGroup ); |
73 | //US label = new QLabel( (*iter)->description(), mTypeGroup ); | 75 | //US label = new QLabel( (*iter)->description(), mTypeGroup ); |
74 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
75 | new QRadioButton( (*iter)->type(), mTypeGroup ); | 77 | new QRadioButton( (*iter)->type(), mTypeGroup ); |
76 | label = new QLabel( (*iter)->description(), mTypeGroup ); | 78 | label = new QLabel( (*iter)->description(), mTypeGroup ); |
77 | #else | 79 | #else |
78 | new QRadioButton( (*iter).type(), mTypeGroup ); | 80 | new QRadioButton( (*iter).type(), mTypeGroup ); |
79 | label = new QLabel( (*iter).description(), mTypeGroup ); | 81 | label = new QLabel( (*iter).description(), mTypeGroup ); |
80 | 82 | ||
81 | #endif | 83 | #endif |
@@ -104,15 +106,15 @@ QString AddViewDialog::viewType()const | |||
104 | } | 106 | } |
105 | 107 | ||
106 | void AddViewDialog::clicked( int id ) | 108 | void AddViewDialog::clicked( int id ) |
107 | { | 109 | { |
108 | mTypeId = id; | 110 | mTypeId = id; |
109 | } | 111 | } |
110 | 112 | ||
111 | void AddViewDialog::textChanged( const QString &text ) | 113 | void AddViewDialog::textChanged( const QString &text ) |
112 | { | 114 | { |
113 | enableButton( KDialogBase::Ok, !text.isEmpty() ); | 115 | enableButton( KDialogBase::Ok, !text.isEmpty() ); |
114 | } | 116 | } |
115 | 117 | ||
116 | #ifndef KAB_EMBEDDED | 118 | #ifndef KAB_EMBEDDED_ |
117 | #include "addviewdialog.moc" | 119 | #include "moc_addviewdialog.cpp" |
118 | #endif //KAB_EMBEDDED | 120 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/addviewdialog.h b/kaddressbook/addviewdialog.h index 8cc12f5..c3e8efd 100644 --- a/kaddressbook/addviewdialog.h +++ b/kaddressbook/addviewdialog.h | |||
@@ -16,58 +16,58 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADDVIEWDIALOG_H | 24 | #ifndef ADDVIEWDIALOG_H |
25 | #define ADDVIEWDIALOG_H | 25 | #define ADDVIEWDIALOG_H |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | #include <qdict.h> | 28 | #include <q3dict.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | 30 | ||
31 | class ViewFactory; | 31 | class ViewFactory; |
32 | class QButtonGroup; | 32 | class Q3ButtonGroup; |
33 | class QLineEdit; | 33 | class QLineEdit; |
34 | 34 | ||
35 | 35 | ||
36 | /** | 36 | /** |
37 | Modal dialog used for adding a new view. The dialog asks for the name of | 37 | Modal dialog used for adding a new view. The dialog asks for the name of |
38 | the view as well as the type. Someday it would be nice for this to be a | 38 | the view as well as the type. Someday it would be nice for this to be a |
39 | wizard. | 39 | wizard. |
40 | */ | 40 | */ |
41 | class AddViewDialog : public KDialogBase | 41 | class AddViewDialog : public KDialogBase |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | 44 | ||
45 | public: | 45 | public: |
46 | AddViewDialog( QDict<ViewFactory> *viewFactoryDict, QWidget *parent, | 46 | AddViewDialog( Q3Dict<ViewFactory> *viewFactoryDict, QWidget *parent, |
47 | const char *name = 0 ); | 47 | const char *name = 0 ); |
48 | ~AddViewDialog(); | 48 | ~AddViewDialog(); |
49 | 49 | ||
50 | QString viewName()const; | 50 | QString viewName()const; |
51 | 51 | ||
52 | QString viewType()const ; | 52 | QString viewType()const ; |
53 | 53 | ||
54 | protected slots: | 54 | protected slots: |
55 | /** | 55 | /** |
56 | Called when the user selects a type radio button. | 56 | Called when the user selects a type radio button. |
57 | */ | 57 | */ |
58 | void clicked( int id ); | 58 | void clicked( int id ); |
59 | 59 | ||
60 | /** | 60 | /** |
61 | Called when the user changes the text in the name of the view. | 61 | Called when the user changes the text in the name of the view. |
62 | */ | 62 | */ |
63 | void textChanged( const QString &text ); | 63 | void textChanged( const QString &text ); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | QDict<ViewFactory> *mViewFactoryDict; | 66 | Q3Dict<ViewFactory> *mViewFactoryDict; |
67 | QLineEdit *mViewNameEdit; | 67 | QLineEdit *mViewNameEdit; |
68 | QButtonGroup *mTypeGroup; | 68 | Q3ButtonGroup *mTypeGroup; |
69 | 69 | ||
70 | int mTypeId; | 70 | int mTypeId; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #endif | 73 | #endif |
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp index cee5886..4a86aca 100644 --- a/kaddressbook/details/detailsviewcontainer.cpp +++ b/kaddressbook/details/detailsviewcontainer.cpp | |||
@@ -13,67 +13,70 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qframe.h> | 25 | #include <q3frame.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <q3widgetstack.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3HBoxLayout> | ||
31 | #include <Q3VBoxLayout> | ||
29 | 32 | ||
30 | #include <kapplication.h> | 33 | #include <kapplication.h> |
31 | #include <kdebug.h> | 34 | #include <kdebug.h> |
32 | #include <kdialog.h> | 35 | #include <kdialog.h> |
33 | 36 | ||
34 | #include "look_basic.h" | 37 | #include "look_basic.h" |
35 | //#include "look_details.h" | 38 | //#include "look_details.h" |
36 | #include "look_html.h" | 39 | #include "look_html.h" |
37 | 40 | ||
38 | #ifdef KAB_EMBEDDED | 41 | #ifdef KAB_EMBEDDED |
39 | #include "kabprefs.h" | 42 | #include "kabprefs.h" |
40 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
41 | 44 | ||
42 | 45 | ||
43 | #include "detailsviewcontainer.h" | 46 | #include "detailsviewcontainer.h" |
44 | 47 | ||
45 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) | 48 | ViewContainer::ViewContainer( QWidget *parent, const char* name ) |
46 | : QWidget( parent, name ), mCurrentLook( 0 ) | 49 | : QWidget( parent, name ), mCurrentLook( 0 ) |
47 | { | 50 | { |
48 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 51 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); |
49 | //topLayout->setMargin( KDialog::marginHint() ); | 52 | //topLayout->setMargin( KDialog::marginHint() ); |
50 | //topLayout->setSpacing( KDialog::spacingHint() ); | 53 | //topLayout->setSpacing( KDialog::spacingHint() ); |
51 | topLayout->setMargin( 0 ); | 54 | topLayout->setMargin( 0 ); |
52 | topLayout->setSpacing( 0 ); | 55 | topLayout->setSpacing( 0 ); |
53 | 56 | ||
54 | QBoxLayout *styleLayout = new QHBoxLayout( topLayout ); | 57 | Q3BoxLayout *styleLayout = new Q3HBoxLayout( topLayout ); |
55 | 58 | ||
56 | QLabel *label = new QLabel( i18n("Style:"), this ); | 59 | QLabel *label = new QLabel( i18n("Style:"), this ); |
57 | styleLayout->addWidget( label ); | 60 | styleLayout->addWidget( label ); |
58 | 61 | ||
59 | mStyleCombo = new QComboBox( this ); | 62 | mStyleCombo = new QComboBox( this ); |
60 | styleLayout->addWidget( mStyleCombo ); | 63 | styleLayout->addWidget( mStyleCombo ); |
61 | 64 | ||
62 | QFrame *frameRuler = new QFrame( this ); | 65 | Q3Frame *frameRuler = new Q3Frame( this ); |
63 | //US frameRuler->setFrameShape( QFrame::HLine ); | 66 | //US frameRuler->setFrameShape( QFrame::HLine ); |
64 | //US frameRuler->setFrameShadow( QFrame::Sunken ); | 67 | //US frameRuler->setFrameShadow( QFrame::Sunken ); |
65 | //US topLayout->addWidget( frameRuler ); | 68 | //US topLayout->addWidget( frameRuler ); |
66 | 69 | ||
67 | mDetailsStack = new QWidgetStack( this ); | 70 | mDetailsStack = new Q3WidgetStack( this ); |
68 | topLayout->addWidget( mDetailsStack, 1 ); | 71 | topLayout->addWidget( mDetailsStack, 1 ); |
69 | 72 | ||
70 | registerLooks(); | 73 | registerLooks(); |
71 | 74 | ||
72 | #if 1 | 75 | #if 1 |
73 | // Hide detailed view selection combo box, because we currently have | 76 | // Hide detailed view selection combo box, because we currently have |
74 | // only one. Reenable it when there are more detailed views. | 77 | // only one. Reenable it when there are more detailed views. |
75 | label->hide(); | 78 | label->hide(); |
76 | mStyleCombo->hide(); | 79 | mStyleCombo->hide(); |
77 | frameRuler->hide(); | 80 | frameRuler->hide(); |
78 | #endif | 81 | #endif |
79 | } | 82 | } |
@@ -150,15 +153,15 @@ KABC::Addressee ViewContainer::addressee() | |||
150 | if ( !mCurrentLook ) | 153 | if ( !mCurrentLook ) |
151 | return empty; | 154 | return empty; |
152 | else | 155 | else |
153 | return mCurrentLook->addressee(); | 156 | return mCurrentLook->addressee(); |
154 | } | 157 | } |
155 | 158 | ||
156 | void ViewContainer::setReadOnly( bool state ) | 159 | void ViewContainer::setReadOnly( bool state ) |
157 | { | 160 | { |
158 | if ( mCurrentLook ) | 161 | if ( mCurrentLook ) |
159 | mCurrentLook->setReadOnly( state ); | 162 | mCurrentLook->setReadOnly( state ); |
160 | } | 163 | } |
161 | 164 | ||
162 | #ifndef KAB_EMBEDDED | 165 | #ifndef KAB_EMBEDDED_ |
163 | #include "detailsviewcontainer.moc" | 166 | #include "moc_detailsviewcontainer.cpp" |
164 | #endif //KAB_EMBEDDED | 167 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h index 9684736..f310a30 100644 --- a/kaddressbook/details/detailsviewcontainer.h +++ b/kaddressbook/details/detailsviewcontainer.h | |||
@@ -15,30 +15,30 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef DETAILSVIEWCONTAINER_H | 24 | #ifndef DETAILSVIEWCONTAINER_H |
25 | #define DETAILSVIEWCONTAINER_H | 25 | #define DETAILSVIEWCONTAINER_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | 28 | ||
29 | #include "look_basic.h" | 29 | #include "look_basic.h" |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class QWidgetStack; | 32 | class Q3WidgetStack; |
33 | 33 | ||
34 | class ViewContainer : public QWidget | 34 | class ViewContainer : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); | 39 | ViewContainer( QWidget *parent = 0, const char* name = 0 ); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | Return the look currently selected. If there is none, it | 42 | Return the look currently selected. If there is none, it |
43 | returns zero. Do not use this pointer to store a reference | 43 | returns zero. Do not use this pointer to store a reference |
44 | to a look, the user might select another one (e.g., create | 44 | to a look, the user might select another one (e.g., create |
@@ -85,19 +85,19 @@ class ViewContainer : public QWidget | |||
85 | A style has been selected. Overloaded from base class. | 85 | A style has been selected. Overloaded from base class. |
86 | */ | 86 | */ |
87 | void slotStyleSelected( int ); | 87 | void slotStyleSelected( int ); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | Register the available looks. | 90 | Register the available looks. |
91 | */ | 91 | */ |
92 | void registerLooks(); | 92 | void registerLooks(); |
93 | 93 | ||
94 | private: | 94 | private: |
95 | KABC::Addressee mCurrentAddressee; | 95 | KABC::Addressee mCurrentAddressee; |
96 | KABBasicLook *mCurrentLook; | 96 | KABBasicLook *mCurrentLook; |
97 | QPtrList<KABLookFactory> mLookFactories; | 97 | Q3PtrList<KABLookFactory> mLookFactories; |
98 | 98 | ||
99 | QComboBox *mStyleCombo; | 99 | QComboBox *mStyleCombo; |
100 | QWidgetStack *mDetailsStack; | 100 | Q3WidgetStack *mDetailsStack; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | #endif | 103 | #endif |
diff --git a/kaddressbook/details/look_basic.cpp b/kaddressbook/details/look_basic.cpp index 0245686..48cc42a 100644 --- a/kaddressbook/details/look_basic.cpp +++ b/kaddressbook/details/look_basic.cpp | |||
@@ -17,25 +17,25 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | 25 | ||
26 | #include "look_basic.h" | 26 | #include "look_basic.h" |
27 | 27 | ||
28 | KABBasicLook::KABBasicLook( QWidget *parent, const char *name ) | 28 | KABBasicLook::KABBasicLook( QWidget *parent, const char *name ) |
29 | : QVBox( parent, name ), mReadOnly( false ) | 29 | : Q3VBox( parent, name ), mReadOnly( false ) |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | void KABBasicLook::setReadOnly( bool state ) | 33 | void KABBasicLook::setReadOnly( bool state ) |
34 | { | 34 | { |
35 | mReadOnly = state; | 35 | mReadOnly = state; |
36 | } | 36 | } |
37 | 37 | ||
38 | bool KABBasicLook::isReadOnly() const | 38 | bool KABBasicLook::isReadOnly() const |
39 | { | 39 | { |
40 | return mReadOnly; | 40 | return mReadOnly; |
41 | } | 41 | } |
@@ -61,15 +61,15 @@ void KABBasicLook::restoreSettings( KConfig* ) | |||
61 | void KABBasicLook::saveSettings( KConfig* ) | 61 | void KABBasicLook::saveSettings( KConfig* ) |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | KABLookFactory::KABLookFactory( QWidget *parent, const char *name ) | 65 | KABLookFactory::KABLookFactory( QWidget *parent, const char *name ) |
66 | : mParent( parent ), mName( name ) | 66 | : mParent( parent ), mName( name ) |
67 | { | 67 | { |
68 | } | 68 | } |
69 | 69 | ||
70 | KABLookFactory::~KABLookFactory() | 70 | KABLookFactory::~KABLookFactory() |
71 | { | 71 | { |
72 | } | 72 | } |
73 | #ifndef KAB_EMBEDDED | 73 | #ifndef KAB_EMBEDDED_ |
74 | #include "look_basic.moc" | 74 | #include "moc_look_basic.cpp" |
75 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h index a65c99c..a70e7f7 100644 --- a/kaddressbook/details/look_basic.h +++ b/kaddressbook/details/look_basic.h | |||
@@ -16,41 +16,41 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef LOOK_KABBASIC_H | 24 | #ifndef LOOK_KABBASIC_H |
25 | #define LOOK_KABBASIC_H | 25 | #define LOOK_KABBASIC_H |
26 | 26 | ||
27 | #include <kabc/addressbook.h> | 27 | #include <kabc/addressbook.h> |
28 | #include <qvbox.h> | 28 | #include <q3vbox.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | This is a pure virtual base class that defines the | 33 | This is a pure virtual base class that defines the |
34 | interface for how to display and change entries of | 34 | interface for how to display and change entries of |
35 | the KDE addressbook. | 35 | the KDE addressbook. |
36 | 36 | ||
37 | This basic widget does not show anything in its client space. | 37 | This basic widget does not show anything in its client space. |
38 | Derive it and implement its look and how the user may edit the | 38 | Derive it and implement its look and how the user may edit the |
39 | entry. | 39 | entry. |
40 | 40 | ||
41 | The paintEvent() has to paint the whole widget, since repaint() | 41 | The paintEvent() has to paint the whole widget, since repaint() |
42 | calls will not delete the widgets background. | 42 | calls will not delete the widgets background. |
43 | */ | 43 | */ |
44 | class KABBasicLook : public QVBox | 44 | class KABBasicLook : public Q3VBox |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | /** | 49 | /** |
50 | The constructor. | 50 | The constructor. |
51 | */ | 51 | */ |
52 | KABBasicLook( QWidget *parent = 0, const char *name = 0 ); | 52 | KABBasicLook( QWidget *parent = 0, const char *name = 0 ); |
53 | 53 | ||
54 | /** | 54 | /** |
55 | Set the entry. It will be displayed automatically. | 55 | Set the entry. It will be displayed automatically. |
56 | */ | 56 | */ |
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp index 11d06e9..2c3a79d 100644 --- a/kaddressbook/details/look_details.cpp +++ b/kaddressbook/details/look_details.cpp | |||
@@ -180,28 +180,28 @@ void KABDetailedView::mouseMoveEvent( QMouseEvent *e ) | |||
180 | hit = true; | 180 | hit = true; |
181 | 181 | ||
182 | if ( hit ) { | 182 | if ( hit ) { |
183 | if ( cursor().shape() != PointingHandCursor ) | 183 | if ( cursor().shape() != PointingHandCursor ) |
184 | setCursor( PointingHandCursor ); | 184 | setCursor( PointingHandCursor ); |
185 | else if( cursor().shape() != ArrowCursor ) | 185 | else if( cursor().shape() != ArrowCursor ) |
186 | setCursor(ArrowCursor); | 186 | setCursor(ArrowCursor); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | void KABDetailedView::mousePressEvent( QMouseEvent *e ) | 190 | void KABDetailedView::mousePressEvent( QMouseEvent *e ) |
191 | { | 191 | { |
192 | QPopupMenu menu( this ); | 192 | Q3PopupMenu menu( this ); |
193 | QPopupMenu *menuBG = new QPopupMenu( &menu ); | 193 | Q3PopupMenu *menuBG = new Q3PopupMenu( &menu ); |
194 | mMenuBorderedBG = new QPopupMenu( &menu ); | 194 | mMenuBorderedBG = new Q3PopupMenu( &menu ); |
195 | mMenuTiledBG = new QPopupMenu( &menu ); | 195 | mMenuTiledBG = new Q3PopupMenu( &menu ); |
196 | 196 | ||
197 | menu.insertItem( i18n( "Select Background" ), menuBG ); | 197 | menu.insertItem( i18n( "Select Background" ), menuBG ); |
198 | menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG ); | 198 | menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG ); |
199 | menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG ); | 199 | menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG ); |
200 | menu.insertSeparator(); | 200 | menu.insertSeparator(); |
201 | 201 | ||
202 | QPoint point = e->pos() - QPoint( mGrid, mGrid ); | 202 | QPoint point = e->pos() - QPoint( mGrid, mGrid ); |
203 | int rc; | 203 | int rc; |
204 | QStringList dirsBorderedBG, dirsTiledBG; | 204 | QStringList dirsBorderedBG, dirsTiledBG; |
205 | QDir dir; | 205 | QDir dir; |
206 | 206 | ||
207 | switch( e->button() ) { | 207 | switch( e->button() ) { |
@@ -405,15 +405,15 @@ void KABDetailedView::restoreSettings( KConfig *config ) | |||
405 | mPainter->setForegroundColor( black ); | 405 | mPainter->setForegroundColor( black ); |
406 | mPainter->setHeaderColor( mHeadLineTextColor ); | 406 | mPainter->setHeaderColor( mHeadLineTextColor ); |
407 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); | 407 | mPainter->setUseHeaderColor( mUseHeadLineBGColor ); |
408 | mPainter->setBackgroundColor( mHeadLineBGColor ); | 408 | mPainter->setBackgroundColor( mHeadLineBGColor ); |
409 | 409 | ||
410 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); | 410 | mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) ); |
411 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); | 411 | mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) ); |
412 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 412 | mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
413 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); | 413 | mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) ); |
414 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); | 414 | mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) ); |
415 | } | 415 | } |
416 | 416 | ||
417 | #ifndef KAB_EMBEDDED | 417 | #ifndef KAB_EMBEDDED_ |
418 | #include "look_details.moc" | 418 | #include "moc_look_details.cpp" |
419 | #endif //KAB_EMBEDDED | 419 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/details/look_details.h b/kaddressbook/details/look_details.h index e8d50a9..b59d3a7 100644 --- a/kaddressbook/details/look_details.h +++ b/kaddressbook/details/look_details.h | |||
@@ -121,26 +121,26 @@ class KABDetailedView : public KABBasicLook | |||
121 | 121 | ||
122 | QPixmap mDefaultBGImage; | 122 | QPixmap mDefaultBGImage; |
123 | 123 | ||
124 | KToggleAction *mActionShowAddresses; | 124 | KToggleAction *mActionShowAddresses; |
125 | KToggleAction *mActionShowEmails; | 125 | KToggleAction *mActionShowEmails; |
126 | KToggleAction *mActionShowPhones; | 126 | KToggleAction *mActionShowPhones; |
127 | KToggleAction *mActionShowURLs; | 127 | KToggleAction *mActionShowURLs; |
128 | 128 | ||
129 | const int mGrid; | 129 | const int mGrid; |
130 | QStringList mBorders; | 130 | QStringList mBorders; |
131 | QStringList mTiles; | 131 | QStringList mTiles; |
132 | 132 | ||
133 | QPopupMenu *mMenuBorderedBG; | 133 | Q3PopupMenu *mMenuBorderedBG; |
134 | QPopupMenu *mMenuTiledBG; | 134 | Q3PopupMenu *mMenuTiledBG; |
135 | 135 | ||
136 | static const QString mBorderedBGDir; | 136 | static const QString mBorderedBGDir; |
137 | static const QString mTiledBGDir; | 137 | static const QString mTiledBGDir; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | class KABDetailedViewFactory : public KABLookFactory | 140 | class KABDetailedViewFactory : public KABLookFactory |
141 | { | 141 | { |
142 | public: | 142 | public: |
143 | KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 ) | 143 | KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 ) |
144 | : KABLookFactory( parent, name ) {} | 144 | : KABLookFactory( parent, name ) {} |
145 | 145 | ||
146 | KABBasicLook *create() | 146 | KABBasicLook *create() |
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp index bb30650..4ec1c7d 100644 --- a/kaddressbook/details/look_html.cpp +++ b/kaddressbook/details/look_html.cpp | |||
@@ -15,25 +15,25 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <addresseeview.h> | 24 | #include <addresseeview.h> |
25 | 25 | ||
26 | #include "look_html.h" | 26 | #include "look_html.h" |
27 | #include <qscrollview.h> | 27 | #include <q3scrollview.h> |
28 | #include "kabprefs.h" | 28 | #include "kabprefs.h" |
29 | #include <kabc/addresseeview.h> | 29 | #include <kabc/addresseeview.h> |
30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) | 30 | KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) |
31 | : KABBasicLook( parent, name ) | 31 | : KABBasicLook( parent, name ) |
32 | { | 32 | { |
33 | mView = new KABC::AddresseeView( this ); | 33 | mView = new KABC::AddresseeView( this ); |
34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 34 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
35 | connect(this, SIGNAL(printMyView()), | 35 | connect(this, SIGNAL(printMyView()), |
36 | this , SLOT(printMe())); | 36 | this , SLOT(printMe())); |
37 | } | 37 | } |
38 | 38 | ||
39 | KABHtmlView::~KABHtmlView() | 39 | KABHtmlView::~KABHtmlView() |
@@ -42,15 +42,15 @@ KABHtmlView::~KABHtmlView() | |||
42 | void KABHtmlView::printMe() | 42 | void KABHtmlView::printMe() |
43 | { | 43 | { |
44 | mView->printMe(); | 44 | mView->printMe(); |
45 | 45 | ||
46 | } | 46 | } |
47 | 47 | ||
48 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) | 48 | void KABHtmlView::setAddressee( const KABC::Addressee &addr ) |
49 | { | 49 | { |
50 | mView->setFont( KABPrefs::instance()->mDetailsFont ); | 50 | mView->setFont( KABPrefs::instance()->mDetailsFont ); |
51 | mView->setAddressee( addr ); | 51 | mView->setAddressee( addr ); |
52 | } | 52 | } |
53 | 53 | ||
54 | #ifndef KAB_EMBEDDED | 54 | #ifndef KAB_EMBEDDED_ |
55 | #include "look_html.moc" | 55 | #include "moc_look_html.cpp" |
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/emaileditwidget.cpp b/kaddressbook/emaileditwidget.cpp index e72face..09df47f 100644 --- a/kaddressbook/emaileditwidget.cpp +++ b/kaddressbook/emaileditwidget.cpp | |||
@@ -19,52 +19,54 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qtooltip.h> | 30 | #include <qtooltip.h> |
31 | #include <qlistbox.h> | 31 | #include <q3listbox.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3GridLayout> | ||
32 | 34 | ||
33 | #ifndef KAB_EMBEDDED | 35 | #ifndef KAB_EMBEDDED |
34 | #include <kaccelmanager.h> | 36 | #include <kaccelmanager.h> |
35 | #endif //KAB_EMBEDDED | 37 | #endif //KAB_EMBEDDED |
36 | #include <kconfig.h> | 38 | #include <kconfig.h> |
37 | #include <kcombobox.h> | 39 | #include <kcombobox.h> |
38 | #include <kdebug.h> | 40 | #include <kdebug.h> |
39 | #include <kglobal.h> | 41 | #include <kglobal.h> |
40 | #include <kdialog.h> | 42 | #include <kdialog.h> |
41 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
42 | #include <klineedit.h> | 44 | #include <klineedit.h> |
43 | #include <klocale.h> | 45 | #include <klocale.h> |
44 | #include <kmessagebox.h> | 46 | #include <kmessagebox.h> |
45 | 47 | ||
46 | #include "emaileditwidget.h" | 48 | #include "emaileditwidget.h" |
47 | 49 | ||
48 | EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name ) | 50 | EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name ) |
49 | : QWidget( parent, name ) | 51 | : QWidget( parent, name ) |
50 | { | 52 | { |
51 | QGridLayout *topLayout = new QGridLayout( this, 2, 2 ); | 53 | Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 2 ); |
52 | topLayout->setSpacing( KDialog::spacingHint() ); | 54 | topLayout->setSpacing( KDialog::spacingHint() ); |
53 | QLabel* label = new QLabel( this ); | 55 | QLabel* label = new QLabel( this ); |
54 | 56 | ||
55 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "mail_send", KIcon::Desktop, 0) ); | 57 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "mail_send", KIcon::Desktop, 0) ); |
56 | 58 | ||
57 | topLayout->addWidget( label, 0, 0 ); | 59 | topLayout->addWidget( label, 0, 0 ); |
58 | label->setAlignment( AlignCenter ); | 60 | label->setAlignment( Qt::AlignCenter ); |
59 | QPushButton *editButton = new QPushButton( i18n( "Edit Email Addresses..." ), this); | 61 | QPushButton *editButton = new QPushButton( i18n( "Edit Email Addresses..." ), this); |
60 | topLayout->addWidget( editButton, 0, 1 ); | 62 | topLayout->addWidget( editButton, 0, 1 ); |
61 | label = new QLabel( i18n( "Email:" ), this ); | 63 | label = new QLabel( i18n( "Email:" ), this ); |
62 | topLayout->addWidget( label, 1, 0 ); | 64 | topLayout->addWidget( label, 1, 0 ); |
63 | 65 | ||
64 | mEmailEdit = new KLineEdit( this ); | 66 | mEmailEdit = new KLineEdit( this ); |
65 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), | 67 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), |
66 | SLOT( textChanged( const QString& ) ) ); | 68 | SLOT( textChanged( const QString& ) ) ); |
67 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), | 69 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), |
68 | SIGNAL( modified() ) ); | 70 | SIGNAL( modified() ) ); |
69 | label->setBuddy( mEmailEdit ); | 71 | label->setBuddy( mEmailEdit ); |
70 | topLayout->addWidget( mEmailEdit, 1, 1 ); | 72 | topLayout->addWidget( mEmailEdit, 1, 1 ); |
@@ -128,42 +130,42 @@ void EmailEditWidget::textChanged( const QString &text ) | |||
128 | mEmailList.prepend( text ); | 130 | mEmailList.prepend( text ); |
129 | } | 131 | } |
130 | 132 | ||
131 | 133 | ||
132 | EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent, | 134 | EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent, |
133 | const char *name ) | 135 | const char *name ) |
134 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Email Addresses" ), | 136 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Email Addresses" ), |
135 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 137 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
136 | parent, name, true ) | 138 | parent, name, true ) |
137 | { | 139 | { |
138 | QWidget *page = plainPage(); | 140 | QWidget *page = plainPage(); |
139 | 141 | ||
140 | QGridLayout *topLayout = new QGridLayout( page, 4, 3 ); | 142 | Q3GridLayout *topLayout = new Q3GridLayout( page, 4, 3 ); |
141 | 143 | ||
142 | QLabel *label = new QLabel( i18n( "Email address:" ), page ); | 144 | QLabel *label = new QLabel( i18n( "Email address:" ), page ); |
143 | topLayout->addWidget( label, 0, 0 ); | 145 | topLayout->addWidget( label, 0, 0 ); |
144 | 146 | ||
145 | mEmailEdit = new KLineEdit( page ); | 147 | mEmailEdit = new KLineEdit( page ); |
146 | label->setBuddy( mEmailEdit ); | 148 | label->setBuddy( mEmailEdit ); |
147 | topLayout->addWidget( mEmailEdit, 0, 1 ); | 149 | topLayout->addWidget( mEmailEdit, 0, 1 ); |
148 | connect( mEmailEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); | 150 | connect( mEmailEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); |
149 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), | 151 | connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ), |
150 | SLOT( emailChanged() ) ); | 152 | SLOT( emailChanged() ) ); |
151 | 153 | ||
152 | mAddButton = new QPushButton( i18n( "Add" ), page ); | 154 | mAddButton = new QPushButton( i18n( "Add" ), page ); |
153 | mAddButton->setEnabled( false ); | 155 | mAddButton->setEnabled( false ); |
154 | connect( mAddButton, SIGNAL( clicked() ), SLOT( add() ) ); | 156 | connect( mAddButton, SIGNAL( clicked() ), SLOT( add() ) ); |
155 | topLayout->addWidget( mAddButton, 0, 2 ); | 157 | topLayout->addWidget( mAddButton, 0, 2 ); |
156 | 158 | ||
157 | mEmailListBox = new QListBox( page ); | 159 | mEmailListBox = new Q3ListBox( page ); |
158 | 160 | ||
159 | // Make sure there is room for the scrollbar | 161 | // Make sure there is room for the scrollbar |
160 | mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 ); | 162 | mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 ); |
161 | connect( mEmailListBox, SIGNAL( highlighted( int ) ), | 163 | connect( mEmailListBox, SIGNAL( highlighted( int ) ), |
162 | SLOT( selectionChanged( int ) ) ); | 164 | SLOT( selectionChanged( int ) ) ); |
163 | topLayout->addMultiCellWidget( mEmailListBox, 1, 3, 0, 1 ); | 165 | topLayout->addMultiCellWidget( mEmailListBox, 1, 3, 0, 1 ); |
164 | 166 | ||
165 | mEditButton = new QPushButton( i18n( "Change" ), page ); | 167 | mEditButton = new QPushButton( i18n( "Change" ), page ); |
166 | connect( mEditButton, SIGNAL( clicked() ), SLOT( edit() ) ); | 168 | connect( mEditButton, SIGNAL( clicked() ), SLOT( edit() ) ); |
167 | topLayout->addWidget( mEditButton, 1, 2 ); | 169 | topLayout->addWidget( mEditButton, 1, 2 ); |
168 | 170 | ||
169 | mRemoveButton = new QPushButton( i18n( "Remove" ), page ); | 171 | mRemoveButton = new QPushButton( i18n( "Remove" ), page ); |
@@ -263,15 +265,15 @@ void EmailEditDialog::selectionChanged( int index ) | |||
263 | bool value = ( index >= 0 ); // An item is selected | 265 | bool value = ( index >= 0 ); // An item is selected |
264 | 266 | ||
265 | mRemoveButton->setEnabled( value ); | 267 | mRemoveButton->setEnabled( value ); |
266 | mEditButton->setEnabled( value ); | 268 | mEditButton->setEnabled( value ); |
267 | mStandardButton->setEnabled( value ); | 269 | mStandardButton->setEnabled( value ); |
268 | } | 270 | } |
269 | 271 | ||
270 | void EmailEditDialog::emailChanged() | 272 | void EmailEditDialog::emailChanged() |
271 | { | 273 | { |
272 | mAddButton->setEnabled( !mEmailEdit->text().isEmpty() ); | 274 | mAddButton->setEnabled( !mEmailEdit->text().isEmpty() ); |
273 | } | 275 | } |
274 | 276 | ||
275 | #ifndef KAB_EMBEDDED | 277 | #ifndef KAB_EMBEDDED_ |
276 | #include "emaileditwidget.moc" | 278 | #include "moc_emaileditwidget.cpp" |
277 | #endif //KAB_EMBEDDED | 279 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/emaileditwidget.h b/kaddressbook/emaileditwidget.h index acdecaf..618acee 100644 --- a/kaddressbook/emaileditwidget.h +++ b/kaddressbook/emaileditwidget.h | |||
@@ -20,29 +20,29 @@ | |||
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef EMAILEDITWIDGET_H | 24 | #ifndef EMAILEDITWIDGET_H |
25 | #define EMAILEDITWIDGET_H | 25 | #define EMAILEDITWIDGET_H |
26 | 26 | ||
27 | #include <kabc/addressee.h> | 27 | #include <kabc/addressee.h> |
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
29 | 29 | ||
30 | #include "addresseeconfig.h" | 30 | #include "addresseeconfig.h" |
31 | 31 | ||
32 | class QButtonGroup; | 32 | class Q3ButtonGroup; |
33 | class QCheckBox; | 33 | class QCheckBox; |
34 | class QListView; | 34 | class Q3ListView; |
35 | class QListBox; | 35 | class Q3ListBox; |
36 | class QTextEdit; | 36 | class Q3TextEdit; |
37 | class QToolButton; | 37 | class QToolButton; |
38 | 38 | ||
39 | class KComboBox; | 39 | class KComboBox; |
40 | class KLineEdit; | 40 | class KLineEdit; |
41 | class KListView; | 41 | class KListView; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This widget displays a list box of the email addresses as well as buttons | 44 | This widget displays a list box of the email addresses as well as buttons |
45 | to manipulate them (up, down, add, remove). | 45 | to manipulate them (up, down, add, remove). |
46 | */ | 46 | */ |
47 | class EmailEditWidget : public QWidget | 47 | class EmailEditWidget : public QWidget |
48 | { | 48 | { |
@@ -80,22 +80,22 @@ class EmailEditDialog : public KDialogBase | |||
80 | bool changed() const; | 80 | bool changed() const; |
81 | 81 | ||
82 | protected slots: | 82 | protected slots: |
83 | void add(); | 83 | void add(); |
84 | void remove(); | 84 | void remove(); |
85 | void edit(); | 85 | void edit(); |
86 | void standard(); | 86 | void standard(); |
87 | void selectionChanged( int ); | 87 | void selectionChanged( int ); |
88 | void emailChanged(); | 88 | void emailChanged(); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | KLineEdit *mEmailEdit; | 91 | KLineEdit *mEmailEdit; |
92 | QListBox *mEmailListBox; | 92 | Q3ListBox *mEmailListBox; |
93 | QPushButton *mAddButton; | 93 | QPushButton *mAddButton; |
94 | QPushButton *mRemoveButton; | 94 | QPushButton *mRemoveButton; |
95 | QPushButton *mEditButton; | 95 | QPushButton *mEditButton; |
96 | QPushButton *mStandardButton; | 96 | QPushButton *mStandardButton; |
97 | 97 | ||
98 | bool mChanged; | 98 | bool mChanged; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | #endif | 101 | #endif |
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index 46defa1..5356224 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp | |||
@@ -13,61 +13,63 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3HBoxLayout> | ||
25 | #include <kactionclasses.h> | 27 | #include <kactionclasses.h> |
26 | #include <kconfig.h> | 28 | #include <kconfig.h> |
27 | #include <kdebug.h> | 29 | #include <kdebug.h> |
28 | #include <klocale.h> | 30 | #include <klocale.h> |
29 | 31 | ||
30 | #ifndef KAB_EMBEDDED | 32 | #ifndef KAB_EMBEDDED |
31 | #include <ktrader.h> | 33 | #include <ktrader.h> |
32 | #else //KAB_EMBEDDED | 34 | #else //KAB_EMBEDDED |
33 | #include <features/mergewidget.h> | 35 | #include <features/mergewidget.h> |
34 | #include <features/distributionlistwidget.h> | 36 | #include <features/distributionlistwidget.h> |
35 | #endif //KAB_EMBEDDED | 37 | #endif //KAB_EMBEDDED |
36 | 38 | ||
37 | #include "addresseeeditorwidget.h" | 39 | #include "addresseeeditorwidget.h" |
38 | #include "kabcore.h" | 40 | #include "kabcore.h" |
39 | #include "kabprefs.h" | 41 | #include "kabprefs.h" |
40 | 42 | ||
41 | #include "extensionmanager.h" | 43 | #include "extensionmanager.h" |
42 | 44 | ||
43 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, | 45 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, |
44 | const char *name ) | 46 | const char *name ) |
45 | : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) | 47 | : Q3ScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) |
46 | { | 48 | { |
47 | #ifdef KAB_EMBEDDED | 49 | #ifdef KAB_EMBEDDED |
48 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 50 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
49 | QWidget *settingsmenu = (QWidget*)mCore->getViewMenu(); | 51 | QWidget *settingsmenu = (QWidget*)mCore->getViewMenu(); |
50 | #endif //KAB_EMBEDDED | 52 | #endif //KAB_EMBEDDED |
51 | 53 | ||
52 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, | 54 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, |
53 | mCore->actionCollection(), | 55 | mCore->actionCollection(), |
54 | "options_show_extensions" ); | 56 | "options_show_extensions" ); |
55 | 57 | ||
56 | mActionExtensions->plug( settingsmenu ,0); | 58 | mActionExtensions->plug( settingsmenu ,0); |
57 | 59 | ||
58 | connect( mActionExtensions, SIGNAL( activated( int ) ), | 60 | connect( mActionExtensions, SIGNAL( activated( int ) ), |
59 | SLOT( setActiveExtension( int ) ) ); | 61 | SLOT( setActiveExtension( int ) ) ); |
60 | mWidgetBox = new QWidget( viewport() ); | 62 | mWidgetBox = new QWidget( viewport() ); |
61 | new QHBoxLayout (mWidgetBox ); | 63 | new Q3HBoxLayout (mWidgetBox ); |
62 | addChild( mWidgetBox ); | 64 | addChild( mWidgetBox ); |
63 | setResizePolicy(AutoOneFit); | 65 | setResizePolicy(AutoOneFit); |
64 | createExtensionWidgets(); | 66 | createExtensionWidgets(); |
65 | hide(); | 67 | hide(); |
66 | } | 68 | } |
67 | 69 | ||
68 | ExtensionManager::~ExtensionManager() | 70 | ExtensionManager::~ExtensionManager() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void ExtensionManager::restoreSettings() | 74 | void ExtensionManager::restoreSettings() |
73 | { | 75 | { |
@@ -139,36 +141,36 @@ void ExtensionManager::setActiveExtension( int id ) | |||
139 | //US mCore->setDetailsToState( ); | 141 | //US mCore->setDetailsToState( ); |
140 | #endif //KAB_EMBEDDED | 142 | #endif //KAB_EMBEDDED |
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||
144 | emit changedActiveExtension( id ); | 146 | emit changedActiveExtension( id ); |
145 | } | 147 | } |
146 | 148 | ||
147 | void ExtensionManager::createExtensionWidgets() | 149 | void ExtensionManager::createExtensionWidgets() |
148 | { | 150 | { |
149 | // clear extension widget list | 151 | // clear extension widget list |
150 | mExtensionWidgetList.setAutoDelete( true ); | 152 | mExtensionWidgetList.setAutoDelete( true ); |
151 | QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); | 153 | Q3PtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); |
152 | ExtensionWidget *wdg = 0; | 154 | ExtensionWidget *wdg = 0; |
153 | while ( ( wdg = wdgIt.current() ) != 0 ) | 155 | while ( ( wdg = wdgIt.current() ) != 0 ) |
154 | mExtensionWidgetList.remove( wdg ); | 156 | mExtensionWidgetList.remove( wdg ); |
155 | 157 | ||
156 | mExtensionWidgetList.setAutoDelete( false ); | 158 | mExtensionWidgetList.setAutoDelete( false ); |
157 | 159 | ||
158 | QStringList extensionNames( i18n( "None" ) ); | 160 | QStringList extensionNames( i18n( "None" ) ); |
159 | 161 | ||
160 | // add addressee editor as default | 162 | // add addressee editor as default |
161 | 163 | ||
162 | QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();; | 164 | Q3HBoxLayout *hbl = (Q3HBoxLayout *) mWidgetBox->layout();; |
163 | 165 | ||
164 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); | 166 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); |
165 | hbl->addWidget( wdg ); | 167 | hbl->addWidget( wdg ); |
166 | //wdg->hide(); | 168 | //wdg->hide(); |
167 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 169 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
168 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 170 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
169 | mExtensionWidgetList.append( wdg ); | 171 | mExtensionWidgetList.append( wdg ); |
170 | extensionNames.append( wdg->title() ); | 172 | extensionNames.append( wdg->title() ); |
171 | 173 | ||
172 | // load the other extensions | 174 | // load the other extensions |
173 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 175 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
174 | 176 | ||
@@ -235,15 +237,15 @@ void ExtensionManager::createExtensionWidgets() | |||
235 | } | 237 | } |
236 | } | 238 | } |
237 | 239 | ||
238 | hbl->addStretch(); | 240 | hbl->addStretch(); |
239 | 241 | ||
240 | #endif //KAB_EMBEDDED | 242 | #endif //KAB_EMBEDDED |
241 | 243 | ||
242 | 244 | ||
243 | mActionExtensions->setItems( extensionNames ); | 245 | mActionExtensions->setItems( extensionNames ); |
244 | mCurrentExtensionWidget = 0; | 246 | mCurrentExtensionWidget = 0; |
245 | } | 247 | } |
246 | 248 | ||
247 | #ifndef KAB_EMBEDDED | 249 | #ifndef KAB_EMBEDDED_ |
248 | #include "extensionmanager.moc" | 250 | #include "moc_extensionmanager.cpp" |
249 | #endif //KAB_EMBEDDED | 251 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/extensionmanager.h b/kaddressbook/extensionmanager.h index 611a037..84c948b 100644 --- a/kaddressbook/extensionmanager.h +++ b/kaddressbook/extensionmanager.h | |||
@@ -15,35 +15,35 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef EXTENSIONMANAGER_H | 24 | #ifndef EXTENSIONMANAGER_H |
25 | #define EXTENSIONMANAGER_H | 25 | #define EXTENSIONMANAGER_H |
26 | 26 | ||
27 | #include <qhbox.h> | 27 | #include <q3hbox.h> |
28 | #include <qscrollview.h> | 28 | #include <q3scrollview.h> |
29 | #include <qptrlist.h> | 29 | #include <q3ptrlist.h> |
30 | 30 | ||
31 | #include <extensionwidget.h> | 31 | #include <extensionwidget.h> |
32 | 32 | ||
33 | class KABCore; | 33 | class KABCore; |
34 | class KSelectAction; | 34 | class KSelectAction; |
35 | 35 | ||
36 | 36 | ||
37 | class ExtensionManager : public QScrollView | 37 | class ExtensionManager : public Q3ScrollView |
38 | { | 38 | { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | ExtensionManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 42 | ExtensionManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
43 | ~ExtensionManager(); | 43 | ~ExtensionManager(); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | Restores the extension manager specific settings. | 46 | Restores the extension manager specific settings. |
47 | */ | 47 | */ |
48 | void restoreSettings(); | 48 | void restoreSettings(); |
49 | 49 | ||
@@ -71,19 +71,19 @@ class ExtensionManager : public QScrollView | |||
71 | void changedActiveExtension( int id ); | 71 | void changedActiveExtension( int id ); |
72 | 72 | ||
73 | private slots: | 73 | private slots: |
74 | void setActiveExtension( int id ); | 74 | void setActiveExtension( int id ); |
75 | 75 | ||
76 | private: | 76 | private: |
77 | void createExtensionWidgets(); | 77 | void createExtensionWidgets(); |
78 | 78 | ||
79 | KABCore *mCore; | 79 | KABCore *mCore; |
80 | QWidget *mWidgetBox; | 80 | QWidget *mWidgetBox; |
81 | 81 | ||
82 | ExtensionWidget *mCurrentExtensionWidget; | 82 | ExtensionWidget *mCurrentExtensionWidget; |
83 | QPtrList<ExtensionWidget> mExtensionWidgetList; | 83 | Q3PtrList<ExtensionWidget> mExtensionWidgetList; |
84 | 84 | ||
85 | KSelectAction *mActionExtensions; | 85 | KSelectAction *mActionExtensions; |
86 | 86 | ||
87 | }; | 87 | }; |
88 | 88 | ||
89 | #endif | 89 | #endif |
diff --git a/kaddressbook/extensionwidget.cpp b/kaddressbook/extensionwidget.cpp index 69f4aa8..7c3b415 100644 --- a/kaddressbook/extensionwidget.cpp +++ b/kaddressbook/extensionwidget.cpp | |||
@@ -69,16 +69,15 @@ QString ExtensionWidget::title() const | |||
69 | } | 69 | } |
70 | 70 | ||
71 | QString ExtensionWidget::identifier() const | 71 | QString ExtensionWidget::identifier() const |
72 | { | 72 | { |
73 | return "<bug!!!>"; | 73 | return "<bug!!!>"; |
74 | } | 74 | } |
75 | 75 | ||
76 | ConfigureWidget *ExtensionFactory::configureWidget( QWidget*, const char* ) | 76 | ConfigureWidget *ExtensionFactory::configureWidget( QWidget*, const char* ) |
77 | { | 77 | { |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | #ifndef KAB_EMBEDDED | 81 | #ifndef KAB_EMBEDDED_ |
82 | #include "extensionwidget.moc" | 82 | #include "moc_extensionwidget.cpp" |
83 | #endif //KAB_EMBEDDED | 83 | #endif //KAB_EMBEDDED |
84 | |||
diff --git a/kaddressbook/extensionwidget.h b/kaddressbook/extensionwidget.h index fc91f21..9fcfba9 100644 --- a/kaddressbook/extensionwidget.h +++ b/kaddressbook/extensionwidget.h | |||
@@ -77,27 +77,27 @@ class ExtensionWidget : public QWidget | |||
77 | 77 | ||
78 | signals: | 78 | signals: |
79 | void modified( const KABC::Addressee::List &list ); | 79 | void modified( const KABC::Addressee::List &list ); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | KABCore *mCore; | 82 | KABCore *mCore; |
83 | 83 | ||
84 | class ExtensionWidgetPrivate; | 84 | class ExtensionWidgetPrivate; |
85 | ExtensionWidgetPrivate *d; | 85 | ExtensionWidgetPrivate *d; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | #ifndef KAB_EMBEDDED | 88 | #ifndef KAB_EMBEDDED |
89 | //MOC_SKIP_BEGIN | 89 | #ifndef Q_MOC_RUN |
90 | class ExtensionFactory : public KLibFactory | 90 | class ExtensionFactory : public KLibFactory |
91 | //MOC_SKIP_END | 91 | #endif |
92 | #else //KAB_EMBEDDED | 92 | #else //KAB_EMBEDDED |
93 | class ExtensionFactory | 93 | class ExtensionFactory |
94 | #endif //KAB_EMBEDDED | 94 | #endif //KAB_EMBEDDED |
95 | { | 95 | { |
96 | public: | 96 | public: |
97 | virtual ExtensionWidget *extension( KABCore *core, QWidget *parent, | 97 | virtual ExtensionWidget *extension( KABCore *core, QWidget *parent, |
98 | const char *name = 0 ) = 0; | 98 | const char *name = 0 ) = 0; |
99 | 99 | ||
100 | virtual ConfigureWidget *configureWidget( QWidget *parent, | 100 | virtual ConfigureWidget *configureWidget( QWidget *parent, |
101 | const char *name = 0 ); | 101 | const char *name = 0 ); |
102 | 102 | ||
103 | virtual bool configureWidgetAvailable() { return false; } | 103 | virtual bool configureWidgetAvailable() { return false; } |
diff --git a/kaddressbook/features/distributionlistwidget.cpp b/kaddressbook/features/distributionlistwidget.cpp index bfcb121..996177b 100644 --- a/kaddressbook/features/distributionlistwidget.cpp +++ b/kaddressbook/features/distributionlistwidget.cpp | |||
@@ -12,31 +12,38 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qbuttongroup.h> | 24 | #include <q3buttongroup.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qlistview.h> | 28 | #include <q3listview.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qradiobutton.h> | 30 | #include <qradiobutton.h> |
31 | //Added by qt3to4: | ||
32 | #include <QDragMoveEvent> | ||
33 | #include <QDropEvent> | ||
34 | #include <Q3GridLayout> | ||
35 | #include <Q3Frame> | ||
36 | #include <Q3VBoxLayout> | ||
37 | #include <QDragEnterEvent> | ||
31 | 38 | ||
32 | #ifndef KAB_EMBEDDED | 39 | #ifndef KAB_EMBEDDED |
33 | #include <kaccelmanager.h> | 40 | #include <kaccelmanager.h> |
34 | #endif //KAB_EMBEDDED | 41 | #endif //KAB_EMBEDDED |
35 | 42 | ||
36 | 43 | ||
37 | #include <kdebug.h> | 44 | #include <kdebug.h> |
38 | #include <klineeditdlg.h> | 45 | #include <klineeditdlg.h> |
39 | #include <klocale.h> | 46 | #include <klocale.h> |
40 | #include <kglobal.h> | 47 | #include <kglobal.h> |
41 | #include <kmessagebox.h> | 48 | #include <kmessagebox.h> |
42 | 49 | ||
@@ -68,30 +75,30 @@ class DistributionListFactory : public ExtensionFactory | |||
68 | return "distribution_list_editor"; | 75 | return "distribution_list_editor"; |
69 | } | 76 | } |
70 | }; | 77 | }; |
71 | 78 | ||
72 | extern "C" { | 79 | extern "C" { |
73 | void *init_libkaddrbk_distributionlist() | 80 | void *init_libkaddrbk_distributionlist() |
74 | { | 81 | { |
75 | return ( new DistributionListFactory ); | 82 | return ( new DistributionListFactory ); |
76 | } | 83 | } |
77 | } | 84 | } |
78 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
79 | 86 | ||
80 | class ContactItem : public QListViewItem | 87 | class ContactItem : public Q3ListViewItem |
81 | { | 88 | { |
82 | public: | 89 | public: |
83 | ContactItem( DistributionListView *parent, const KABC::Addressee &addressee, | 90 | ContactItem( DistributionListView *parent, const KABC::Addressee &addressee, |
84 | const QString &email = QString::null ) : | 91 | const QString &email = QString::null ) : |
85 | QListViewItem( parent ), | 92 | Q3ListViewItem( parent ), |
86 | mAddressee( addressee ), | 93 | mAddressee( addressee ), |
87 | mEmail( email ) | 94 | mEmail( email ) |
88 | { | 95 | { |
89 | setText( 0, addressee.realName() ); | 96 | setText( 0, addressee.realName() ); |
90 | if( email.isEmpty() ) { | 97 | if( email.isEmpty() ) { |
91 | setText( 1, addressee.preferredEmail() ); | 98 | setText( 1, addressee.preferredEmail() ); |
92 | setText( 2, i18n( "Yes" ) ); | 99 | setText( 2, i18n( "Yes" ) ); |
93 | } else { | 100 | } else { |
94 | setText( 1, email ); | 101 | setText( 1, email ); |
95 | setText( 2, i18n( "No" ) ); | 102 | setText( 2, i18n( "No" ) ); |
96 | } | 103 | } |
97 | } | 104 | } |
@@ -112,25 +119,25 @@ class ContactItem : public QListViewItem | |||
112 | return true; | 119 | return true; |
113 | } | 120 | } |
114 | 121 | ||
115 | private: | 122 | private: |
116 | KABC::Addressee mAddressee; | 123 | KABC::Addressee mAddressee; |
117 | QString mEmail; | 124 | QString mEmail; |
118 | }; | 125 | }; |
119 | 126 | ||
120 | DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent, | 127 | DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent, |
121 | const char *name ) | 128 | const char *name ) |
122 | : ExtensionWidget( core, parent, name ), mManager( 0 ) | 129 | : ExtensionWidget( core, parent, name ), mManager( 0 ) |
123 | { | 130 | { |
124 | QGridLayout *topLayout = new QGridLayout( this, 3, 4, KDialog::marginHint(), | 131 | Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 4, KDialog::marginHint(), |
125 | KDialog::spacingHint() ); | 132 | KDialog::spacingHint() ); |
126 | 133 | ||
127 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 134 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
128 | { | 135 | { |
129 | mCreateListButton = new QPushButton( i18n( "New List" ), this ); | 136 | mCreateListButton = new QPushButton( i18n( "New List" ), this ); |
130 | mEditListButton = new QPushButton( i18n( "Ren List" ), this ); | 137 | mEditListButton = new QPushButton( i18n( "Ren List" ), this ); |
131 | mRemoveListButton = new QPushButton( i18n( "Del List" ), this ); | 138 | mRemoveListButton = new QPushButton( i18n( "Del List" ), this ); |
132 | mAddContactButton = new QPushButton( i18n( "Add Cont." ), this ); | 139 | mAddContactButton = new QPushButton( i18n( "Add Cont." ), this ); |
133 | mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this ); | 140 | mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this ); |
134 | mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this ); | 141 | mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this ); |
135 | } | 142 | } |
136 | else | 143 | else |
@@ -157,26 +164,26 @@ DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent, | |||
157 | 164 | ||
158 | mContactView = new DistributionListView( this ); | 165 | mContactView = new DistributionListView( this ); |
159 | mContactView->addColumn( i18n( "Name" ) ); | 166 | mContactView->addColumn( i18n( "Name" ) ); |
160 | mContactView->addColumn( i18n( "Email" ) ); | 167 | mContactView->addColumn( i18n( "Email" ) ); |
161 | mContactView->addColumn( i18n( "Use Preferred" ) ); | 168 | mContactView->addColumn( i18n( "Use Preferred" ) ); |
162 | mContactView->setEnabled( false ); | 169 | mContactView->setEnabled( false ); |
163 | mContactView->setAllColumnsShowFocus( true ); | 170 | mContactView->setAllColumnsShowFocus( true ); |
164 | mContactView->setMinimumHeight( 30 ); | 171 | mContactView->setMinimumHeight( 30 ); |
165 | 172 | ||
166 | topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 ); | 173 | topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 ); |
167 | connect( mContactView, SIGNAL( selectionChanged() ), | 174 | connect( mContactView, SIGNAL( selectionChanged() ), |
168 | SLOT( selectionContactViewChanged() ) ); | 175 | SLOT( selectionContactViewChanged() ) ); |
169 | connect( mContactView, SIGNAL( dropped( QDropEvent*, QListViewItem* ) ), | 176 | connect( mContactView, SIGNAL( dropped( QDropEvent*, Q3ListViewItem* ) ), |
170 | SLOT( dropped( QDropEvent*, QListViewItem* ) ) ); | 177 | SLOT( dropped( QDropEvent*, Q3ListViewItem* ) ) ); |
171 | 178 | ||
172 | mAddContactButton->setEnabled( false ); | 179 | mAddContactButton->setEnabled( false ); |
173 | topLayout->addWidget( mAddContactButton, 2, 0 ); | 180 | topLayout->addWidget( mAddContactButton, 2, 0 ); |
174 | connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) ); | 181 | connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) ); |
175 | 182 | ||
176 | topLayout->addWidget( mChangeEmailButton, 2, 2 ); | 183 | topLayout->addWidget( mChangeEmailButton, 2, 2 ); |
177 | connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); | 184 | connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); |
178 | 185 | ||
179 | topLayout->addWidget( mRemoveContactButton, 2, 3 ); | 186 | topLayout->addWidget( mRemoveContactButton, 2, 3 ); |
180 | connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) ); | 187 | connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) ); |
181 | 188 | ||
182 | mManager = new KABC::DistributionListManager( core->addressBook() ); | 189 | mManager = new KABC::DistributionListManager( core->addressBook() ); |
@@ -401,101 +408,101 @@ void DistributionListWidget::contactsSelectionChanged() | |||
401 | } | 408 | } |
402 | 409 | ||
403 | QString DistributionListWidget::title() const | 410 | QString DistributionListWidget::title() const |
404 | { | 411 | { |
405 | return i18n( "Distribution List Editor" ); | 412 | return i18n( "Distribution List Editor" ); |
406 | } | 413 | } |
407 | 414 | ||
408 | QString DistributionListWidget::identifier() const | 415 | QString DistributionListWidget::identifier() const |
409 | { | 416 | { |
410 | return "distribution_list_editor"; | 417 | return "distribution_list_editor"; |
411 | } | 418 | } |
412 | 419 | ||
413 | void DistributionListWidget::dropped( QDropEvent *e, QListViewItem* ) | 420 | void DistributionListWidget::dropped( QDropEvent *e, Q3ListViewItem* ) |
414 | { | 421 | { |
415 | dropEvent( e ); | 422 | dropEvent( e ); |
416 | } | 423 | } |
417 | 424 | ||
418 | void DistributionListWidget::changed() | 425 | void DistributionListWidget::changed() |
419 | { | 426 | { |
420 | save(); | 427 | save(); |
421 | } | 428 | } |
422 | 429 | ||
423 | 430 | ||
424 | DistributionListView::DistributionListView( QWidget *parent, const char* name ) | 431 | DistributionListView::DistributionListView( QWidget *parent, const char* name ) |
425 | : KListView( parent, name ) | 432 | : KListView( parent, name ) |
426 | { | 433 | { |
427 | setDragEnabled( true ); | 434 | setDragEnabled( true ); |
428 | setAcceptDrops( true ); | 435 | setAcceptDrops( true ); |
429 | setAllColumnsShowFocus( true ); | 436 | setAllColumnsShowFocus( true ); |
430 | } | 437 | } |
431 | 438 | ||
432 | void DistributionListView::dragEnterEvent( QDragEnterEvent* e ) | 439 | void DistributionListView::dragEnterEvent( QDragEnterEvent* e ) |
433 | { | 440 | { |
434 | #ifndef KAB_EMBEDDED | 441 | #ifndef KAB_EMBEDDED |
435 | bool canDecode = QTextDrag::canDecode( e ); | 442 | bool canDecode = Q3TextDrag::canDecode( e ); |
436 | e->accept( canDecode ); | 443 | e->accept( canDecode ); |
437 | #endif //KAB_EMBEDDED | 444 | #endif //KAB_EMBEDDED |
438 | } | 445 | } |
439 | 446 | ||
440 | void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e ) | 447 | void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e ) |
441 | { | 448 | { |
442 | #ifndef KAB_EMBEDDED | 449 | #ifndef KAB_EMBEDDED |
443 | bool canDecode = QTextDrag::canDecode( e ); | 450 | bool canDecode = Q3TextDrag::canDecode( e ); |
444 | e->accept( canDecode ); | 451 | e->accept( canDecode ); |
445 | #endif //KAB_EMBEDDED | 452 | #endif //KAB_EMBEDDED |
446 | } | 453 | } |
447 | 454 | ||
448 | void DistributionListView::viewportDropEvent( QDropEvent *e ) | 455 | void DistributionListView::viewportDropEvent( QDropEvent *e ) |
449 | { | 456 | { |
450 | emit dropped( e, 0 ); | 457 | emit dropped( e, 0 ); |
451 | } | 458 | } |
452 | 459 | ||
453 | void DistributionListView::dropEvent( QDropEvent *e ) | 460 | void DistributionListView::dropEvent( QDropEvent *e ) |
454 | { | 461 | { |
455 | emit dropped( e, 0 ); | 462 | emit dropped( e, 0 ); |
456 | } | 463 | } |
457 | 464 | ||
458 | 465 | ||
459 | EmailSelector::EmailSelector( const QStringList &emails, | 466 | EmailSelector::EmailSelector( const QStringList &emails, |
460 | const QString ¤t, QWidget *parent ) | 467 | const QString ¤t, QWidget *parent ) |
461 | : KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, | 468 | : KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, |
462 | parent ) | 469 | parent ) |
463 | { | 470 | { |
464 | QFrame *topFrame = plainPage(); | 471 | Q3Frame *topFrame = plainPage(); |
465 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 472 | Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame ); |
466 | 473 | ||
467 | mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), | 474 | mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"), |
468 | topFrame ); | 475 | topFrame ); |
469 | topLayout->addWidget( mButtonGroup ); | 476 | topLayout->addWidget( mButtonGroup ); |
470 | 477 | ||
471 | QStringList::ConstIterator it; | 478 | QStringList::ConstIterator it; |
472 | for( it = emails.begin(); it != emails.end(); ++it ) { | 479 | for( it = emails.begin(); it != emails.end(); ++it ) { |
473 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); | 480 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); |
474 | if ( (*it) == current ) { | 481 | if ( (*it) == current ) { |
475 | button->setDown( true ); | 482 | button->setDown( true ); |
476 | } | 483 | } |
477 | } | 484 | } |
478 | } | 485 | } |
479 | 486 | ||
480 | QString EmailSelector::selected() | 487 | QString EmailSelector::selected() |
481 | { | 488 | { |
482 | QButton *button = mButtonGroup->selected(); | 489 | QAbstractButton *button = mButtonGroup->selected(); |
483 | if ( button ) | 490 | if ( button ) |
484 | return button->text(); | 491 | return button->text(); |
485 | 492 | ||
486 | return QString::null; | 493 | return QString::null; |
487 | } | 494 | } |
488 | 495 | ||
489 | QString EmailSelector::getEmail( const QStringList &emails, | 496 | QString EmailSelector::getEmail( const QStringList &emails, |
490 | const QString ¤t, QWidget *parent ) | 497 | const QString ¤t, QWidget *parent ) |
491 | { | 498 | { |
492 | EmailSelector dlg( emails, current, parent ); | 499 | EmailSelector dlg( emails, current, parent ); |
493 | dlg.exec(); | 500 | dlg.exec(); |
494 | 501 | ||
495 | return dlg.selected(); | 502 | return dlg.selected(); |
496 | } | 503 | } |
497 | 504 | ||
498 | 505 | ||
499 | #ifndef KAB_EMBEDDED | 506 | #ifndef KAB_EMBEDDED_ |
500 | #include "distributionlistwidget.moc" | 507 | #include "moc_distributionlistwidget.cpp" |
501 | #endif //KAB_EMBEDDED | 508 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/features/distributionlistwidget.h b/kaddressbook/features/distributionlistwidget.h index 82bac3d..f619389 100644 --- a/kaddressbook/features/distributionlistwidget.h +++ b/kaddressbook/features/distributionlistwidget.h | |||
@@ -19,54 +19,59 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef DISTRIBUTIONLISTWIDGET_H | 24 | #ifndef DISTRIBUTIONLISTWIDGET_H |
25 | #define DISTRIBUTIONLISTWIDGET_H | 25 | #define DISTRIBUTIONLISTWIDGET_H |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | #include <klistview.h> | 28 | #include <klistview.h> |
29 | 29 | ||
30 | #include "extensionwidget.h" | 30 | #include "extensionwidget.h" |
31 | //Added by qt3to4: | ||
32 | #include <QDragEnterEvent> | ||
33 | #include <QDropEvent> | ||
34 | #include <QLabel> | ||
35 | #include <QDragMoveEvent> | ||
31 | 36 | ||
32 | class QButtonGroup; | 37 | class Q3ButtonGroup; |
33 | class QComboBox; | 38 | class QComboBox; |
34 | class QLabel; | 39 | class QLabel; |
35 | class QListView; | 40 | class Q3ListView; |
36 | 41 | ||
37 | class DistributionListView; | 42 | class DistributionListView; |
38 | class KABCore; | 43 | class KABCore; |
39 | 44 | ||
40 | namespace KABC { | 45 | namespace KABC { |
41 | class AddressBook; | 46 | class AddressBook; |
42 | class DistributionListManager; | 47 | class DistributionListManager; |
43 | } | 48 | } |
44 | 49 | ||
45 | class DistributionListWidget : public ExtensionWidget | 50 | class DistributionListWidget : public ExtensionWidget |
46 | { | 51 | { |
47 | Q_OBJECT | 52 | Q_OBJECT |
48 | 53 | ||
49 | public: | 54 | public: |
50 | DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 ); | 55 | DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 ); |
51 | virtual ~DistributionListWidget(); | 56 | virtual ~DistributionListWidget(); |
52 | 57 | ||
53 | void contactsSelectionChanged(); | 58 | void contactsSelectionChanged(); |
54 | 59 | ||
55 | QString title() const; | 60 | QString title() const; |
56 | QString identifier() const; | 61 | QString identifier() const; |
57 | 62 | ||
58 | public slots: | 63 | public slots: |
59 | void save(); | 64 | void save(); |
60 | void dropped( QDropEvent*, QListViewItem* ); | 65 | void dropped( QDropEvent*, Q3ListViewItem* ); |
61 | 66 | ||
62 | private slots: | 67 | private slots: |
63 | void createList(); | 68 | void createList(); |
64 | void editList(); | 69 | void editList(); |
65 | void removeList(); | 70 | void removeList(); |
66 | void addContact(); | 71 | void addContact(); |
67 | void removeContact(); | 72 | void removeContact(); |
68 | void changeEmail(); | 73 | void changeEmail(); |
69 | void updateNameCombo(); | 74 | void updateNameCombo(); |
70 | void updateContactView(); | 75 | void updateContactView(); |
71 | void selectionContactViewChanged(); | 76 | void selectionContactViewChanged(); |
72 | void changed(); | 77 | void changed(); |
@@ -111,25 +116,25 @@ class DistributionListView : public KListView | |||
111 | class EmailSelector : public KDialogBase | 116 | class EmailSelector : public KDialogBase |
112 | { | 117 | { |
113 | public: | 118 | public: |
114 | EmailSelector( const QStringList &emails, const QString ¤t, | 119 | EmailSelector( const QStringList &emails, const QString ¤t, |
115 | QWidget *parent ); | 120 | QWidget *parent ); |
116 | 121 | ||
117 | QString selected(); | 122 | QString selected(); |
118 | 123 | ||
119 | static QString getEmail( const QStringList &emails, const QString ¤t, | 124 | static QString getEmail( const QStringList &emails, const QString ¤t, |
120 | QWidget *parent ); | 125 | QWidget *parent ); |
121 | 126 | ||
122 | private: | 127 | private: |
123 | QButtonGroup *mButtonGroup; | 128 | Q3ButtonGroup *mButtonGroup; |
124 | }; | 129 | }; |
125 | 130 | ||
126 | 131 | ||
127 | #ifdef KAB_EMBEDDED | 132 | #ifdef KAB_EMBEDDED |
128 | class DistributionListFactory : public ExtensionFactory | 133 | class DistributionListFactory : public ExtensionFactory |
129 | { | 134 | { |
130 | public: | 135 | public: |
131 | ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) | 136 | ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) |
132 | { | 137 | { |
133 | return new DistributionListWidget( core, parent, name ); | 138 | return new DistributionListWidget( core, parent, name ); |
134 | } | 139 | } |
135 | 140 | ||
diff --git a/kaddressbook/features/mergewidget.cpp b/kaddressbook/features/mergewidget.cpp index 2476e42..1becc2f 100644 --- a/kaddressbook/features/mergewidget.cpp +++ b/kaddressbook/features/mergewidget.cpp | |||
@@ -14,24 +14,26 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3GridLayout> | ||
26 | 28 | ||
27 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
28 | #include <kaccelmanager.h> | 30 | #include <kaccelmanager.h> |
29 | #endif //KAB_EMBEDDED | 31 | #endif //KAB_EMBEDDED |
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <klistview.h> | 34 | #include <klistview.h> |
33 | #include <klocale.h> | 35 | #include <klocale.h> |
34 | #include <kglobal.h> | 36 | #include <kglobal.h> |
35 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
36 | 38 | ||
37 | #include <kabc/addressbook.h> | 39 | #include <kabc/addressbook.h> |
@@ -54,29 +56,29 @@ class MergeFactory : public ExtensionFactory | |||
54 | return "merge"; | 56 | return "merge"; |
55 | } | 57 | } |
56 | }; | 58 | }; |
57 | 59 | ||
58 | extern "C" { | 60 | extern "C" { |
59 | void *init_libkaddrbk_merge() | 61 | void *init_libkaddrbk_merge() |
60 | { | 62 | { |
61 | return ( new MergeFactory ); | 63 | return ( new MergeFactory ); |
62 | } | 64 | } |
63 | } | 65 | } |
64 | #endif //KAB_EMBEDDED | 66 | #endif //KAB_EMBEDDED |
65 | 67 | ||
66 | class ContactItem : public QListViewItem | 68 | class ContactItem : public Q3ListViewItem |
67 | { | 69 | { |
68 | public: | 70 | public: |
69 | ContactItem( KListView *parent, const KABC::Addressee &addressee ) | 71 | ContactItem( KListView *parent, const KABC::Addressee &addressee ) |
70 | : QListViewItem( parent ), mAddressee( addressee ) | 72 | : Q3ListViewItem( parent ), mAddressee( addressee ) |
71 | { | 73 | { |
72 | KABC::Field::List fieldList = KABC::Field::defaultFields(); | 74 | KABC::Field::List fieldList = KABC::Field::defaultFields(); |
73 | KABC::Field::List::ConstIterator it; | 75 | KABC::Field::List::ConstIterator it; |
74 | 76 | ||
75 | int i = 0; | 77 | int i = 0; |
76 | for ( it = fieldList.begin(); it != fieldList.end(); ++it ) | 78 | for ( it = fieldList.begin(); it != fieldList.end(); ++it ) |
77 | setText( i++, (*it)->value( mAddressee ) ); | 79 | setText( i++, (*it)->value( mAddressee ) ); |
78 | } | 80 | } |
79 | 81 | ||
80 | KABC::Addressee addressee() const | 82 | KABC::Addressee addressee() const |
81 | { | 83 | { |
82 | return mAddressee; | 84 | return mAddressee; |
@@ -85,25 +87,25 @@ class ContactItem : public QListViewItem | |||
85 | private: | 87 | private: |
86 | KABC::Addressee mAddressee; | 88 | KABC::Addressee mAddressee; |
87 | }; | 89 | }; |
88 | 90 | ||
89 | MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name ) | 91 | MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name ) |
90 | : ExtensionWidget( core, parent, name ), mBlockUpdate( false ) | 92 | : ExtensionWidget( core, parent, name ), mBlockUpdate( false ) |
91 | { | 93 | { |
92 | #ifdef KAB_EMBEDDED | 94 | #ifdef KAB_EMBEDDED |
93 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 95 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
94 | parent->setMaximumSize( KGlobal::getDesktopWidth() , 180); | 96 | parent->setMaximumSize( KGlobal::getDesktopWidth() , 180); |
95 | #endif //KAB_EMBEDDED | 97 | #endif //KAB_EMBEDDED |
96 | 98 | ||
97 | QGridLayout *topLayout = new QGridLayout( this, 3, 2, KDialog::marginHint(), | 99 | Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 2, KDialog::marginHint(), |
98 | KDialog::spacingHint() ); | 100 | KDialog::spacingHint() ); |
99 | 101 | ||
100 | mContactView = new KListView( this ); | 102 | mContactView = new KListView( this ); |
101 | KABC::Field::List fieldList = KABC::Field::defaultFields(); | 103 | KABC::Field::List fieldList = KABC::Field::defaultFields(); |
102 | KABC::Field::List::ConstIterator it; | 104 | KABC::Field::List::ConstIterator it; |
103 | 105 | ||
104 | for ( it = fieldList.begin(); it != fieldList.end(); ++it ) | 106 | for ( it = fieldList.begin(); it != fieldList.end(); ++it ) |
105 | mContactView->addColumn( (*it)->label() ); | 107 | mContactView->addColumn( (*it)->label() ); |
106 | 108 | ||
107 | mContactView->setEnabled( false ); | 109 | mContactView->setEnabled( false ); |
108 | mContactView->setAllColumnsShowFocus( true ); | 110 | mContactView->setAllColumnsShowFocus( true ); |
109 | topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 ); | 111 | topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 ); |
@@ -205,25 +207,25 @@ void MergeWidget::mergeAndRemove() | |||
205 | if ( !item ) | 207 | if ( !item ) |
206 | return; | 208 | return; |
207 | 209 | ||
208 | QString oldUID = item->addressee().uid(); | 210 | QString oldUID = item->addressee().uid(); |
209 | 211 | ||
210 | doMerge( item->addressee() ); | 212 | doMerge( item->addressee() ); |
211 | 213 | ||
212 | KABC::Addressee::List retval; | 214 | KABC::Addressee::List retval; |
213 | retval << mMasterAddressee; | 215 | retval << mMasterAddressee; |
214 | emit modified( retval ); | 216 | emit modified( retval ); |
215 | 217 | ||
216 | mBlockUpdate = true; | 218 | mBlockUpdate = true; |
217 | core()->deleteContacts( oldUID ); | 219 | core()->deleteContacts( QStringList(oldUID) ); |
218 | core()->setContactSelected( mMasterAddressee.uid() ); | 220 | core()->setContactSelected( mMasterAddressee.uid() ); |
219 | mBlockUpdate = false; | 221 | mBlockUpdate = false; |
220 | 222 | ||
221 | updateView(); | 223 | updateView(); |
222 | } | 224 | } |
223 | 225 | ||
224 | void MergeWidget::merge() | 226 | void MergeWidget::merge() |
225 | { | 227 | { |
226 | #ifndef KAB_EMBEDDED | 228 | #ifndef KAB_EMBEDDED |
227 | ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() ); | 229 | ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() ); |
228 | #else //KAB_EMBEDDED | 230 | #else //KAB_EMBEDDED |
229 | ContactItem *item = (ContactItem*)( mContactView->currentItem() ); | 231 | ContactItem *item = (ContactItem*)( mContactView->currentItem() ); |
@@ -360,15 +362,15 @@ void MergeWidget::doMerge( const KABC::Addressee &addr ) | |||
360 | mMasterAddressee.setUrl( addr.url() ); | 362 | mMasterAddressee.setUrl( addr.url() ); |
361 | 363 | ||
362 | // X- | 364 | // X- |
363 | QStringList customs = addr.customs(); | 365 | QStringList customs = addr.customs(); |
364 | QStringList masterCustoms = mMasterAddressee.customs(); | 366 | QStringList masterCustoms = mMasterAddressee.customs(); |
365 | QStringList newCustoms( masterCustoms ); | 367 | QStringList newCustoms( masterCustoms ); |
366 | for ( it = customs.begin(); it != customs.end(); ++it ) | 368 | for ( it = customs.begin(); it != customs.end(); ++it ) |
367 | if ( !masterCustoms.contains( *it ) ) | 369 | if ( !masterCustoms.contains( *it ) ) |
368 | newCustoms.append( *it ); | 370 | newCustoms.append( *it ); |
369 | mMasterAddressee.setCustoms( newCustoms ); | 371 | mMasterAddressee.setCustoms( newCustoms ); |
370 | } | 372 | } |
371 | 373 | ||
372 | #ifndef KAB_EMBEDDED | 374 | #ifndef KAB_EMBEDDED_ |
373 | #include "mergewidget.moc" | 375 | #include "moc_mergewidget.cpp" |
374 | #endif //KAB_EMBEDDED | 376 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/features/mergewidget.h b/kaddressbook/features/mergewidget.h index 1063c80..bb16282 100644 --- a/kaddressbook/features/mergewidget.h +++ b/kaddressbook/features/mergewidget.h | |||
@@ -20,25 +20,25 @@ | |||
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef MERGEWIDGET_H | 24 | #ifndef MERGEWIDGET_H |
25 | #define MERGEWIDGET_H | 25 | #define MERGEWIDGET_H |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | #include <klistview.h> | 28 | #include <klistview.h> |
29 | 29 | ||
30 | #include "extensionwidget.h" | 30 | #include "extensionwidget.h" |
31 | 31 | ||
32 | class QListView; | 32 | class Q3ListView; |
33 | 33 | ||
34 | class KABCore; | 34 | class KABCore; |
35 | 35 | ||
36 | namespace KABC { | 36 | namespace KABC { |
37 | class AddressBook; | 37 | class AddressBook; |
38 | } | 38 | } |
39 | 39 | ||
40 | class MergeWidget : public ExtensionWidget | 40 | class MergeWidget : public ExtensionWidget |
41 | { | 41 | { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | 43 | ||
44 | public: | 44 | public: |
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp index 12ab1e3..6462310 100644 --- a/kaddressbook/filter.cpp +++ b/kaddressbook/filter.cpp | |||
@@ -209,25 +209,25 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup ) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | list.append( f ); | 211 | list.append( f ); |
212 | } | 212 | } |
213 | 213 | ||
214 | if ( list.isEmpty()) { | 214 | if ( list.isEmpty()) { |
215 | QStringList cats = KABPrefs::instance()->mCustomCategories; | 215 | QStringList cats = KABPrefs::instance()->mCustomCategories; |
216 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { | 216 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { |
217 | Filter filter; | 217 | Filter filter; |
218 | filter.noName = false; | 218 | filter.noName = false; |
219 | filter.mName = *it; | 219 | filter.mName = *it; |
220 | filter.mEnabled = true; | 220 | filter.mEnabled = true; |
221 | filter.mCategoryList = *it; | 221 | filter.mCategoryList = QStringList(*it); |
222 | filter.mMatchRule = Matching; | 222 | filter.mMatchRule = Matching; |
223 | filter.mInternal = true; | 223 | filter.mInternal = true; |
224 | list.append( filter ); | 224 | list.append( filter ); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | return list; | 227 | return list; |
228 | } | 228 | } |
229 | 229 | ||
230 | void Filter::setMatchRule( MatchRule rule ) | 230 | void Filter::setMatchRule( MatchRule rule ) |
231 | { | 231 | { |
232 | mMatchRule = rule; | 232 | mMatchRule = rule; |
233 | } | 233 | } |
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h index f4ae123..508436d 100644 --- a/kaddressbook/filter.h +++ b/kaddressbook/filter.h | |||
@@ -17,41 +17,41 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef FILTER_H | 24 | #ifndef FILTER_H |
25 | #define FILTER_H | 25 | #define FILTER_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qvaluelist.h> | 29 | #include <q3valuelist.h> |
30 | 30 | ||
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | 33 | ||
34 | /** | 34 | /** |
35 | Filter for AddressBook related objects (Addressees) | 35 | Filter for AddressBook related objects (Addressees) |
36 | 36 | ||
37 | @todo This class should be switched to use shared data. | 37 | @todo This class should be switched to use shared data. |
38 | */ | 38 | */ |
39 | class Filter | 39 | class Filter |
40 | { | 40 | { |
41 | public: | 41 | public: |
42 | enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4 }; | 42 | enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4 }; |
43 | void setCriteria(int c) { mCriteria = c ;} | 43 | void setCriteria(int c) { mCriteria = c ;} |
44 | int criteria() const { return mCriteria;} | 44 | int criteria() const { return mCriteria;} |
45 | typedef QValueList<Filter> List; | 45 | typedef Q3ValueList<Filter> List; |
46 | 46 | ||
47 | enum MatchRule { Matching = 0, NotMatching = 1 }; | 47 | enum MatchRule { Matching = 0, NotMatching = 1 }; |
48 | 48 | ||
49 | Filter(); | 49 | Filter(); |
50 | Filter( const QString& name ); | 50 | Filter( const QString& name ); |
51 | ~Filter(); | 51 | ~Filter(); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | Set the name of the filter. | 54 | Set the name of the filter. |
55 | */ | 55 | */ |
56 | void setName( const QString &name ); | 56 | void setName( const QString &name ); |
57 | 57 | ||
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp index ef9b979..40698a7 100644 --- a/kaddressbook/filtereditdialog.cpp +++ b/kaddressbook/filtereditdialog.cpp | |||
@@ -19,104 +19,106 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qbuttongroup.h> | 31 | #include <q3buttongroup.h> |
32 | #include <qhbox.h> | 32 | #include <q3hbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qradiobutton.h> | 36 | #include <qradiobutton.h> |
37 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qstring.h> | 39 | #include <qstring.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qtooltip.h> | 41 | #include <qtooltip.h> |
42 | #include <qwidget.h> | 42 | #include <qwidget.h> |
43 | //Added by qt3to4: | ||
44 | #include <Q3GridLayout> | ||
43 | 45 | ||
44 | #include <kapplication.h> | 46 | #include <kapplication.h> |
45 | #include <kbuttonbox.h> | 47 | #include <kbuttonbox.h> |
46 | #include <kdebug.h> | 48 | #include <kdebug.h> |
47 | #include <kiconloader.h> | 49 | #include <kiconloader.h> |
48 | #include <klineedit.h> | 50 | #include <klineedit.h> |
49 | #include <klistbox.h> | 51 | #include <klistbox.h> |
50 | #include <klistview.h> | 52 | #include <klistview.h> |
51 | #include <klocale.h> | 53 | #include <klocale.h> |
52 | #include <kglobal.h> | 54 | #include <kglobal.h> |
53 | 55 | ||
54 | #include "kabprefs.h" | 56 | #include "kabprefs.h" |
55 | #include "filtereditdialog.h" | 57 | #include "filtereditdialog.h" |
56 | 58 | ||
57 | FilterEditDialog::FilterEditDialog( QWidget *parent, const char *name ) | 59 | FilterEditDialog::FilterEditDialog( QWidget *parent, const char *name ) |
58 | : KDialogBase( Plain, i18n( "Edit Address Book Filter" ), | 60 | : KDialogBase( Plain, i18n( "Edit Address Book Filter" ), |
59 | Help | Ok | Cancel, Ok, parent, name, /*US false*/ true, true ) | 61 | Help | Ok | Cancel, Ok, parent, name, /*US false*/ true, true ) |
60 | { | 62 | { |
61 | initGUI(); | 63 | initGUI(); |
62 | 64 | ||
63 | QStringList cats = KABPrefs::instance()->mCustomCategories; | 65 | QStringList cats = KABPrefs::instance()->mCustomCategories; |
64 | 66 | ||
65 | QStringList::Iterator iter; | 67 | QStringList::Iterator iter; |
66 | for ( iter = cats.begin(); iter != cats.end(); ++iter ) | 68 | for ( iter = cats.begin(); iter != cats.end(); ++iter ) |
67 | mCategoriesView->insertItem( new QCheckListItem( mCategoriesView, (*iter), QCheckListItem::CheckBox ) ); | 69 | mCategoriesView->insertItem( new Q3CheckListItem( mCategoriesView, (*iter), Q3CheckListItem::CheckBox ) ); |
68 | filterNameTextChanged( mNameEdit->text() ); | 70 | filterNameTextChanged( mNameEdit->text() ); |
69 | } | 71 | } |
70 | 72 | ||
71 | FilterEditDialog::~FilterEditDialog() | 73 | FilterEditDialog::~FilterEditDialog() |
72 | { | 74 | { |
73 | } | 75 | } |
74 | 76 | ||
75 | void FilterEditDialog::setFilter( const Filter &filter ) | 77 | void FilterEditDialog::setFilter( const Filter &filter ) |
76 | { | 78 | { |
77 | mNameEdit->setText( filter.name() ); | 79 | mNameEdit->setText( filter.name() ); |
78 | 80 | ||
79 | QStringList categories = filter.categories(); | 81 | QStringList categories = filter.categories(); |
80 | QListViewItem *item = mCategoriesView->firstChild(); | 82 | Q3ListViewItem *item = mCategoriesView->firstChild(); |
81 | while ( item != 0 ) { | 83 | while ( item != 0 ) { |
82 | if ( categories.contains( item->text( 0 ) ) ) { | 84 | if ( categories.contains( item->text( 0 ) ) ) { |
83 | QCheckListItem *checkItem = static_cast<QCheckListItem*>( item ); | 85 | Q3CheckListItem *checkItem = static_cast<Q3CheckListItem*>( item ); |
84 | checkItem->setOn( true ); | 86 | checkItem->setOn( true ); |
85 | } | 87 | } |
86 | 88 | ||
87 | item = item->nextSibling(); | 89 | item = item->nextSibling(); |
88 | } | 90 | } |
89 | 91 | ||
90 | if ( filter.matchRule() == Filter::Matching ) | 92 | if ( filter.matchRule() == Filter::Matching ) |
91 | mMatchRuleGroup->setButton( 0 ); | 93 | mMatchRuleGroup->setButton( 0 ); |
92 | else | 94 | else |
93 | mMatchRuleGroup->setButton( 1 ); | 95 | mMatchRuleGroup->setButton( 1 ); |
94 | 96 | ||
95 | int c = filter.criteria() ; | 97 | int c = filter.criteria() ; |
96 | mPublic->setChecked(c &Filter::ShowPublic); | 98 | mPublic->setChecked(c &Filter::ShowPublic); |
97 | mPrivate->setChecked(c & Filter::ShowPrivate); | 99 | mPrivate->setChecked(c & Filter::ShowPrivate); |
98 | mConfidential->setChecked(c & Filter::ShowConfidential); | 100 | mConfidential->setChecked(c & Filter::ShowConfidential); |
99 | } | 101 | } |
100 | 102 | ||
101 | Filter FilterEditDialog::filter() | 103 | Filter FilterEditDialog::filter() |
102 | { | 104 | { |
103 | Filter filter; | 105 | Filter filter; |
104 | 106 | ||
105 | filter.setName( mNameEdit->text() ); | 107 | filter.setName( mNameEdit->text() ); |
106 | 108 | ||
107 | QStringList categories; | 109 | QStringList categories; |
108 | QListViewItem *item = mCategoriesView->firstChild(); | 110 | Q3ListViewItem *item = mCategoriesView->firstChild(); |
109 | while ( item != 0 ) { | 111 | while ( item != 0 ) { |
110 | QCheckListItem *checkItem = static_cast<QCheckListItem*>( item ); | 112 | Q3CheckListItem *checkItem = static_cast<Q3CheckListItem*>( item ); |
111 | if ( checkItem->isOn() ) | 113 | if ( checkItem->isOn() ) |
112 | categories.append( item->text( 0 ) ); | 114 | categories.append( item->text( 0 ) ); |
113 | 115 | ||
114 | item = item->nextSibling(); | 116 | item = item->nextSibling(); |
115 | } | 117 | } |
116 | filter.setCategories( categories ); | 118 | filter.setCategories( categories ); |
117 | 119 | ||
118 | if ( mMatchRuleGroup->find( 0 )->isOn() ) | 120 | if ( mMatchRuleGroup->find( 0 )->isOn() ) |
119 | filter.setMatchRule( Filter::Matching ); | 121 | filter.setMatchRule( Filter::Matching ); |
120 | else | 122 | else |
121 | filter.setMatchRule( Filter::NotMatching ); | 123 | filter.setMatchRule( Filter::NotMatching ); |
122 | 124 | ||
@@ -132,48 +134,48 @@ Filter FilterEditDialog::filter() | |||
132 | void FilterEditDialog::initGUI() | 134 | void FilterEditDialog::initGUI() |
133 | { | 135 | { |
134 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
135 | resize( 490, 300 ); | 137 | resize( 490, 300 ); |
136 | #else //KAB_EMBEDDED | 138 | #else //KAB_EMBEDDED |
137 | resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300)); | 139 | resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300)); |
138 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
139 | 141 | ||
140 | 142 | ||
141 | QWidget *page = plainPage(); | 143 | QWidget *page = plainPage(); |
142 | QLabel *label; | 144 | QLabel *label; |
143 | 145 | ||
144 | QGridLayout *topLayout = new QGridLayout( page, 3, 2, 0, spacingHint() ); | 146 | Q3GridLayout *topLayout = new Q3GridLayout( page, 3, 2, 0, spacingHint() ); |
145 | 147 | ||
146 | label = new QLabel( i18n( "Name" ), page ); | 148 | label = new QLabel( i18n( "Name" ), page ); |
147 | mNameEdit = new KLineEdit( page ); | 149 | mNameEdit = new KLineEdit( page ); |
148 | mNameEdit->setFocus(); | 150 | mNameEdit->setFocus(); |
149 | topLayout->addWidget( label, 0, 0 ); | 151 | topLayout->addWidget( label, 0, 0 ); |
150 | topLayout->addWidget( mNameEdit, 0, 1 ); | 152 | topLayout->addWidget( mNameEdit, 0, 1 ); |
151 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), | 153 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), |
152 | SLOT( filterNameTextChanged( const QString&) ) ); | 154 | SLOT( filterNameTextChanged( const QString&) ) ); |
153 | 155 | ||
154 | mCategoriesView = new KListView( page ); | 156 | mCategoriesView = new KListView( page ); |
155 | mCategoriesView->addColumn( i18n( "Categories" ) ); | 157 | mCategoriesView->addColumn( i18n( "Categories" ) ); |
156 | topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); | 158 | topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); |
157 | 159 | ||
158 | mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page ); | 160 | mMatchRuleGroup = new Q3HButtonGroup( i18n( "Category rule" ), page ); |
159 | mMatchRuleGroup->setExclusive( true ); | 161 | mMatchRuleGroup->setExclusive( true ); |
160 | QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup ); | 162 | QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup ); |
161 | //mMatchRuleGroup->insert( radio ); | 163 | //mMatchRuleGroup->insert( radio ); |
162 | radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup ); | 164 | radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup ); |
163 | radio->setChecked( true ); | 165 | radio->setChecked( true ); |
164 | //mMatchRuleGroup->insert( radio ); | 166 | //mMatchRuleGroup->insert( radio ); |
165 | topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 ); | 167 | topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 ); |
166 | 168 | ||
167 | QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page ); | 169 | Q3HButtonGroup * mMatchPPCGroup = new Q3HButtonGroup(i18n( "Include contacts, that are:" ), page ); |
168 | mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup ); | 170 | mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup ); |
169 | mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup ); | 171 | mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup ); |
170 | mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup ); | 172 | mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup ); |
171 | mPublic->setChecked( true ); | 173 | mPublic->setChecked( true ); |
172 | mPrivate->setChecked( true ); | 174 | mPrivate->setChecked( true ); |
173 | mConfidential->setChecked( true ); | 175 | mConfidential->setChecked( true ); |
174 | topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 ); | 176 | topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 ); |
175 | 177 | ||
176 | } | 178 | } |
177 | 179 | ||
178 | void FilterEditDialog::filterNameTextChanged( const QString &text ) | 180 | void FilterEditDialog::filterNameTextChanged( const QString &text ) |
179 | { | 181 | { |
@@ -263,53 +265,53 @@ void FilterDialog::remove() | |||
263 | refresh(); | 265 | refresh(); |
264 | } | 266 | } |
265 | 267 | ||
266 | void FilterDialog::refresh() | 268 | void FilterDialog::refresh() |
267 | { | 269 | { |
268 | mFilterListBox->clear(); | 270 | mFilterListBox->clear(); |
269 | 271 | ||
270 | Filter::List::Iterator iter; | 272 | Filter::List::Iterator iter; |
271 | for ( iter = mFilterList.begin(); iter != mFilterList.end(); ++iter ) | 273 | for ( iter = mFilterList.begin(); iter != mFilterList.end(); ++iter ) |
272 | mFilterListBox->insertItem( (*iter).name() ); | 274 | mFilterListBox->insertItem( (*iter).name() ); |
273 | } | 275 | } |
274 | 276 | ||
275 | void FilterDialog::selectionChanged( QListBoxItem *item ) | 277 | void FilterDialog::selectionChanged( Q3ListBoxItem *item ) |
276 | { | 278 | { |
277 | bool state = ( item != 0 ); | 279 | bool state = ( item != 0 ); |
278 | 280 | ||
279 | mEditButton->setEnabled( state ); | 281 | mEditButton->setEnabled( state ); |
280 | mRemoveButton->setEnabled( state ); | 282 | mRemoveButton->setEnabled( state ); |
281 | } | 283 | } |
282 | 284 | ||
283 | void FilterDialog::initGUI() | 285 | void FilterDialog::initGUI() |
284 | { | 286 | { |
285 | #ifndef KAB_EMBEDDED | 287 | #ifndef KAB_EMBEDDED |
286 | resize( 330, 200 ); | 288 | resize( 330, 200 ); |
287 | #else //KAB_EMBEDDED | 289 | #else //KAB_EMBEDDED |
288 | resize( KMIN(KGlobal::getDesktopWidth()-10, 330), KMIN(KGlobal::getDesktopHeight()-50, 200)); | 290 | resize( KMIN(KGlobal::getDesktopWidth()-10, 330), KMIN(KGlobal::getDesktopHeight()-50, 200)); |
289 | #endif //KAB_EMBEDDED | 291 | #endif //KAB_EMBEDDED |
290 | 292 | ||
291 | QWidget *page = plainPage(); | 293 | QWidget *page = plainPage(); |
292 | 294 | ||
293 | QGridLayout *topLayout = new QGridLayout( page, 1, 2, 0, spacingHint() ); | 295 | Q3GridLayout *topLayout = new Q3GridLayout( page, 1, 2, 0, spacingHint() ); |
294 | 296 | ||
295 | mFilterListBox = new KListBox( page ); | 297 | mFilterListBox = new KListBox( page ); |
296 | topLayout->addWidget( mFilterListBox, 0, 0 ); | 298 | topLayout->addWidget( mFilterListBox, 0, 0 ); |
297 | connect( mFilterListBox, SIGNAL( selectionChanged( QListBoxItem * ) ), | 299 | connect( mFilterListBox, SIGNAL( selectionChanged( Q3ListBoxItem * ) ), |
298 | SLOT( selectionChanged( QListBoxItem * ) ) ); | 300 | SLOT( selectionChanged( Q3ListBoxItem * ) ) ); |
299 | connect( mFilterListBox, SIGNAL( doubleClicked ( QListBoxItem * ) ), | 301 | connect( mFilterListBox, SIGNAL( doubleClicked ( Q3ListBoxItem * ) ), |
300 | SLOT( edit() ) ); | 302 | SLOT( edit() ) ); |
301 | 303 | ||
302 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); | 304 | KButtonBox *buttonBox = new KButtonBox( page, Qt::Vertical ); |
303 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( add() ) ); | 305 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( add() ) ); |
304 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( edit() ) ); | 306 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( edit() ) ); |
305 | mEditButton->setEnabled( false ); | 307 | mEditButton->setEnabled( false ); |
306 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( remove() ) ); | 308 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( remove() ) ); |
307 | mRemoveButton->setEnabled( false ); | 309 | mRemoveButton->setEnabled( false ); |
308 | 310 | ||
309 | buttonBox->layout(); | 311 | buttonBox->layout(); |
310 | topLayout->addWidget( buttonBox, 0, 1 ); | 312 | topLayout->addWidget( buttonBox, 0, 1 ); |
311 | } | 313 | } |
312 | 314 | ||
313 | #ifndef KAB_EMBEDDED | 315 | #ifndef KAB_EMBEDDED_ |
314 | #include "filtereditdialog.moc" | 316 | #include "moc_filtereditdialog.cpp" |
315 | #endif //KAB_EMBEDDED | 317 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/filtereditdialog.h b/kaddressbook/filtereditdialog.h index 5a8bad1..64d2976 100644 --- a/kaddressbook/filtereditdialog.h +++ b/kaddressbook/filtereditdialog.h | |||
@@ -22,56 +22,55 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef FILTEREDITDIALOG_H | 31 | #ifndef FILTEREDITDIALOG_H |
32 | #define FILTEREDITDIALOG_H | 32 | #define FILTEREDITDIALOG_H |
33 | 33 | ||
34 | class QButtonGroup; | 34 | #include <Q3HButtonGroup> |
35 | class QString; | 35 | class QString; |
36 | class QToolButton; | 36 | class QToolButton; |
37 | class QWidget; | 37 | class QWidget; |
38 | class QListBoxItem; | 38 | class Q3ListBoxItem; |
39 | class QCheckBox; | 39 | class QCheckBox; |
40 | 40 | ||
41 | class KLineEdit; | 41 | class KLineEdit; |
42 | class KListBox; | 42 | class KListBox; |
43 | class KListView; | 43 | class KListView; |
44 | 44 | ||
45 | #include <kdialogbase.h> | 45 | #include <kdialogbase.h> |
46 | #include <qhbuttongroup.h> | ||
47 | 46 | ||
48 | #include "filter.h" | 47 | #include "filter.h" |
49 | 48 | ||
50 | class FilterDialog : public KDialogBase | 49 | class FilterDialog : public KDialogBase |
51 | { | 50 | { |
52 | Q_OBJECT | 51 | Q_OBJECT |
53 | 52 | ||
54 | public: | 53 | public: |
55 | FilterDialog( QWidget *parent, const char *name = 0 ); | 54 | FilterDialog( QWidget *parent, const char *name = 0 ); |
56 | ~FilterDialog(); | 55 | ~FilterDialog(); |
57 | 56 | ||
58 | void setFilters( const Filter::List &list ); | 57 | void setFilters( const Filter::List &list ); |
59 | Filter::List filters() const; | 58 | Filter::List filters() const; |
60 | 59 | ||
61 | protected slots: | 60 | protected slots: |
62 | void add(); | 61 | void add(); |
63 | void edit(); | 62 | void edit(); |
64 | void remove(); | 63 | void remove(); |
65 | void selectionChanged( QListBoxItem* ); | 64 | void selectionChanged( Q3ListBoxItem* ); |
66 | 65 | ||
67 | private: | 66 | private: |
68 | void initGUI(); | 67 | void initGUI(); |
69 | void refresh(); | 68 | void refresh(); |
70 | 69 | ||
71 | Filter::List mFilterList; | 70 | Filter::List mFilterList; |
72 | Filter::List mInternalFilterList; | 71 | Filter::List mInternalFilterList; |
73 | 72 | ||
74 | KListBox *mFilterListBox; | 73 | KListBox *mFilterListBox; |
75 | QPushButton *mAddButton; | 74 | QPushButton *mAddButton; |
76 | QPushButton *mEditButton; | 75 | QPushButton *mEditButton; |
77 | QPushButton *mRemoveButton; | 76 | QPushButton *mRemoveButton; |
@@ -89,21 +88,21 @@ class FilterEditDialog : public KDialogBase | |||
89 | 88 | ||
90 | protected slots: | 89 | protected slots: |
91 | void filterNameTextChanged( const QString& ); | 90 | void filterNameTextChanged( const QString& ); |
92 | void slotHelp(); | 91 | void slotHelp(); |
93 | 92 | ||
94 | private: | 93 | private: |
95 | void initGUI(); | 94 | void initGUI(); |
96 | 95 | ||
97 | Filter mFilter; | 96 | Filter mFilter; |
98 | 97 | ||
99 | KLineEdit *mNameEdit; | 98 | KLineEdit *mNameEdit; |
100 | KListView *mCategoriesView; | 99 | KListView *mCategoriesView; |
101 | QHButtonGroup *mMatchRuleGroup; | 100 | Q3HButtonGroup *mMatchRuleGroup; |
102 | QCheckBox *mPrivate; | 101 | QCheckBox *mPrivate; |
103 | QCheckBox *mPublic; | 102 | QCheckBox *mPublic; |
104 | QCheckBox *mConfidential; | 103 | QCheckBox *mConfidential; |
105 | QPushButton *mEditButton; | 104 | QPushButton *mEditButton; |
106 | QPushButton *mRemoveButton; | 105 | QPushButton *mRemoveButton; |
107 | }; | 106 | }; |
108 | 107 | ||
109 | #endif | 108 | #endif |
diff --git a/kaddressbook/geowidget.cpp b/kaddressbook/geowidget.cpp index 13cd084..caff3b2 100644 --- a/kaddressbook/geowidget.cpp +++ b/kaddressbook/geowidget.cpp | |||
@@ -18,67 +18,74 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kabc/geo.h> | 24 | #include <kabc/geo.h> |
25 | 25 | ||
26 | #ifndef KAB_EMBEDDED | 26 | #ifndef KAB_EMBEDDED |
27 | #include <kaccelmanager.h> | 27 | #include <kaccelmanager.h> |
28 | #else //KAB_EMBEDDED | 28 | #else //KAB_EMBEDDED |
29 | 29 | ||
30 | #include <qtextstream.h> | 30 | #include <q3textstream.h> |
31 | //Added by qt3to4: | ||
32 | #include <QPaintEvent> | ||
33 | #include <Q3GridLayout> | ||
34 | #include <Q3Frame> | ||
35 | #include <QMouseEvent> | ||
31 | #include <kglobal.h> | 36 | #include <kglobal.h> |
32 | #endif //KAB_EMBEDDED | 37 | #endif //KAB_EMBEDDED |
33 | 38 | ||
39 | #include <QDesktopWidget> | ||
40 | |||
34 | #include <knuminput.h> | 41 | #include <knuminput.h> |
35 | #include <kcombobox.h> | 42 | #include <kcombobox.h> |
36 | #include <kdebug.h> | 43 | #include <kdebug.h> |
37 | #include <kiconloader.h> | 44 | #include <kiconloader.h> |
38 | #include <klocale.h> | 45 | #include <klocale.h> |
39 | #include <kstandarddirs.h> | 46 | #include <kstandarddirs.h> |
40 | 47 | ||
41 | #include <qcheckbox.h> | 48 | #include <qcheckbox.h> |
42 | #include <qfile.h> | 49 | #include <qfile.h> |
43 | #include <qapplication.h> | 50 | #include <qapplication.h> |
44 | #include <qgroupbox.h> | 51 | #include <q3groupbox.h> |
45 | #include <qlabel.h> | 52 | #include <qlabel.h> |
46 | #include <qlayout.h> | 53 | #include <qlayout.h> |
47 | #include <qlistbox.h> | 54 | #include <q3listbox.h> |
48 | #include <qpainter.h> | 55 | #include <qpainter.h> |
49 | #include <qpixmap.h> | 56 | #include <qpixmap.h> |
50 | #include <qpushbutton.h> | 57 | #include <qpushbutton.h> |
51 | #include <qregexp.h> | 58 | #include <qregexp.h> |
52 | #include <qstring.h> | 59 | #include <qstring.h> |
53 | #include <stdlib.h> | 60 | #include <stdlib.h> |
54 | 61 | ||
55 | #include "geowidget.h" | 62 | #include "geowidget.h" |
56 | 63 | ||
57 | GeoWidget::GeoWidget( QWidget *parent, const char *name ) | 64 | GeoWidget::GeoWidget( QWidget *parent, const char *name ) |
58 | : QWidget( parent, name ) | 65 | : QWidget( parent, name ) |
59 | { | 66 | { |
60 | QLabel *label = 0; | 67 | QLabel *label = 0; |
61 | 68 | ||
62 | QGridLayout *topLayout = new QGridLayout( this, 4, 3 ); | 69 | Q3GridLayout *topLayout = new Q3GridLayout( this, 4, 3 ); |
63 | topLayout->setMargin( KDialog::marginHint() ); | 70 | topLayout->setMargin( KDialog::marginHint() ); |
64 | topLayout->setSpacing( KDialog::spacingHint() ); | 71 | topLayout->setSpacing( KDialog::spacingHint() ); |
65 | 72 | ||
66 | label = new QLabel( this ); | 73 | label = new QLabel( this ); |
67 | //US ambiguous call to loadIcon. Add an additional parameter | 74 | //US ambiguous call to loadIcon. Add an additional parameter |
68 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop ) ); | 75 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop ) ); |
69 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop, 0 ) ); | 76 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop, 0 ) ); |
70 | label->setAlignment( Qt::AlignTop ); | 77 | label->setAlignment( Qt::AlignTop ); |
71 | topLayout->addMultiCellWidget( label, 0, 3, 0, 0 ); | 78 | topLayout->addMultiCellWidget( label, 0, 3, 0, 0 ); |
72 | label->setAlignment( AlignCenter ); | 79 | label->setAlignment( Qt::AlignCenter ); |
73 | mGeoIsValid = new QCheckBox( i18n( "Use geo data" ), this ); | 80 | mGeoIsValid = new QCheckBox( i18n( "Use geo data" ), this ); |
74 | topLayout->addMultiCellWidget( mGeoIsValid, 0, 0, 1, 2 ); | 81 | topLayout->addMultiCellWidget( mGeoIsValid, 0, 0, 1, 2 ); |
75 | 82 | ||
76 | label = new QLabel( i18n( "Latitude:" ), this ); | 83 | label = new QLabel( i18n( "Latitude:" ), this ); |
77 | topLayout->addWidget( label, 1, 1 ); | 84 | topLayout->addWidget( label, 1, 1 ); |
78 | 85 | ||
79 | mLatitudeBox = new KDoubleSpinBox( -90, 90, 1, 0, 6, this ); | 86 | mLatitudeBox = new KDoubleSpinBox( -90, 90, 1, 0, 6, this ); |
80 | mLatitudeBox->setEnabled( false ); | 87 | mLatitudeBox->setEnabled( false ); |
81 | mLatitudeBox->setSuffix( "" ); | 88 | mLatitudeBox->setSuffix( "" ); |
82 | topLayout->addWidget( mLatitudeBox, 1, 2 ); | 89 | topLayout->addWidget( mLatitudeBox, 1, 2 ); |
83 | label->setBuddy( mLatitudeBox ); | 90 | label->setBuddy( mLatitudeBox ); |
84 | 91 | ||
@@ -158,34 +165,34 @@ void GeoWidget::editGeoData() | |||
158 | 165 | ||
159 | emit changed(); | 166 | emit changed(); |
160 | } | 167 | } |
161 | } | 168 | } |
162 | 169 | ||
163 | 170 | ||
164 | 171 | ||
165 | GeoDialog::GeoDialog( QWidget *parent, const char *name ) | 172 | GeoDialog::GeoDialog( QWidget *parent, const char *name ) |
166 | : KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok, | 173 | : KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok, |
167 | parent, name, true, true ), | 174 | parent, name, true, true ), |
168 | mUpdateSexagesimalInput( true ) | 175 | mUpdateSexagesimalInput( true ) |
169 | { | 176 | { |
170 | QFrame *page = plainPage(); | 177 | Q3Frame *page = plainPage(); |
171 | 178 | ||
172 | QGridLayout *topLayout = new QGridLayout( page, 1, 1, marginHintSmall(), | 179 | Q3GridLayout *topLayout = new Q3GridLayout( page, 1, 1, marginHintSmall(), |
173 | spacingHint() ); | 180 | spacingHint() ); |
174 | //topLayout->setRowStretch( 1, 1 ); | 181 | //topLayout->setRowStretch( 1, 1 ); |
175 | 182 | ||
176 | mMapWidget = new GeoMapWidget( page ); | 183 | mMapWidget = new GeoMapWidget( page ); |
177 | mCityCombo = new KComboBox( page ); | 184 | mCityCombo = new KComboBox( page ); |
178 | QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page ); | 185 | Q3GroupBox *sexagesimalGroup = new Q3GroupBox( 0, Qt::Vertical, i18n( "Sexagesimal" ), page ); |
179 | QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(), | 186 | Q3GridLayout *sexagesimalLayout = new Q3GridLayout( sexagesimalGroup->layout(), |
180 | 2, 5, spacingHint() ); | 187 | 2, 5, spacingHint() ); |
181 | QLabel *label; | 188 | QLabel *label; |
182 | if ( QApplication::desktop()->width() < 320 ) { | 189 | if ( QApplication::desktop()->width() < 320 ) { |
183 | label = new QLabel( i18n( "La." ), sexagesimalGroup ); | 190 | label = new QLabel( i18n( "La." ), sexagesimalGroup ); |
184 | sexagesimalLayout->setSpacing ( spacingHintSmall() ); | 191 | sexagesimalLayout->setSpacing ( spacingHintSmall() ); |
185 | sexagesimalLayout->setMargin ( marginHintSmall() ); | 192 | sexagesimalLayout->setMargin ( marginHintSmall() ); |
186 | topLayout->setMargin ( 0 ); | 193 | topLayout->setMargin ( 0 ); |
187 | mCityCombo->setMaximumWidth( 220 ); | 194 | mCityCombo->setMaximumWidth( 220 ); |
188 | sexagesimalGroup->setMaximumWidth( 220 ); | 195 | sexagesimalGroup->setMaximumWidth( 220 ); |
189 | } | 196 | } |
190 | else | 197 | else |
191 | label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup ); | 198 | label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup ); |
@@ -420,26 +427,26 @@ void GeoDialog::loadCityList() | |||
420 | #ifndef _WIN32_ | 427 | #ifndef _WIN32_ |
421 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/zone.tab"; | 428 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/zone.tab"; |
422 | #else | 429 | #else |
423 | fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\zone.tab"; | 430 | fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\zone.tab"; |
424 | #endif | 431 | #endif |
425 | #else | 432 | #else |
426 | fileName = getenv("QPEDIR"); | 433 | fileName = getenv("QPEDIR"); |
427 | fileName += "/pics/kdepim/kaddressbook/zone.tab"; | 434 | fileName += "/pics/kdepim/kaddressbook/zone.tab"; |
428 | #endif | 435 | #endif |
429 | 436 | ||
430 | QFile file( fileName); | 437 | QFile file( fileName); |
431 | 438 | ||
432 | if ( file.open( IO_ReadOnly ) ) { | 439 | if ( file.open( QIODevice::ReadOnly ) ) { |
433 | QTextStream s( &file ); | 440 | Q3TextStream s( &file ); |
434 | 441 | ||
435 | QString line, country; | 442 | QString line, country; |
436 | QRegExp coord( "[+-]\\d+[+-]\\d+" ); | 443 | QRegExp coord( "[+-]\\d+[+-]\\d+" ); |
437 | QRegExp name( "[^\\s]+/[^\\s]+" ); | 444 | QRegExp name( "[^\\s]+/[^\\s]+" ); |
438 | int posc, posn, pos; | 445 | int posc, posn, pos; |
439 | 446 | ||
440 | while ( !s.eof() ) { | 447 | while ( !s.eof() ) { |
441 | line = s.readLine().stripWhiteSpace(); | 448 | line = s.readLine().stripWhiteSpace(); |
442 | if ( line.isEmpty() || line[ 0 ] == '#' ) | 449 | if ( line.isEmpty() || line[ 0 ] == '#' ) |
443 | continue; | 450 | continue; |
444 | 451 | ||
445 | country = line.left( 2 ); | 452 | country = line.left( 2 ); |
@@ -543,25 +550,25 @@ int GeoDialog::nearestCity( double x, double y ) | |||
543 | ( (*it).latitude - y ) * ( (*it).latitude - y ); | 550 | ( (*it).latitude - y ) * ( (*it).latitude - y ); |
544 | if ( dist < 1.5 ) | 551 | if ( dist < 1.5 ) |
545 | return pos; | 552 | return pos; |
546 | } | 553 | } |
547 | 554 | ||
548 | return -1; | 555 | return -1; |
549 | } | 556 | } |
550 | 557 | ||
551 | 558 | ||
552 | GeoMapWidget::GeoMapWidget( QWidget *parent, const char *name ) | 559 | GeoMapWidget::GeoMapWidget( QWidget *parent, const char *name ) |
553 | : QWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 ) | 560 | : QWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 ) |
554 | { | 561 | { |
555 | setBackgroundMode( NoBackground ); | 562 | setBackgroundMode( Qt::NoBackground ); |
556 | 563 | ||
557 | setFixedSize( 240, 120 ); | 564 | setFixedSize( 240, 120 ); |
558 | 565 | ||
559 | update(); | 566 | update(); |
560 | } | 567 | } |
561 | 568 | ||
562 | GeoMapWidget::~GeoMapWidget() | 569 | GeoMapWidget::~GeoMapWidget() |
563 | { | 570 | { |
564 | } | 571 | } |
565 | 572 | ||
566 | void GeoMapWidget::setLatitude( double latitude ) | 573 | void GeoMapWidget::setLatitude( double latitude ) |
567 | { | 574 | { |
@@ -615,15 +622,15 @@ void GeoMapWidget::paintEvent( QPaintEvent* ) | |||
615 | 622 | ||
616 | double latOffset = ( mLatitude * latMid ) / 90; | 623 | double latOffset = ( mLatitude * latMid ) / 90; |
617 | double longOffset = ( mLongitude * longMid ) / 180; | 624 | double longOffset = ( mLongitude * longMid ) / 180; |
618 | 625 | ||
619 | int x = (int)(longMid + longOffset); | 626 | int x = (int)(longMid + longOffset); |
620 | int y = (int)(latMid - latOffset); | 627 | int y = (int)(latMid - latOffset); |
621 | p.drawEllipse( x, y, 4, 4 ); | 628 | p.drawEllipse( x, y, 4, 4 ); |
622 | 629 | ||
623 | p.end(); | 630 | p.end(); |
624 | bitBlt( this, 0, 0, &world ); | 631 | bitBlt( this, 0, 0, &world ); |
625 | } | 632 | } |
626 | 633 | ||
627 | #ifndef KAB_EMBEDDED | 634 | #ifndef KAB_EMBEDDED_ |
628 | #include "geowidget.moc" | 635 | #include "moc_geowidget.cpp" |
629 | #endif //KAB_EMBEDDED | 636 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/geowidget.h b/kaddressbook/geowidget.h index 3d39691..5b64370 100644 --- a/kaddressbook/geowidget.h +++ b/kaddressbook/geowidget.h | |||
@@ -18,24 +18,28 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef GEOWIDGET_H | 24 | #ifndef GEOWIDGET_H |
25 | #define GEOWIDGET_H | 25 | #define GEOWIDGET_H |
26 | 26 | ||
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | //Added by qt3to4: | ||
31 | #include <QLabel> | ||
32 | #include <QMouseEvent> | ||
33 | #include <QPaintEvent> | ||
30 | #include <kdialogbase.h> | 34 | #include <kdialogbase.h> |
31 | 35 | ||
32 | namespace KABC { | 36 | namespace KABC { |
33 | class Geo; | 37 | class Geo; |
34 | } | 38 | } |
35 | 39 | ||
36 | class GeoMapWidget; | 40 | class GeoMapWidget; |
37 | 41 | ||
38 | class KComboBox; | 42 | class KComboBox; |
39 | class KDoubleSpinBox; | 43 | class KDoubleSpinBox; |
40 | 44 | ||
41 | class QCheckBox; | 45 | class QCheckBox; |
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp index eec5e08..6ecf66d 100644 --- a/kaddressbook/imagewidget.cpp +++ b/kaddressbook/imagewidget.cpp | |||
@@ -28,92 +28,96 @@ | |||
28 | #include <kio/netaccess.h> | 28 | #include <kio/netaccess.h> |
29 | #include <kimageio.h> | 29 | #include <kimageio.h> |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kdialog.h> | 33 | #include <kdialog.h> |
34 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kurlrequester.h> | 36 | #include <kurlrequester.h> |
37 | #include <kurl.h> | 37 | #include <kurl.h> |
38 | 38 | ||
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qgroupbox.h> | 40 | #include <q3groupbox.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <QDesktopWidget> | ||
47 | //Added by qt3to4: | ||
48 | #include <Q3GridLayout> | ||
49 | #include <Q3Frame> | ||
46 | 50 | ||
47 | #include "imagewidget.h" | 51 | #include "imagewidget.h" |
48 | 52 | ||
49 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) | 53 | ImageWidget::ImageWidget( QWidget *parent, const char *name ) |
50 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
51 | { | 55 | { |
52 | QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(), | 56 | Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 1, KDialog::marginHint(), |
53 | KDialog::spacingHint() ); | 57 | KDialog::spacingHint() ); |
54 | 58 | ||
55 | QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); | 59 | Q3GroupBox *photoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Photo" ), this ); |
56 | QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2, | 60 | Q3GridLayout *boxLayout = new Q3GridLayout( photoBox->layout(), 3, 2, |
57 | KDialog::spacingHint() ); | 61 | KDialog::spacingHint() ); |
58 | boxLayout->setRowStretch( 2, 1 ); | 62 | boxLayout->setRowStretch( 2, 1 ); |
59 | 63 | ||
60 | mPhotoLabel = new QLabel( photoBox ); | 64 | mPhotoLabel = new QLabel( photoBox ); |
61 | int fac = 9; | 65 | int fac = 9; |
62 | if ( QApplication::desktop()->width() > 320 ) | 66 | if ( QApplication::desktop()->width() > 320 ) |
63 | fac = 6; | 67 | fac = 6; |
64 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 68 | mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
65 | mPhotoLabel->setScaledContents( true ); | 69 | mPhotoLabel->setScaledContents( true ); |
66 | mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 70 | mPhotoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken ); |
67 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); | 71 | boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 ); |
68 | 72 | ||
69 | mPhotoUrl = new KURLRequester( photoBox ); | 73 | mPhotoUrl = new KURLRequester( photoBox ); |
70 | #ifndef KAB_EMBEDDED | 74 | #ifndef KAB_EMBEDDED |
71 | mPhotoUrl->setFilter( KImageIO::pattern() ); | 75 | mPhotoUrl->setFilter( KImageIO::pattern() ); |
72 | #else //KAB_EMBEDDED | 76 | #else //KAB_EMBEDDED |
73 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); | 77 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???"); |
74 | #endif //KAB_EMBEDDED | 78 | #endif //KAB_EMBEDDED |
75 | 79 | ||
76 | 80 | ||
77 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); | 81 | boxLayout->addWidget( mPhotoUrl, 0, 1 ); |
78 | QHBox *hb1 = new QHBox ( photoBox ); | 82 | Q3HBox *hb1 = new Q3HBox ( photoBox ); |
79 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); | 83 | mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 ); |
80 | mUsePhotoUrl->setEnabled( false ); | 84 | mUsePhotoUrl->setEnabled( false ); |
81 | boxLayout->addWidget( hb1, 1, 1 ); | 85 | boxLayout->addWidget( hb1, 1, 1 ); |
82 | 86 | ||
83 | QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); | 87 | QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 ); |
84 | connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); | 88 | connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) ); |
85 | boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); | 89 | boxLayout->addWidget( new QLabel( photoBox ), 2, 1 ); |
86 | 90 | ||
87 | topLayout->addWidget( photoBox, 0, 0 ); | 91 | topLayout->addWidget( photoBox, 0, 0 ); |
88 | 92 | ||
89 | QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); | 93 | Q3GroupBox *logoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Logo" ), this ); |
90 | boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); | 94 | boxLayout = new Q3GridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() ); |
91 | boxLayout->setRowStretch( 2, 1 ); | 95 | boxLayout->setRowStretch( 2, 1 ); |
92 | 96 | ||
93 | mLogoLabel = new QLabel( logoBox ); | 97 | mLogoLabel = new QLabel( logoBox ); |
94 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); | 98 | mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac ); |
95 | mLogoLabel->setScaledContents( true ); | 99 | mLogoLabel->setScaledContents( true ); |
96 | mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 100 | mLogoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken ); |
97 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); | 101 | boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 ); |
98 | 102 | ||
99 | mLogoUrl = new KURLRequester( logoBox ); | 103 | mLogoUrl = new KURLRequester( logoBox ); |
100 | #ifndef KAB_EMBEDDED | 104 | #ifndef KAB_EMBEDDED |
101 | mLogoUrl->setFilter( KImageIO::pattern() ); | 105 | mLogoUrl->setFilter( KImageIO::pattern() ); |
102 | #else //KAB_EMBEDDED | 106 | #else //KAB_EMBEDDED |
103 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); | 107 | //US qDebug("ImageWidget::ImageWidget KImageIO not defined 2"); |
104 | #endif //KAB_EMBEDDED | 108 | #endif //KAB_EMBEDDED |
105 | boxLayout->addWidget( mLogoUrl, 0, 1 ); | 109 | boxLayout->addWidget( mLogoUrl, 0, 1 ); |
106 | 110 | ||
107 | QHBox *hb2 = new QHBox ( logoBox ); | 111 | Q3HBox *hb2 = new Q3HBox ( logoBox ); |
108 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); | 112 | mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 ); |
109 | mUseLogoUrl->setEnabled( false ); | 113 | mUseLogoUrl->setEnabled( false ); |
110 | boxLayout->addWidget( hb2, 1, 1 ); | 114 | boxLayout->addWidget( hb2, 1, 1 ); |
111 | 115 | ||
112 | pb = new QPushButton( i18n( "Remove" ), hb2 ); | 116 | pb = new QPushButton( i18n( "Remove" ), hb2 ); |
113 | connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); | 117 | connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) ); |
114 | boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); | 118 | boxLayout->addWidget( new QLabel( logoBox ), 2, 1 ); |
115 | topLayout->addWidget( logoBox, 1, 0 ); | 119 | topLayout->addWidget( logoBox, 1, 0 ); |
116 | 120 | ||
117 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), | 121 | connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ), |
118 | SIGNAL( changed() ) ); | 122 | SIGNAL( changed() ) ); |
119 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), | 123 | connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ), |
@@ -171,25 +175,25 @@ void ImageWidget::setPhoto( const KABC::Picture &photo ) | |||
171 | } | 175 | } |
172 | 176 | ||
173 | blockSignals( blocked ); | 177 | blockSignals( blocked ); |
174 | } | 178 | } |
175 | 179 | ||
176 | KABC::Picture ImageWidget::photo() const | 180 | KABC::Picture ImageWidget::photo() const |
177 | { | 181 | { |
178 | KABC::Picture photo; | 182 | KABC::Picture photo; |
179 | 183 | ||
180 | if ( mUsePhotoUrl->isChecked() ) | 184 | if ( mUsePhotoUrl->isChecked() ) |
181 | photo.setUrl( mPhotoUrl->url() ); | 185 | photo.setUrl( mPhotoUrl->url() ); |
182 | else { | 186 | else { |
183 | QPixmap *px = mPhotoLabel->pixmap(); | 187 | const QPixmap *px = mPhotoLabel->pixmap(); |
184 | if ( px ) { | 188 | if ( px ) { |
185 | #ifndef KAB_EMBEDDED | 189 | #ifndef KAB_EMBEDDED |
186 | if ( px->height() > px->width() ) | 190 | if ( px->height() > px->width() ) |
187 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); | 191 | photo.setData( px->convertToImage().scaleHeight( 140 ) ); |
188 | else | 192 | else |
189 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); | 193 | photo.setData( px->convertToImage().scaleWidth( 100 ) ); |
190 | #else //KAB_EMBEDDED | 194 | #else //KAB_EMBEDDED |
191 | //US add teh nullcheck | 195 | //US add teh nullcheck |
192 | if (px->isNull() != true ) | 196 | if (px->isNull() != true ) |
193 | photo.setData( px->convertToImage() ); | 197 | photo.setData( px->convertToImage() ); |
194 | #endif //KAB_EMBEDDED | 198 | #endif //KAB_EMBEDDED |
195 | 199 | ||
@@ -223,25 +227,25 @@ void ImageWidget::setLogo( const KABC::Picture &logo ) | |||
223 | } | 227 | } |
224 | 228 | ||
225 | blockSignals( blocked ); | 229 | blockSignals( blocked ); |
226 | } | 230 | } |
227 | 231 | ||
228 | KABC::Picture ImageWidget::logo() const | 232 | KABC::Picture ImageWidget::logo() const |
229 | { | 233 | { |
230 | KABC::Picture logo; | 234 | KABC::Picture logo; |
231 | 235 | ||
232 | if ( mUseLogoUrl->isChecked() ) | 236 | if ( mUseLogoUrl->isChecked() ) |
233 | logo.setUrl( mLogoUrl->url() ); | 237 | logo.setUrl( mLogoUrl->url() ); |
234 | else { | 238 | else { |
235 | QPixmap *px = mLogoLabel->pixmap(); | 239 | const QPixmap *px = mLogoLabel->pixmap(); |
236 | if ( px ) { | 240 | if ( px ) { |
237 | #ifndef KAB_EMBEDDED | 241 | #ifndef KAB_EMBEDDED |
238 | if ( px->height() > px->width() ) | 242 | if ( px->height() > px->width() ) |
239 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); | 243 | logo.setData( px->convertToImage().scaleHeight( 140 ) ); |
240 | else | 244 | else |
241 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); | 245 | logo.setData( px->convertToImage().scaleWidth( 100 ) ); |
242 | #else //KAB_EMBEDDED | 246 | #else //KAB_EMBEDDED |
243 | if (px->isNull() != true ) | 247 | if (px->isNull() != true ) |
244 | logo.setData( px->convertToImage() ); | 248 | logo.setData( px->convertToImage() ); |
245 | #endif //KAB_EMBEDDED | 249 | #endif //KAB_EMBEDDED |
246 | 250 | ||
247 | logo.setType( "PNG" ); | 251 | logo.setType( "PNG" ); |
@@ -283,15 +287,15 @@ void ImageWidget::updateGUI() | |||
283 | 287 | ||
284 | QPixmap ImageWidget::loadPixmap( const QString &url ) | 288 | QPixmap ImageWidget::loadPixmap( const QString &url ) |
285 | { | 289 | { |
286 | 290 | ||
287 | QPixmap pixmap; | 291 | QPixmap pixmap; |
288 | 292 | ||
289 | if ( url.isEmpty() ) | 293 | if ( url.isEmpty() ) |
290 | return pixmap; | 294 | return pixmap; |
291 | pixmap.load( url ); | 295 | pixmap.load( url ); |
292 | return pixmap; | 296 | return pixmap; |
293 | } | 297 | } |
294 | 298 | ||
295 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED_ |
296 | #include "imagewidget.moc" | 300 | #include "moc_imagewidget.cpp" |
297 | #endif //KAB_EMBEDDED | 301 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/imagewidget.h b/kaddressbook/imagewidget.h index bbfba58..9320a6b 100644 --- a/kaddressbook/imagewidget.h +++ b/kaddressbook/imagewidget.h | |||
@@ -16,24 +16,27 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef IMAGEWIDGET_H | 24 | #ifndef IMAGEWIDGET_H |
25 | #define IMAGEWIDGET_H | 25 | #define IMAGEWIDGET_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | //Added by qt3to4: | ||
29 | #include <QPixmap> | ||
30 | #include <QLabel> | ||
28 | 31 | ||
29 | #include <kabc/picture.h> | 32 | #include <kabc/picture.h> |
30 | #include <kdialogbase.h> | 33 | #include <kdialogbase.h> |
31 | 34 | ||
32 | class KURL; | 35 | class KURL; |
33 | class KURLRequester; | 36 | class KURLRequester; |
34 | 37 | ||
35 | class QCheckBox; | 38 | class QCheckBox; |
36 | class QLabel; | 39 | class QLabel; |
37 | 40 | ||
38 | class ImageWidget : public QWidget | 41 | class ImageWidget : public QWidget |
39 | { | 42 | { |
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 5f8b83d..a54d1cd 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -16,47 +16,51 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qapplication.h> | 27 | #include <qapplication.h> |
28 | #include <QDesktopWidget> | ||
28 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3HBoxLayout> | ||
29 | 32 | ||
30 | #include <kdialog.h> | 33 | #include <kdialog.h> |
31 | #include <klineedit.h> | 34 | #include <klineedit.h> |
32 | #include <klocale.h> | 35 | #include <klocale.h> |
33 | #include <kglobal.h> | 36 | #include <kglobal.h> |
34 | #include <kglobal.h> | 37 | #include <kglobal.h> |
35 | #include "kabprefs.h" | 38 | #include "kabprefs.h" |
36 | 39 | ||
37 | #include "incsearchwidget.h" | 40 | #include "incsearchwidget.h" |
38 | 41 | ||
39 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | 42 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) |
40 | : QWidget( parent, name ) | ||
41 | { | 43 | { |
44 | setObjectName(name); | ||
45 | setParent(parent); | ||
42 | #ifndef KAB_EMBEDDED | 46 | #ifndef KAB_EMBEDDED |
43 | //US setCaption( i18n( "Incremental Search" ) ); | 47 | //US setCaption( i18n( "Incremental Search" ) ); |
44 | #endif //KAB_EMBEDDED | 48 | #endif //KAB_EMBEDDED |
45 | 49 | ||
46 | QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); | 50 | Q3HBoxLayout *layout = new Q3HBoxLayout( this, 2, KDialog::spacingHint() ); |
47 | 51 | ||
48 | #ifdef DESKTOP_VERSION | 52 | #ifdef DESKTOP_VERSION |
49 | QLabel *label = new QLabel( i18n( "Search:" ), this ); | 53 | QLabel *label = new QLabel( i18n( "Search:" ), this ); |
50 | label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); | 54 | label->setAlignment( Qt::AlignVCenter | Qt::AlignRight ); |
51 | layout->addWidget( label ); | 55 | layout->addWidget( label ); |
52 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
53 | 57 | ||
54 | mSearchText = new KLineEdit( this ); | 58 | mSearchText = new KLineEdit( this ); |
55 | layout->addWidget( mSearchText ); | 59 | layout->addWidget( mSearchText ); |
56 | // #ifdef KAB_EMBEDDED | 60 | // #ifdef KAB_EMBEDDED |
57 | // if (KGlobal::getOrientation() == KGlobal::Portrait) | 61 | // if (KGlobal::getOrientation() == KGlobal::Portrait) |
58 | // mSearchText->setMaximumWidth(30); | 62 | // mSearchText->setMaximumWidth(30); |
59 | // #endif //KAB_EMBEDDED | 63 | // #endif //KAB_EMBEDDED |
60 | //mSearchText->setMaximumWidth(60); | 64 | //mSearchText->setMaximumWidth(60); |
61 | 65 | ||
62 | 66 | ||
@@ -167,15 +171,15 @@ KABC::Field *IncSearchWidget::currentField()const | |||
167 | 171 | ||
168 | void IncSearchWidget::setCurrentItem( int pos ) | 172 | void IncSearchWidget::setCurrentItem( int pos ) |
169 | { | 173 | { |
170 | mFieldCombo->setCurrentItem( pos ); | 174 | mFieldCombo->setCurrentItem( pos ); |
171 | announceFieldChanged(); | 175 | announceFieldChanged(); |
172 | } | 176 | } |
173 | 177 | ||
174 | int IncSearchWidget::currentItem() const | 178 | int IncSearchWidget::currentItem() const |
175 | { | 179 | { |
176 | 180 | ||
177 | return mFieldCombo->currentItem(); | 181 | return mFieldCombo->currentItem(); |
178 | } | 182 | } |
179 | #ifndef KAB_EMBEDDED | 183 | #ifndef KAB_EMBEDDED_ |
180 | #include "incsearchwidget.moc" | 184 | #include "moc_incsearchwidget.cpp" |
181 | #endif //KAB_EMBEDDED | 185 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp index aebf8a6..740b7db 100644 --- a/kaddressbook/jumpbuttonbar.cpp +++ b/kaddressbook/jumpbuttonbar.cpp | |||
@@ -16,26 +16,29 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qevent.h> | 24 | #include <qevent.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qtl.h> | 28 | #include <q3tl.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <QDesktopWidget> | ||
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
30 | 33 | ||
31 | #include <kabc/addressbook.h> | 34 | #include <kabc/addressbook.h> |
32 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
33 | #include <kdebug.h> | 36 | #include <kdebug.h> |
34 | #include <klocale.h> | 37 | #include <klocale.h> |
35 | 38 | ||
36 | #include "kabcore.h" | 39 | #include "kabcore.h" |
37 | 40 | ||
38 | #include "jumpbuttonbar.h" | 41 | #include "jumpbuttonbar.h" |
39 | 42 | ||
40 | class JumpButton : public QPushButton | 43 | class JumpButton : public QPushButton |
41 | { | 44 | { |
@@ -64,27 +67,27 @@ void JumpButton::setCharacter( const QString &character ) | |||
64 | } | 67 | } |
65 | 68 | ||
66 | QString JumpButton::character() const | 69 | QString JumpButton::character() const |
67 | { | 70 | { |
68 | return mCharacter; | 71 | return mCharacter; |
69 | } | 72 | } |
70 | 73 | ||
71 | JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name ) | 74 | JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name ) |
72 | : QWidget( parent, name ), mCore( core ) | 75 | : QWidget( parent, name ), mCore( core ) |
73 | { | 76 | { |
74 | if ( QApplication::desktop()->width() < 480 ) | 77 | if ( QApplication::desktop()->width() < 480 ) |
75 | 78 | ||
76 | mButtonLayout = new QGridLayout( this, 1, 18 ); | 79 | mButtonLayout = new Q3GridLayout( this, 1, 18 ); |
77 | else | 80 | else |
78 | mButtonLayout = new QGridLayout( this, 1, 20 ); | 81 | mButtonLayout = new Q3GridLayout( this, 1, 20 ); |
79 | mButtonLayout->setAlignment( Qt::AlignTop ); | 82 | mButtonLayout->setAlignment( Qt::AlignTop ); |
80 | 83 | ||
81 | recreateButtons(); | 84 | recreateButtons(); |
82 | } | 85 | } |
83 | 86 | ||
84 | JumpButtonBar::~JumpButtonBar() | 87 | JumpButtonBar::~JumpButtonBar() |
85 | { | 88 | { |
86 | } | 89 | } |
87 | 90 | ||
88 | QSizePolicy JumpButtonBar::sizePolicy() const | 91 | QSizePolicy JumpButtonBar::sizePolicy() const |
89 | { | 92 | { |
90 | #ifndef KAB_EMBEDDED | 93 | #ifndef KAB_EMBEDDED |
@@ -243,15 +246,15 @@ void JumpButtonBar::sortListLocaleAware( QStringList &list ) | |||
243 | if ( QString::compare( *j2, *j1 ) < 0 ) | 246 | if ( QString::compare( *j2, *j1 ) < 0 ) |
244 | #endif //KAB_EMBEDDED | 247 | #endif //KAB_EMBEDDED |
245 | qSwap( *j1, *j2 ); | 248 | qSwap( *j1, *j2 ); |
246 | 249 | ||
247 | ++j1; | 250 | ++j1; |
248 | ++j2; | 251 | ++j2; |
249 | } | 252 | } |
250 | ++beginIt; | 253 | ++beginIt; |
251 | --walkBackIt; | 254 | --walkBackIt; |
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | #ifndef KAB_EMBEDDED | 258 | #ifndef KAB_EMBEDDED_ |
256 | #include "jumpbuttonbar.moc" | 259 | #include "moc_jumpbuttonbar.cpp" |
257 | #endif //KAB_EMBEDDED | 260 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/jumpbuttonbar.h b/kaddressbook/jumpbuttonbar.h index d534f2b..0589812 100644 --- a/kaddressbook/jumpbuttonbar.h +++ b/kaddressbook/jumpbuttonbar.h | |||
@@ -17,29 +17,32 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef JUMPBUTTONBAR_H | 24 | #ifndef JUMPBUTTONBAR_H |
25 | #define JUMPBUTTONBAR_H | 25 | #define JUMPBUTTONBAR_H |
26 | 26 | ||
27 | #include <qsizepolicy.h> | 27 | #include <qsizepolicy.h> |
28 | #include <qwidget.h> | 28 | #include <qwidget.h> |
29 | #include <qptrlist.h> | 29 | #include <q3ptrlist.h> |
30 | #include <qstringlist.h> | 30 | #include <qstringlist.h> |
31 | //Added by qt3to4: | ||
32 | #include <QResizeEvent> | ||
33 | #include <Q3GridLayout> | ||
31 | 34 | ||
32 | class QChar; | 35 | class QChar; |
33 | class QGridLayout; | 36 | class Q3GridLayout; |
34 | class QResizeEvent; | 37 | class QResizeEvent; |
35 | class QPushButton; | 38 | class QPushButton; |
36 | class JumpButton; | 39 | class JumpButton; |
37 | 40 | ||
38 | namespace KABC { | 41 | namespace KABC { |
39 | class Field; | 42 | class Field; |
40 | } | 43 | } |
41 | 44 | ||
42 | class KABCore; | 45 | class KABCore; |
43 | 46 | ||
44 | /** | 47 | /** |
45 | Used to draw the jump button bar on the right of the view. | 48 | Used to draw the jump button bar on the right of the view. |
@@ -67,18 +70,18 @@ class JumpButtonBar : public QWidget | |||
67 | Emitted whenever a letter is selected by the user. | 70 | Emitted whenever a letter is selected by the user. |
68 | */ | 71 | */ |
69 | void jumpToLetter( const QString &character ); | 72 | void jumpToLetter( const QString &character ); |
70 | 73 | ||
71 | protected slots: | 74 | protected slots: |
72 | void letterClicked(); | 75 | void letterClicked(); |
73 | 76 | ||
74 | private: | 77 | private: |
75 | void sortListLocaleAware( QStringList &list ); | 78 | void sortListLocaleAware( QStringList &list ); |
76 | 79 | ||
77 | KABCore *mCore; | 80 | KABCore *mCore; |
78 | 81 | ||
79 | QGridLayout *mButtonLayout; | 82 | Q3GridLayout *mButtonLayout; |
80 | QStringList mCharacters; | 83 | QStringList mCharacters; |
81 | QPtrList<JumpButton> mButtons; | 84 | Q3PtrList<JumpButton> mButtons; |
82 | }; | 85 | }; |
83 | 86 | ||
84 | #endif | 87 | #endif |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index ab2824c..03b44d1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -30,36 +30,46 @@ $Id$ | |||
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qprogressbar.h> | 42 | #include <q3progressbar.h> |
43 | #include <QDesktopWidget> | ||
44 | //Added by qt3to4: | ||
45 | #include <QResizeEvent> | ||
46 | #include <QPixmap> | ||
47 | #include <Q3ValueList> | ||
48 | #include <Q3HBoxLayout> | ||
49 | #include <Q3VBoxLayout> | ||
50 | #include <Q3CString> | ||
51 | #include <Q3PopupMenu> | ||
52 | #include <Q3PtrList> | ||
43 | #include <libkdepim/phoneaccess.h> | 53 | #include <libkdepim/phoneaccess.h> |
44 | 54 | ||
45 | #ifndef KAB_EMBEDDED | 55 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 56 | #include <qclipboard.h> |
47 | #include <qdir.h> | 57 | #include <qdir.h> |
48 | #include <qfile.h> | 58 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 59 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 60 | #include <q3progressbar.h> |
51 | #include <qlayout.h> | 61 | #include <qlayout.h> |
52 | #include <qregexp.h> | 62 | #include <qregexp.h> |
53 | #include <qvbox.h> | 63 | #include <q3vbox.h> |
54 | #include <kabc/addresseelist.h> | 64 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 65 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 66 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 67 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 68 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 69 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 70 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 71 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 72 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 73 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 74 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 75 | #include <kprinter.h> |
@@ -79,25 +89,25 @@ $Id$ | |||
79 | #include "ldapsearchdialog.h" | 89 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 90 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 91 | #else // KAB_EMBEDDED |
82 | 92 | ||
83 | #include <kapplication.h> | 93 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 94 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 95 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 96 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 97 | #include "addresseedialog.h" |
88 | //US | 98 | //US |
89 | #include <addresseeview.h> | 99 | #include <addresseeview.h> |
90 | 100 | ||
91 | #include <qapp.h> | 101 | #include <qapplication.h> |
92 | #include <qmenubar.h> | 102 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 103 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 104 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 105 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 106 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 107 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 108 | #include <ktoolbar.h> |
99 | #include <kprefsdialog.h> | 109 | #include <kprefsdialog.h> |
100 | 110 | ||
101 | 111 | ||
102 | //#include <qlabel.h> | 112 | //#include <qlabel.h> |
103 | 113 | ||
@@ -120,30 +130,30 @@ $Id$ | |||
120 | 130 | ||
121 | 131 | ||
122 | #include <kresources/selectdialog.h> | 132 | #include <kresources/selectdialog.h> |
123 | #include <kmessagebox.h> | 133 | #include <kmessagebox.h> |
124 | 134 | ||
125 | #include <picture.h> | 135 | #include <picture.h> |
126 | #include <resource.h> | 136 | #include <resource.h> |
127 | 137 | ||
128 | //US#include <qsplitter.h> | 138 | //US#include <qsplitter.h> |
129 | #include <qmap.h> | 139 | #include <qmap.h> |
130 | #include <qdir.h> | 140 | #include <qdir.h> |
131 | #include <qfile.h> | 141 | #include <qfile.h> |
132 | #include <qvbox.h> | 142 | #include <q3vbox.h> |
133 | #include <qlayout.h> | 143 | #include <qlayout.h> |
134 | #include <qclipboard.h> | 144 | #include <qclipboard.h> |
135 | #include <qtextstream.h> | 145 | #include <q3textstream.h> |
136 | #include <qradiobutton.h> | 146 | #include <qradiobutton.h> |
137 | #include <qbuttongroup.h> | 147 | #include <q3buttongroup.h> |
138 | 148 | ||
139 | #include <libkdepim/categoryselectdialog.h> | 149 | #include <libkdepim/categoryselectdialog.h> |
140 | #include <libkdepim/categoryeditdialog.h> | 150 | #include <libkdepim/categoryeditdialog.h> |
141 | #include <kabc/vcardconverter.h> | 151 | #include <kabc/vcardconverter.h> |
142 | 152 | ||
143 | 153 | ||
144 | #include "addresseeutil.h" | 154 | #include "addresseeutil.h" |
145 | #include "undocmds.h" | 155 | #include "undocmds.h" |
146 | #include "addresseeeditordialog.h" | 156 | #include "addresseeeditordialog.h" |
147 | #include "viewmanager.h" | 157 | #include "viewmanager.h" |
148 | #include "details/detailsviewcontainer.h" | 158 | #include "details/detailsviewcontainer.h" |
149 | #include "kabprefs.h" | 159 | #include "kabprefs.h" |
@@ -166,30 +176,30 @@ $Id$ | |||
166 | // sync includes | 176 | // sync includes |
167 | #include <libkdepim/ksyncprofile.h> | 177 | #include <libkdepim/ksyncprofile.h> |
168 | #include <libkdepim/ksyncprefsdialog.h> | 178 | #include <libkdepim/ksyncprefsdialog.h> |
169 | 179 | ||
170 | 180 | ||
171 | class KABCatPrefs : public QDialog | 181 | class KABCatPrefs : public QDialog |
172 | { | 182 | { |
173 | public: | 183 | public: |
174 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 184 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
175 | QDialog( parent, name, true ) | 185 | QDialog( parent, name, true ) |
176 | { | 186 | { |
177 | setCaption( i18n("Manage new Categories") ); | 187 | setCaption( i18n("Manage new Categories") ); |
178 | QVBoxLayout* lay = new QVBoxLayout( this ); | 188 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
179 | lay->setSpacing( 3 ); | 189 | lay->setSpacing( 3 ); |
180 | lay->setMargin( 3 ); | 190 | lay->setMargin( 3 ); |
181 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 191 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
182 | lay->addWidget( lab ); | 192 | lay->addWidget( lab ); |
183 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 193 | Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this ); |
184 | lay->addWidget( format ); | 194 | lay->addWidget( format ); |
185 | format->setExclusive ( true ) ; | 195 | format->setExclusive ( true ) ; |
186 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 196 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
187 | new QRadioButton(i18n("Remove from addressees"), format ); | 197 | new QRadioButton(i18n("Remove from addressees"), format ); |
188 | addCatBut->setChecked( true ); | 198 | addCatBut->setChecked( true ); |
189 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 199 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
190 | lay->addWidget( ok ); | 200 | lay->addWidget( ok ); |
191 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 201 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
192 | lay->addWidget( cancel ); | 202 | lay->addWidget( cancel ); |
193 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 203 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
194 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 204 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
195 | resize( 200, 200 ); | 205 | resize( 200, 200 ); |
@@ -198,30 +208,30 @@ class KABCatPrefs : public QDialog | |||
198 | bool addCat() { return addCatBut->isChecked(); } | 208 | bool addCat() { return addCatBut->isChecked(); } |
199 | private: | 209 | private: |
200 | QRadioButton* addCatBut; | 210 | QRadioButton* addCatBut; |
201 | }; | 211 | }; |
202 | 212 | ||
203 | class KABFormatPrefs : public QDialog | 213 | class KABFormatPrefs : public QDialog |
204 | { | 214 | { |
205 | public: | 215 | public: |
206 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 216 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
207 | QDialog( parent, name, true ) | 217 | QDialog( parent, name, true ) |
208 | { | 218 | { |
209 | setCaption( i18n("Set formatted name") ); | 219 | setCaption( i18n("Set formatted name") ); |
210 | QVBoxLayout* lay = new QVBoxLayout( this ); | 220 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
211 | lay->setSpacing( 3 ); | 221 | lay->setSpacing( 3 ); |
212 | lay->setMargin( 3 ); | 222 | lay->setMargin( 3 ); |
213 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 223 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
214 | lay->addWidget( lab ); | 224 | lay->addWidget( lab ); |
215 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 225 | Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Set formatted name to:"), this ); |
216 | lay->addWidget( format ); | 226 | lay->addWidget( format ); |
217 | format->setExclusive ( true ) ; | 227 | format->setExclusive ( true ) ; |
218 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 228 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
219 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 229 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
220 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 230 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
221 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 231 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
222 | simple->setChecked( true ); | 232 | simple->setChecked( true ); |
223 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 233 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
224 | lay->addWidget( setCompany ); | 234 | lay->addWidget( setCompany ); |
225 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 235 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
226 | lay->addWidget( ok ); | 236 | lay->addWidget( ok ); |
227 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 237 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
@@ -236,47 +246,47 @@ public: | |||
236 | QCheckBox* setCompany; | 246 | QCheckBox* setCompany; |
237 | }; | 247 | }; |
238 | 248 | ||
239 | 249 | ||
240 | 250 | ||
241 | class KAex2phonePrefs : public QDialog | 251 | class KAex2phonePrefs : public QDialog |
242 | { | 252 | { |
243 | public: | 253 | public: |
244 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 254 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
245 | QDialog( parent, name, true ) | 255 | QDialog( parent, name, true ) |
246 | { | 256 | { |
247 | setCaption( i18n("Export to phone options") ); | 257 | setCaption( i18n("Export to phone options") ); |
248 | QVBoxLayout* lay = new QVBoxLayout( this ); | 258 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
249 | lay->setSpacing( 3 ); | 259 | lay->setSpacing( 3 ); |
250 | lay->setMargin( 3 ); | 260 | lay->setMargin( 3 ); |
251 | QLabel *lab; | 261 | QLabel *lab; |
252 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 262 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
253 | lab->setAlignment (AlignHCenter ); | 263 | lab->setAlignment (Qt::AlignHCenter ); |
254 | QHBox* temphb; | 264 | Q3HBox* temphb; |
255 | temphb = new QHBox( this ); | 265 | temphb = new Q3HBox( this ); |
256 | new QLabel( i18n("I/O device: "), temphb ); | 266 | new QLabel( i18n("I/O device: "), temphb ); |
257 | mPhoneDevice = new QLineEdit( temphb); | 267 | mPhoneDevice = new QLineEdit( temphb); |
258 | lay->addWidget( temphb ); | 268 | lay->addWidget( temphb ); |
259 | temphb = new QHBox( this ); | 269 | temphb = new Q3HBox( this ); |
260 | new QLabel( i18n("Connection: "), temphb ); | 270 | new QLabel( i18n("Connection: "), temphb ); |
261 | mPhoneConnection = new QLineEdit( temphb); | 271 | mPhoneConnection = new QLineEdit( temphb); |
262 | lay->addWidget( temphb ); | 272 | lay->addWidget( temphb ); |
263 | temphb = new QHBox( this ); | 273 | temphb = new Q3HBox( this ); |
264 | new QLabel( i18n("Model(opt.): "), temphb ); | 274 | new QLabel( i18n("Model(opt.): "), temphb ); |
265 | mPhoneModel = new QLineEdit( temphb); | 275 | mPhoneModel = new QLineEdit( temphb); |
266 | lay->addWidget( temphb ); | 276 | lay->addWidget( temphb ); |
267 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 277 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
268 | // lay->addWidget( mWriteToSim ); | 278 | // lay->addWidget( mWriteToSim ); |
269 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 279 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
270 | lab->setAlignment (AlignHCenter); | 280 | lab->setAlignment (Qt::AlignHCenter); |
271 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 281 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
272 | lay->addWidget( ok ); | 282 | lay->addWidget( ok ); |
273 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 283 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
274 | lay->addWidget( cancel ); | 284 | lay->addWidget( cancel ); |
275 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 285 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
276 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 286 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
277 | resize( 220, 240 ); | 287 | resize( 220, 240 ); |
278 | 288 | ||
279 | } | 289 | } |
280 | 290 | ||
281 | public: | 291 | public: |
282 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 292 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
@@ -398,41 +408,41 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
398 | createAddresseeEditorDialog( this ); | 408 | createAddresseeEditorDialog( this ); |
399 | setModified( false ); | 409 | setModified( false ); |
400 | mBRdisabled = false; | 410 | mBRdisabled = false; |
401 | #ifndef DESKTOP_VERSION | 411 | #ifndef DESKTOP_VERSION |
402 | infrared = 0; | 412 | infrared = 0; |
403 | #endif | 413 | #endif |
404 | //toggleBeamReceive( ); | 414 | //toggleBeamReceive( ); |
405 | mMainWindow->toolBar()->show(); | 415 | mMainWindow->toolBar()->show(); |
406 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 416 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
407 | //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 417 | //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
408 | QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); | 418 | QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); |
409 | } | 419 | } |
410 | void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) | 420 | void KABCore::receiveStart( const Q3CString& cmsg, const QByteArray& data ) |
411 | { | 421 | { |
412 | //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); | 422 | //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); |
413 | mCStringMess = cmsg; | 423 | mCStringMess = cmsg; |
414 | mByteData = data; | 424 | mByteData = data; |
415 | } | 425 | } |
416 | 426 | ||
417 | void KABCore::loadDataAfterStart() | 427 | void KABCore::loadDataAfterStart() |
418 | { | 428 | { |
419 | //qDebug("KABCore::loadDataAfterStart() "); | 429 | //qDebug("KABCore::loadDataAfterStart() "); |
420 | ((StdAddressBook*)mAddressBook)->init( true ); | 430 | ((StdAddressBook*)mAddressBook)->init( true ); |
421 | mViewManager->refreshView(); | 431 | mViewManager->refreshView(); |
422 | 432 | ||
423 | #ifndef DESKTOP_VERSION | 433 | #ifndef DESKTOP_VERSION |
424 | disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); | 434 | disconnect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT (receiveStart ( const Q3CString &, const QByteArray & ))); |
425 | 435 | ||
426 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 436 | QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & ))); |
427 | if ( !mCStringMess.isEmpty() ) | 437 | if ( !mCStringMess.isEmpty() ) |
428 | ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); | 438 | ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); |
429 | #endif | 439 | #endif |
430 | // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 440 | // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
431 | setCaptionBack(); | 441 | setCaptionBack(); |
432 | } | 442 | } |
433 | void KABCore::updateToolBar() | 443 | void KABCore::updateToolBar() |
434 | { | 444 | { |
435 | static int iii = 0; | 445 | static int iii = 0; |
436 | ++iii; | 446 | ++iii; |
437 | mMainWindow->toolBar()->repaintMe(); | 447 | mMainWindow->toolBar()->repaintMe(); |
438 | if ( iii < 4 ) | 448 | if ( iii < 4 ) |
@@ -444,52 +454,52 @@ KABCore::~KABCore() | |||
444 | //saveSettings(); | 454 | //saveSettings(); |
445 | //KABPrefs::instance()->writeConfig(); | 455 | //KABPrefs::instance()->writeConfig(); |
446 | delete AddresseeConfig::instance(); | 456 | delete AddresseeConfig::instance(); |
447 | mAddressBook = 0; | 457 | mAddressBook = 0; |
448 | KABC::StdAddressBook::close(); | 458 | KABC::StdAddressBook::close(); |
449 | 459 | ||
450 | delete syncManager; | 460 | delete syncManager; |
451 | #ifndef DESKTOP_VERSION | 461 | #ifndef DESKTOP_VERSION |
452 | if ( infrared ) | 462 | if ( infrared ) |
453 | delete infrared; | 463 | delete infrared; |
454 | #endif | 464 | #endif |
455 | } | 465 | } |
456 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 466 | void KABCore::receive( const Q3CString& cmsg, const QByteArray& data ) |
457 | { | 467 | { |
458 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 468 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
459 | if ( cmsg == "setDocument(QString)" ) { | 469 | if ( cmsg == "setDocument(QString)" ) { |
460 | QDataStream stream( data, IO_ReadOnly ); | 470 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
461 | QString fileName; | 471 | QString fileName; |
462 | stream >> fileName; | 472 | stream >> fileName; |
463 | recieve( fileName ); | 473 | recieve( fileName ); |
464 | return; | 474 | return; |
465 | } | 475 | } |
466 | } | 476 | } |
467 | void KABCore::toggleBeamReceive( ) | 477 | void KABCore::toggleBeamReceive( ) |
468 | { | 478 | { |
469 | if ( mBRdisabled ) | 479 | if ( mBRdisabled ) |
470 | return; | 480 | return; |
471 | #ifndef DESKTOP_VERSION | 481 | #ifndef DESKTOP_VERSION |
472 | if ( infrared ) { | 482 | if ( infrared ) { |
473 | qDebug("KA: AB disable BeamReceive "); | 483 | qDebug("KA: AB disable BeamReceive "); |
474 | delete infrared; | 484 | delete infrared; |
475 | infrared = 0; | 485 | infrared = 0; |
476 | mActionBR->setChecked(false); | 486 | mActionBR->setChecked(false); |
477 | return; | 487 | return; |
478 | } | 488 | } |
479 | qDebug("KA: AB enable BeamReceive "); | 489 | qDebug("KA: AB enable BeamReceive "); |
480 | mActionBR->setChecked(true); | 490 | mActionBR->setChecked(true); |
481 | 491 | ||
482 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 492 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
483 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 493 | QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(receive( const Q3CString&, const QByteArray& ))); |
484 | #endif | 494 | #endif |
485 | } | 495 | } |
486 | 496 | ||
487 | 497 | ||
488 | void KABCore::disableBR(bool b) | 498 | void KABCore::disableBR(bool b) |
489 | { | 499 | { |
490 | #ifndef DESKTOP_VERSION | 500 | #ifndef DESKTOP_VERSION |
491 | if ( b ) { | 501 | if ( b ) { |
492 | if ( infrared ) { | 502 | if ( infrared ) { |
493 | toggleBeamReceive( ); | 503 | toggleBeamReceive( ); |
494 | } | 504 | } |
495 | mBRdisabled = true; | 505 | mBRdisabled = true; |
@@ -551,25 +561,25 @@ void KABCore::restoreSettings() | |||
551 | mViewManager->restoreSettings(); | 561 | mViewManager->restoreSettings(); |
552 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 562 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
553 | mExtensionManager->restoreSettings(); | 563 | mExtensionManager->restoreSettings(); |
554 | #ifdef DESKTOP_VERSION | 564 | #ifdef DESKTOP_VERSION |
555 | int wid = width(); | 565 | int wid = width(); |
556 | if ( wid < 10 ) | 566 | if ( wid < 10 ) |
557 | wid = 400; | 567 | wid = 400; |
558 | #else | 568 | #else |
559 | int wid = QApplication::desktop()->width(); | 569 | int wid = QApplication::desktop()->width(); |
560 | if ( wid < 640 ) | 570 | if ( wid < 640 ) |
561 | wid = QApplication::desktop()->height(); | 571 | wid = QApplication::desktop()->height(); |
562 | #endif | 572 | #endif |
563 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 573 | Q3ValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
564 | if ( true /*splitterSize.count() == 0*/ ) { | 574 | if ( true /*splitterSize.count() == 0*/ ) { |
565 | splitterSize.append( wid / 2 ); | 575 | splitterSize.append( wid / 2 ); |
566 | splitterSize.append( wid / 2 ); | 576 | splitterSize.append( wid / 2 ); |
567 | } | 577 | } |
568 | mMiniSplitter->setSizes( splitterSize ); | 578 | mMiniSplitter->setSizes( splitterSize ); |
569 | if ( mExtensionBarSplitter ) { | 579 | if ( mExtensionBarSplitter ) { |
570 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 580 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
571 | if ( true /*splitterSize.count() == 0*/ ) { | 581 | if ( true /*splitterSize.count() == 0*/ ) { |
572 | splitterSize.append( wid / 2 ); | 582 | splitterSize.append( wid / 2 ); |
573 | splitterSize.append( wid / 2 ); | 583 | splitterSize.append( wid / 2 ); |
574 | } | 584 | } |
575 | mExtensionBarSplitter->setSizes( splitterSize ); | 585 | mExtensionBarSplitter->setSizes( splitterSize ); |
@@ -641,28 +651,28 @@ KABC::Field *KABCore::currentSearchField() const | |||
641 | return mIncSearchWidget->currentField(); | 651 | return mIncSearchWidget->currentField(); |
642 | else | 652 | else |
643 | return 0; | 653 | return 0; |
644 | } | 654 | } |
645 | 655 | ||
646 | QStringList KABCore::selectedUIDs() const | 656 | QStringList KABCore::selectedUIDs() const |
647 | { | 657 | { |
648 | return mViewManager->selectedUids(); | 658 | return mViewManager->selectedUids(); |
649 | } | 659 | } |
650 | 660 | ||
651 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 661 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
652 | { | 662 | { |
653 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 663 | Q3PtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
654 | 664 | ||
655 | QPtrList<KRES::Resource> kresResources; | 665 | Q3PtrList<KRES::Resource> kresResources; |
656 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 666 | Q3PtrListIterator<KABC::Resource> resIt( kabcResources ); |
657 | KABC::Resource *resource; | 667 | KABC::Resource *resource; |
658 | while ( ( resource = resIt.current() ) != 0 ) { | 668 | while ( ( resource = resIt.current() ) != 0 ) { |
659 | ++resIt; | 669 | ++resIt; |
660 | if ( !resource->readOnly() ) { | 670 | if ( !resource->readOnly() ) { |
661 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 671 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
662 | if ( res ) | 672 | if ( res ) |
663 | kresResources.append( res ); | 673 | kresResources.append( res ); |
664 | } | 674 | } |
665 | } | 675 | } |
666 | 676 | ||
667 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 677 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
668 | return static_cast<KABC::Resource*>( res ); | 678 | return static_cast<KABC::Resource*>( res ); |
@@ -786,32 +796,32 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
786 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 796 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
787 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 797 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
788 | 798 | ||
789 | if ( a.isEmpty() ) | 799 | if ( a.isEmpty() ) |
790 | continue; | 800 | continue; |
791 | 801 | ||
792 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 802 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
793 | 803 | ||
794 | QString fileName = dirName + "/" + name; | 804 | QString fileName = dirName + "/" + name; |
795 | 805 | ||
796 | QFile outFile(fileName); | 806 | QFile outFile(fileName); |
797 | 807 | ||
798 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 808 | if ( outFile.open(QIODevice::WriteOnly) ) { // file opened successfully |
799 | KABC::VCardConverter converter; | 809 | KABC::VCardConverter converter; |
800 | QString vcard; | 810 | QString vcard; |
801 | 811 | ||
802 | converter.addresseeToVCard( a, vcard ); | 812 | converter.addresseeToVCard( a, vcard ); |
803 | 813 | ||
804 | QTextStream t( &outFile ); // use a text stream | 814 | Q3TextStream t( &outFile ); // use a text stream |
805 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 815 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
806 | t << vcard; | 816 | t << vcard; |
807 | 817 | ||
808 | outFile.close(); | 818 | outFile.close(); |
809 | 819 | ||
810 | urls.append( fileName ); | 820 | urls.append( fileName ); |
811 | } | 821 | } |
812 | } | 822 | } |
813 | 823 | ||
814 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 824 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
815 | 825 | ||
816 | 826 | ||
817 | /*US | 827 | /*US |
@@ -1007,29 +1017,29 @@ void KABCore::beamVCard(const QStringList& uids) | |||
1007 | if ( semi < dopp && semi >= 0 ) | 1017 | if ( semi < dopp && semi >= 0 ) |
1008 | sep = semi ; | 1018 | sep = semi ; |
1009 | else | 1019 | else |
1010 | sep = dopp; | 1020 | sep = dopp; |
1011 | datastream +=vcard.mid( start, next - start); | 1021 | datastream +=vcard.mid( start, next - start); |
1012 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 1022 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
1013 | start = sep; | 1023 | start = sep; |
1014 | } | 1024 | } |
1015 | datastream += vcard.mid( start,vcard.length() ); | 1025 | datastream += vcard.mid( start,vcard.length() ); |
1016 | } | 1026 | } |
1017 | #ifndef DESKTOP_VERSION | 1027 | #ifndef DESKTOP_VERSION |
1018 | QFile outFile(fileName); | 1028 | QFile outFile(fileName); |
1019 | if ( outFile.open(IO_WriteOnly) ) { | 1029 | if ( outFile.open(QIODevice::WriteOnly) ) { |
1020 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 1030 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
1021 | QTextStream t( &outFile ); // use a text stream | 1031 | Q3TextStream t( &outFile ); // use a text stream |
1022 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 1032 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
1023 | t.setEncoding( QTextStream::Latin1 ); | 1033 | t.setEncoding( Q3TextStream::Latin1 ); |
1024 | t <<datastream.latin1(); | 1034 | t <<datastream.latin1(); |
1025 | outFile.close(); | 1035 | outFile.close(); |
1026 | Ir *ir = new Ir( this ); | 1036 | Ir *ir = new Ir( this ); |
1027 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 1037 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
1028 | ir->send( fileName, description, "text/x-vCard" ); | 1038 | ir->send( fileName, description, "text/x-vCard" ); |
1029 | } else { | 1039 | } else { |
1030 | qDebug("KA: Error open temp beam file "); | 1040 | qDebug("KA: Error open temp beam file "); |
1031 | return; | 1041 | return; |
1032 | } | 1042 | } |
1033 | #endif | 1043 | #endif |
1034 | 1044 | ||
1035 | } | 1045 | } |
@@ -1288,28 +1298,28 @@ void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | |||
1288 | 1298 | ||
1289 | UndoStack::instance()->push( command ); | 1299 | UndoStack::instance()->push( command ); |
1290 | RedoStack::instance()->clear(); | 1300 | RedoStack::instance()->clear(); |
1291 | if ( updateDetails ) | 1301 | if ( updateDetails ) |
1292 | mDetails->setAddressee( addr ); | 1302 | mDetails->setAddressee( addr ); |
1293 | setModified( true ); | 1303 | setModified( true ); |
1294 | } | 1304 | } |
1295 | 1305 | ||
1296 | void KABCore::newContact() | 1306 | void KABCore::newContact() |
1297 | { | 1307 | { |
1298 | 1308 | ||
1299 | 1309 | ||
1300 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1310 | Q3PtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1301 | 1311 | ||
1302 | QPtrList<KRES::Resource> kresResources; | 1312 | Q3PtrList<KRES::Resource> kresResources; |
1303 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1313 | Q3PtrListIterator<KABC::Resource> it( kabcResources ); |
1304 | KABC::Resource *resource; | 1314 | KABC::Resource *resource; |
1305 | while ( ( resource = it.current() ) != 0 ) { | 1315 | while ( ( resource = it.current() ) != 0 ) { |
1306 | ++it; | 1316 | ++it; |
1307 | if ( !resource->readOnly() ) { | 1317 | if ( !resource->readOnly() ) { |
1308 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1318 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1309 | if ( res ) | 1319 | if ( res ) |
1310 | kresResources.append( res ); | 1320 | kresResources.append( res ); |
1311 | } | 1321 | } |
1312 | } | 1322 | } |
1313 | 1323 | ||
1314 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1324 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1315 | resource = static_cast<KABC::Resource*>( res ); | 1325 | resource = static_cast<KABC::Resource*>( res ); |
@@ -1847,98 +1857,98 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | |||
1847 | 1857 | ||
1848 | return mEditorDialog; | 1858 | return mEditorDialog; |
1849 | } | 1859 | } |
1850 | 1860 | ||
1851 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1861 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1852 | { | 1862 | { |
1853 | //mEditorDict.remove( uid ); | 1863 | //mEditorDict.remove( uid ); |
1854 | } | 1864 | } |
1855 | 1865 | ||
1856 | void KABCore::initGUI() | 1866 | void KABCore::initGUI() |
1857 | { | 1867 | { |
1858 | #ifndef KAB_EMBEDDED | 1868 | #ifndef KAB_EMBEDDED |
1859 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1869 | Q3HBoxLayout *topLayout = new Q3HBoxLayout( this ); |
1860 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1870 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1861 | 1871 | ||
1862 | mExtensionBarSplitter = new QSplitter( this ); | 1872 | mExtensionBarSplitter = new QSplitter( this ); |
1863 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1873 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1864 | 1874 | ||
1865 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1875 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1866 | 1876 | ||
1867 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1877 | Q3VBox *viewSpace = new Q3VBox( mDetailsSplitter ); |
1868 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1878 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1869 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1879 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1870 | SLOT( incrementalSearch( const QString& ) ) ); | 1880 | SLOT( incrementalSearch( const QString& ) ) ); |
1871 | 1881 | ||
1872 | mViewManager = new ViewManager( this, viewSpace ); | 1882 | mViewManager = new ViewManager( this, viewSpace ); |
1873 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1883 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1874 | 1884 | ||
1875 | mDetails = new ViewContainer( mDetailsSplitter ); | 1885 | mDetails = new ViewContainer( mDetailsSplitter ); |
1876 | 1886 | ||
1877 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1887 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1878 | 1888 | ||
1879 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1889 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1880 | 1890 | ||
1881 | topLayout->addWidget( mExtensionBarSplitter ); | 1891 | topLayout->addWidget( mExtensionBarSplitter ); |
1882 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1892 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1883 | topLayout->addWidget( mJumpButtonBar ); | 1893 | topLayout->addWidget( mJumpButtonBar ); |
1884 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1894 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1885 | 1895 | ||
1886 | mXXPortManager = new XXPortManager( this, this ); | 1896 | mXXPortManager = new XXPortManager( this, this ); |
1887 | 1897 | ||
1888 | #else //KAB_EMBEDDED | 1898 | #else //KAB_EMBEDDED |
1889 | //US initialize viewMenu before settingup viewmanager. | 1899 | //US initialize viewMenu before settingup viewmanager. |
1890 | // Viewmanager needs this menu to plugin submenues. | 1900 | // Viewmanager needs this menu to plugin submenues. |
1891 | viewMenu = new QPopupMenu( this ); | 1901 | viewMenu = new Q3PopupMenu( this ); |
1892 | settingsMenu = new QPopupMenu( this ); | 1902 | settingsMenu = new Q3PopupMenu( this ); |
1893 | //filterMenu = new QPopupMenu( this ); | 1903 | //filterMenu = new QPopupMenu( this ); |
1894 | ImportMenu = new QPopupMenu( this ); | 1904 | ImportMenu = new Q3PopupMenu( this ); |
1895 | ExportMenu = new QPopupMenu( this ); | 1905 | ExportMenu = new Q3PopupMenu( this ); |
1896 | syncMenu = new QPopupMenu( this ); | 1906 | syncMenu = new Q3PopupMenu( this ); |
1897 | changeMenu= new QPopupMenu( this ); | 1907 | changeMenu= new Q3PopupMenu( this ); |
1898 | beamMenu= new QPopupMenu( this ); | 1908 | beamMenu= new Q3PopupMenu( this ); |
1899 | 1909 | ||
1900 | //US since we have no splitter for the embedded system, setup | 1910 | //US since we have no splitter for the embedded system, setup |
1901 | // a layout with two frames. One left and one right. | 1911 | // a layout with two frames. One left and one right. |
1902 | 1912 | ||
1903 | QBoxLayout *topLayout; | 1913 | Q3BoxLayout *topLayout; |
1904 | 1914 | ||
1905 | // = new QHBoxLayout( this ); | 1915 | // = new QHBoxLayout( this ); |
1906 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1916 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1907 | 1917 | ||
1908 | // QWidget *mainBox = new QWidget( this ); | 1918 | // QWidget *mainBox = new QWidget( this ); |
1909 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1919 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1910 | 1920 | ||
1911 | #ifdef DESKTOP_VERSION | 1921 | #ifdef DESKTOP_VERSION |
1912 | topLayout = new QHBoxLayout( this ); | 1922 | topLayout = new Q3HBoxLayout( this ); |
1913 | 1923 | ||
1914 | 1924 | ||
1915 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1925 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1916 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1926 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1917 | 1927 | ||
1918 | topLayout->addWidget(mMiniSplitter ); | 1928 | topLayout->addWidget(mMiniSplitter ); |
1919 | 1929 | ||
1920 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1930 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1921 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1931 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1922 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1932 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1923 | mDetails = new ViewContainer( mMiniSplitter ); | 1933 | mDetails = new ViewContainer( mMiniSplitter ); |
1924 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1934 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1925 | #else | 1935 | #else |
1926 | if ( QApplication::desktop()->width() > 480 ) { | 1936 | if ( QApplication::desktop()->width() > 480 ) { |
1927 | topLayout = new QHBoxLayout( this ); | 1937 | topLayout = new Q3HBoxLayout( this ); |
1928 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1938 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1929 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1939 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1930 | } else { | 1940 | } else { |
1931 | 1941 | ||
1932 | topLayout = new QHBoxLayout( this ); | 1942 | topLayout = new Q3HBoxLayout( this ); |
1933 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1943 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1934 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1944 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1935 | } | 1945 | } |
1936 | 1946 | ||
1937 | topLayout->addWidget(mMiniSplitter ); | 1947 | topLayout->addWidget(mMiniSplitter ); |
1938 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1948 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1939 | mDetails = new ViewContainer( mMiniSplitter ); | 1949 | mDetails = new ViewContainer( mMiniSplitter ); |
1940 | 1950 | ||
1941 | 1951 | ||
1942 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1952 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1943 | #endif | 1953 | #endif |
1944 | //eh->hide(); | 1954 | //eh->hide(); |
@@ -2025,35 +2035,35 @@ void KABCore::initActions() | |||
2025 | { | 2035 | { |
2026 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2036 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2027 | 2037 | ||
2028 | #ifndef KAB_EMBEDDED | 2038 | #ifndef KAB_EMBEDDED |
2029 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 2039 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
2030 | SLOT( clipboardDataChanged() ) ); | 2040 | SLOT( clipboardDataChanged() ) ); |
2031 | #endif //KAB_EMBEDDED | 2041 | #endif //KAB_EMBEDDED |
2032 | 2042 | ||
2033 | // file menu | 2043 | // file menu |
2034 | 2044 | ||
2035 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 2045 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
2036 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 2046 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
2037 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 2047 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", Qt::CTRL + Qt::Key_P, mViewManager, |
2038 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 2048 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
2039 | 2049 | ||
2040 | 2050 | ||
2041 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 2051 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
2042 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 2052 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
2043 | 2053 | ||
2044 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 2054 | mActionSave = new KAction( i18n( "&Save" ), "filesave", Qt::CTRL+Qt::Key_S, this, |
2045 | SLOT( save() ), actionCollection(), "file_sync" ); | 2055 | SLOT( save() ), actionCollection(), "file_sync" ); |
2046 | 2056 | ||
2047 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 2057 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", Qt::CTRL+Qt::Key_N, this, |
2048 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 2058 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
2049 | 2059 | ||
2050 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 2060 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
2051 | this, SLOT( mailVCard() ), | 2061 | this, SLOT( mailVCard() ), |
2052 | actionCollection(), "file_mail_vcard"); | 2062 | actionCollection(), "file_mail_vcard"); |
2053 | 2063 | ||
2054 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 2064 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
2055 | SLOT( export2phone() ), actionCollection(), | 2065 | SLOT( export2phone() ), actionCollection(), |
2056 | "kaddressbook_ex2phone" ); | 2066 | "kaddressbook_ex2phone" ); |
2057 | 2067 | ||
2058 | mActionBeamVCard = 0; | 2068 | mActionBeamVCard = 0; |
2059 | mActionBeam = 0; | 2069 | mActionBeam = 0; |
@@ -2074,53 +2084,53 @@ void KABCore::initActions() | |||
2074 | this, SLOT( editContact2() ), | 2084 | this, SLOT( editContact2() ), |
2075 | actionCollection(), "file_properties" ); | 2085 | actionCollection(), "file_properties" ); |
2076 | 2086 | ||
2077 | #ifdef KAB_EMBEDDED | 2087 | #ifdef KAB_EMBEDDED |
2078 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 2088 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
2079 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 2089 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
2080 | mMainWindow, SLOT( exit() ), | 2090 | mMainWindow, SLOT( exit() ), |
2081 | actionCollection(), "quit" ); | 2091 | actionCollection(), "quit" ); |
2082 | #endif //KAB_EMBEDDED | 2092 | #endif //KAB_EMBEDDED |
2083 | 2093 | ||
2084 | // edit menu | 2094 | // edit menu |
2085 | if ( mIsPart ) { | 2095 | if ( mIsPart ) { |
2086 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 2096 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", Qt::CTRL + Qt::Key_C, this, |
2087 | SLOT( copyContacts() ), actionCollection(), | 2097 | SLOT( copyContacts() ), actionCollection(), |
2088 | "kaddressbook_copy" ); | 2098 | "kaddressbook_copy" ); |
2089 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 2099 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", Qt::CTRL + Qt::Key_X, this, |
2090 | SLOT( cutContacts() ), actionCollection(), | 2100 | SLOT( cutContacts() ), actionCollection(), |
2091 | "kaddressbook_cut" ); | 2101 | "kaddressbook_cut" ); |
2092 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 2102 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", Qt::CTRL + Qt::Key_V, this, |
2093 | SLOT( pasteContacts() ), actionCollection(), | 2103 | SLOT( pasteContacts() ), actionCollection(), |
2094 | "kaddressbook_paste" ); | 2104 | "kaddressbook_paste" ); |
2095 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 2105 | mActionSelectAll = new KAction( i18n( "Select &All" ), Qt::CTRL + Qt::Key_A, this, |
2096 | SLOT( selectAllContacts() ), actionCollection(), | 2106 | SLOT( selectAllContacts() ), actionCollection(), |
2097 | "kaddressbook_select_all" ); | 2107 | "kaddressbook_select_all" ); |
2098 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 2108 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", Qt::CTRL + Qt::Key_Z, this, |
2099 | SLOT( undo() ), actionCollection(), | 2109 | SLOT( undo() ), actionCollection(), |
2100 | "kaddressbook_undo" ); | 2110 | "kaddressbook_undo" ); |
2101 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 2111 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", Qt::CTRL + Qt::SHIFT + Qt::Key_Z, |
2102 | this, SLOT( redo() ), actionCollection(), | 2112 | this, SLOT( redo() ), actionCollection(), |
2103 | "kaddressbook_redo" ); | 2113 | "kaddressbook_redo" ); |
2104 | } else { | 2114 | } else { |
2105 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 2115 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
2106 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 2116 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
2107 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 2117 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
2108 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 2118 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
2109 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 2119 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
2110 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 2120 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
2111 | } | 2121 | } |
2112 | 2122 | ||
2113 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 2123 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
2114 | Key_Delete, this, SLOT( deleteContacts() ), | 2124 | Qt::Key_Delete, this, SLOT( deleteContacts() ), |
2115 | actionCollection(), "edit_delete" ); | 2125 | actionCollection(), "edit_delete" ); |
2116 | 2126 | ||
2117 | mActionUndo->setEnabled( false ); | 2127 | mActionUndo->setEnabled( false ); |
2118 | mActionRedo->setEnabled( false ); | 2128 | mActionRedo->setEnabled( false ); |
2119 | 2129 | ||
2120 | // settings menu | 2130 | // settings menu |
2121 | #ifdef KAB_EMBEDDED | 2131 | #ifdef KAB_EMBEDDED |
2122 | //US special menuentry to configure the addressbook resources. On KDE | 2132 | //US special menuentry to configure the addressbook resources. On KDE |
2123 | // you do that through the control center !!! | 2133 | // you do that through the control center !!! |
2124 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2134 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
2125 | SLOT( configureResources() ), actionCollection(), | 2135 | SLOT( configureResources() ), actionCollection(), |
2126 | "kaddressbook_configure_resources" ); | 2136 | "kaddressbook_configure_resources" ); |
@@ -2237,27 +2247,27 @@ void KABCore::initActions() | |||
2237 | clipboardDataChanged(); | 2247 | clipboardDataChanged(); |
2238 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2248 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2239 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2249 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2240 | } | 2250 | } |
2241 | 2251 | ||
2242 | //US we need this function, to plug all actions into the correct menues. | 2252 | //US we need this function, to plug all actions into the correct menues. |
2243 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2253 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2244 | void KABCore::addActionsManually() | 2254 | void KABCore::addActionsManually() |
2245 | { | 2255 | { |
2246 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2256 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2247 | 2257 | ||
2248 | #ifdef KAB_EMBEDDED | 2258 | #ifdef KAB_EMBEDDED |
2249 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2259 | Q3PopupMenu *fileMenu = new Q3PopupMenu( this ); |
2250 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2260 | Q3PopupMenu *editMenu = new Q3PopupMenu( this ); |
2251 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2261 | Q3PopupMenu *helpMenu = new Q3PopupMenu( this ); |
2252 | 2262 | ||
2253 | KToolBar* tb = mMainWindow->toolBar(); | 2263 | KToolBar* tb = mMainWindow->toolBar(); |
2254 | mMainWindow->setToolBarsMovable (false ); | 2264 | mMainWindow->setToolBarsMovable (false ); |
2255 | #ifndef DESKTOP_VERSION | 2265 | #ifndef DESKTOP_VERSION |
2256 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2266 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2257 | #endif | 2267 | #endif |
2258 | QMenuBar* mb = mMainWindow->menuBar(); | 2268 | QMenuBar* mb = mMainWindow->menuBar(); |
2259 | 2269 | ||
2260 | //US setup menubar. | 2270 | //US setup menubar. |
2261 | //Disable the following block if you do not want to have a menubar. | 2271 | //Disable the following block if you do not want to have a menubar. |
2262 | mb->insertItem( i18n("&File"), fileMenu ); | 2272 | mb->insertItem( i18n("&File"), fileMenu ); |
2263 | mb->insertItem( i18n("&Edit"), editMenu ); | 2273 | mb->insertItem( i18n("&Edit"), editMenu ); |
@@ -2267,25 +2277,25 @@ void KABCore::addActionsManually() | |||
2267 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2277 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2268 | #else | 2278 | #else |
2269 | mb->insertItem( i18n("Sync"), syncMenu ); | 2279 | mb->insertItem( i18n("Sync"), syncMenu ); |
2270 | #endif | 2280 | #endif |
2271 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2281 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2272 | mb->insertItem( i18n("&Help"), helpMenu ); | 2282 | mb->insertItem( i18n("&Help"), helpMenu ); |
2273 | mIncSearchWidget = new IncSearchWidget( tb ); | 2283 | mIncSearchWidget = new IncSearchWidget( tb ); |
2274 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2284 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2275 | #ifndef DESKTOP_VERSION | 2285 | #ifndef DESKTOP_VERSION |
2276 | } else { | 2286 | } else { |
2277 | //US setup toolbar | 2287 | //US setup toolbar |
2278 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2288 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2279 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2289 | Q3PopupMenu *popupBarTB = new Q3PopupMenu( this ); |
2280 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2290 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2281 | tb->insertWidget(-1, 0, menuBarTB); | 2291 | tb->insertWidget(-1, 0, menuBarTB); |
2282 | mIncSearchWidget = new IncSearchWidget( tb ); | 2292 | mIncSearchWidget = new IncSearchWidget( tb ); |
2283 | tb->enableMoving(false); | 2293 | tb->enableMoving(false); |
2284 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2294 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2285 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2295 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2286 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2296 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2287 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2297 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2288 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2298 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2289 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2299 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2290 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2300 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2291 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2301 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
@@ -2622,25 +2632,25 @@ void KABCore::updateActionMenu() | |||
2622 | void KABCore::configureKeyBindings() | 2632 | void KABCore::configureKeyBindings() |
2623 | { | 2633 | { |
2624 | #ifndef KAB_EMBEDDED | 2634 | #ifndef KAB_EMBEDDED |
2625 | KKeyDialog::configure( actionCollection(), true ); | 2635 | KKeyDialog::configure( actionCollection(), true ); |
2626 | #else //KAB_EMBEDDED | 2636 | #else //KAB_EMBEDDED |
2627 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2637 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2628 | #endif //KAB_EMBEDDED | 2638 | #endif //KAB_EMBEDDED |
2629 | } | 2639 | } |
2630 | 2640 | ||
2631 | #ifdef KAB_EMBEDDED | 2641 | #ifdef KAB_EMBEDDED |
2632 | void KABCore::configureResources() | 2642 | void KABCore::configureResources() |
2633 | { | 2643 | { |
2634 | KRES::KCMKResources dlg( this, "" , 0 ); | 2644 | KRES::KCMKResources dlg( this, "" , QStringList() ); |
2635 | 2645 | ||
2636 | if ( !dlg.exec() ) | 2646 | if ( !dlg.exec() ) |
2637 | return; | 2647 | return; |
2638 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2648 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2639 | } | 2649 | } |
2640 | #endif //KAB_EMBEDDED | 2650 | #endif //KAB_EMBEDDED |
2641 | 2651 | ||
2642 | 2652 | ||
2643 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2653 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2644 | * for the attendees list of an event. | 2654 | * for the attendees list of an event. |
2645 | */ | 2655 | */ |
2646 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2656 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
@@ -2718,25 +2728,25 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString | |||
2718 | QStringList anniversaryList; | 2728 | QStringList anniversaryList; |
2719 | QStringList realNameList; | 2729 | QStringList realNameList; |
2720 | QStringList preferredEmailList; | 2730 | QStringList preferredEmailList; |
2721 | QStringList assembledNameList; | 2731 | QStringList assembledNameList; |
2722 | QStringList uidList; | 2732 | QStringList uidList; |
2723 | 2733 | ||
2724 | KABC::AddressBook::Iterator it; | 2734 | KABC::AddressBook::Iterator it; |
2725 | 2735 | ||
2726 | int count = 0; | 2736 | int count = 0; |
2727 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2737 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2728 | ++count; | 2738 | ++count; |
2729 | } | 2739 | } |
2730 | QProgressBar bar(count,0 ); | 2740 | Q3ProgressBar bar(count,0 ); |
2731 | int w = 300; | 2741 | int w = 300; |
2732 | if ( QApplication::desktop()->width() < 320 ) | 2742 | if ( QApplication::desktop()->width() < 320 ) |
2733 | w = 220; | 2743 | w = 220; |
2734 | int h = bar.sizeHint().height() ; | 2744 | int h = bar.sizeHint().height() ; |
2735 | int dw = QApplication::desktop()->width(); | 2745 | int dw = QApplication::desktop()->width(); |
2736 | int dh = QApplication::desktop()->height(); | 2746 | int dh = QApplication::desktop()->height(); |
2737 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2747 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2738 | bar.show(); | 2748 | bar.show(); |
2739 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2749 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2740 | qApp->processEvents(); | 2750 | qApp->processEvents(); |
2741 | 2751 | ||
2742 | QDate bday; | 2752 | QDate bday; |
@@ -2899,25 +2909,25 @@ KABC::Addressee KABCore::getLastSyncAddressee() | |||
2899 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2909 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2900 | 2910 | ||
2901 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2911 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2902 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2912 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2903 | if (lse.isEmpty()) { | 2913 | if (lse.isEmpty()) { |
2904 | qDebug("KA: Creating new last-syncAddressee "); | 2914 | qDebug("KA: Creating new last-syncAddressee "); |
2905 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2915 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2906 | QString sum = ""; | 2916 | QString sum = ""; |
2907 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2917 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2908 | sum = "E: "; | 2918 | sum = "E: "; |
2909 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2919 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2910 | lse.setRevision( mLastAddressbookSync ); | 2920 | lse.setRevision( mLastAddressbookSync ); |
2911 | lse.setCategories( i18n("SyncEvent") ); | 2921 | lse.setCategories( QStringList(i18n("SyncEvent")) ); |
2912 | mAddressBook->insertAddressee( lse ); | 2922 | mAddressBook->insertAddressee( lse ); |
2913 | } | 2923 | } |
2914 | return lse; | 2924 | return lse; |
2915 | } | 2925 | } |
2916 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2926 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2917 | { | 2927 | { |
2918 | 2928 | ||
2919 | //void setZaurusId(int id); | 2929 | //void setZaurusId(int id); |
2920 | // int zaurusId() const; | 2930 | // int zaurusId() const; |
2921 | // void setZaurusUid(int id); | 2931 | // void setZaurusUid(int id); |
2922 | // int zaurusUid() const; | 2932 | // int zaurusUid() const; |
2923 | // void setZaurusStat(int id); | 2933 | // void setZaurusStat(int id); |
@@ -3090,25 +3100,25 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3090 | 3100 | ||
3091 | } else { | 3101 | } else { |
3092 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3102 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3093 | addresseeRSync = addresseeLSync ; | 3103 | addresseeRSync = addresseeLSync ; |
3094 | } else { | 3104 | } else { |
3095 | //qDebug("FULLDATE 1"); | 3105 | //qDebug("FULLDATE 1"); |
3096 | fullDateRange = true; | 3106 | fullDateRange = true; |
3097 | Addressee newAdd; | 3107 | Addressee newAdd; |
3098 | addresseeRSync = newAdd; | 3108 | addresseeRSync = newAdd; |
3099 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 3109 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
3100 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 3110 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
3101 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3111 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3102 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 3112 | addresseeRSync.setCategories( QStringList(i18n("SyncAddressee")) ); |
3103 | } | 3113 | } |
3104 | } | 3114 | } |
3105 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 3115 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
3106 | // qDebug("FULLDATE 2"); | 3116 | // qDebug("FULLDATE 2"); |
3107 | fullDateRange = true; | 3117 | fullDateRange = true; |
3108 | } | 3118 | } |
3109 | if ( ! fullDateRange ) { | 3119 | if ( ! fullDateRange ) { |
3110 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 3120 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
3111 | 3121 | ||
3112 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 3122 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
3113 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 3123 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
3114 | fullDateRange = true; | 3124 | fullDateRange = true; |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index ec6a9ec..4351720 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -19,29 +19,33 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <q3dict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <q3popupmenu.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3CString> | ||
38 | #include <QPixmap> | ||
39 | #include <QResizeEvent> | ||
36 | #include <ksyncmanager.h> | 40 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 41 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 42 | #include <qcopchannel_qws.h> |
39 | #endif | 43 | #endif |
40 | 44 | ||
41 | namespace KABC { | 45 | namespace KABC { |
42 | class AddressBook; | 46 | class AddressBook; |
43 | } | 47 | } |
44 | 48 | ||
45 | #ifndef KAB_EMBEDDED | 49 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 50 | class KAboutData; |
47 | class KConfig; | 51 | class KConfig; |
@@ -76,27 +80,27 @@ class KABCore : public QWidget, public KSyncInterface | |||
76 | { | 80 | { |
77 | Q_OBJECT | 81 | Q_OBJECT |
78 | 82 | ||
79 | public: | 83 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 84 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 85 | ||
82 | 86 | ||
83 | ~KABCore(); | 87 | ~KABCore(); |
84 | 88 | ||
85 | 89 | ||
86 | #ifdef KAB_EMBEDDED | 90 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 91 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 92 | Q3PopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 93 | Q3PopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 94 | Q3PopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 95 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 96 | #endif //KAB_EMBEDDED |
93 | /** | 97 | /** |
94 | Restores the global settings. | 98 | Restores the global settings. |
95 | */ | 99 | */ |
96 | void restoreSettings(); | 100 | void restoreSettings(); |
97 | 101 | ||
98 | 102 | ||
99 | 103 | ||
100 | /** | 104 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 105 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 106 | */ |
@@ -126,26 +130,26 @@ class KABCore : public QWidget, public KSyncInterface | |||
126 | /** | 130 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 131 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 132 | resource or a null pointer if no resource was selected by |
129 | the user. | 133 | the user. |
130 | */ | 134 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 135 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 136 | ||
133 | #ifndef KAB_EMBEDDED | 137 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 138 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 139 | #endif //KAB_EMBEDDED |
136 | 140 | ||
137 | #ifdef KAB_EMBEDDED | 141 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 142 | inline Q3PopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 143 | inline Q3PopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 144 | #endif //KAB_EMBEDDED |
141 | 145 | ||
142 | public slots: | 146 | public slots: |
143 | #ifdef KAB_EMBEDDED | 147 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 148 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 149 | #endif //KAB_EMBEDDED |
146 | void setDetailsToggle(); | 150 | void setDetailsToggle(); |
147 | 151 | ||
148 | void showLicence(); | 152 | void showLicence(); |
149 | void faq(); | 153 | void faq(); |
150 | void whatsnew() ; | 154 | void whatsnew() ; |
151 | void synchowto() ; | 155 | void synchowto() ; |
@@ -357,26 +361,26 @@ class KABCore : public QWidget, public KSyncInterface | |||
357 | void loadDataAfterStart(); | 361 | void loadDataAfterStart(); |
358 | void recieve(QString cmsg ); | 362 | void recieve(QString cmsg ); |
359 | void getFile( bool success,const QString & ); | 363 | void getFile( bool success,const QString & ); |
360 | void syncFileRequest(const QString &); | 364 | void syncFileRequest(const QString &); |
361 | void setDetailsVisible( bool visible ); | 365 | void setDetailsVisible( bool visible ); |
362 | void setDetailsToState(); | 366 | void setDetailsToState(); |
363 | 367 | ||
364 | void saveSettings(); | 368 | void saveSettings(); |
365 | 369 | ||
366 | private slots: | 370 | private slots: |
367 | void updateToolBar(); | 371 | void updateToolBar(); |
368 | void updateMainWindow(); | 372 | void updateMainWindow(); |
369 | void receive( const QCString& cmsg, const QByteArray& data ); | 373 | void receive( const Q3CString& cmsg, const QByteArray& data ); |
370 | void receiveStart( const QCString& cmsg, const QByteArray& data ); | 374 | void receiveStart( const Q3CString& cmsg, const QByteArray& data ); |
371 | void toggleBeamReceive( ); | 375 | void toggleBeamReceive( ); |
372 | void disableBR(bool); | 376 | void disableBR(bool); |
373 | void setJumpButtonBarVisible( bool visible ); | 377 | void setJumpButtonBarVisible( bool visible ); |
374 | void setJumpButtonBar( bool visible ); | 378 | void setJumpButtonBar( bool visible ); |
375 | void setCaptionBack(); | 379 | void setCaptionBack(); |
376 | void resizeAndCallContactdialog(); | 380 | void resizeAndCallContactdialog(); |
377 | void callContactdialog(); | 381 | void callContactdialog(); |
378 | void doRingSync(); | 382 | void doRingSync(); |
379 | 383 | ||
380 | void importFromOL(); | 384 | void importFromOL(); |
381 | void extensionModified( const KABC::Addressee::List &list ); | 385 | void extensionModified( const KABC::Addressee::List &list ); |
382 | void extensionChanged( int id ); | 386 | void extensionChanged( int id ); |
@@ -385,25 +389,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
385 | void configureKeyBindings(); | 389 | void configureKeyBindings(); |
386 | void removeVoice(); | 390 | void removeVoice(); |
387 | void setFormattedName(); | 391 | void setFormattedName(); |
388 | #ifdef KAB_EMBEDDED | 392 | #ifdef KAB_EMBEDDED |
389 | void configureResources(); | 393 | void configureResources(); |
390 | #endif //KAB_EMBEDDED | 394 | #endif //KAB_EMBEDDED |
391 | 395 | ||
392 | void slotEditorDestroyed( const QString &uid ); | 396 | void slotEditorDestroyed( const QString &uid ); |
393 | void configurationChanged(); | 397 | void configurationChanged(); |
394 | void addressBookChanged(); | 398 | void addressBookChanged(); |
395 | 399 | ||
396 | private: | 400 | private: |
397 | QCString mCStringMess; | 401 | Q3CString mCStringMess; |
398 | QByteArray mByteData; | 402 | QByteArray mByteData; |
399 | QString mEmailSourceChannel; | 403 | QString mEmailSourceChannel; |
400 | QString mEmailSourceUID; | 404 | QString mEmailSourceUID; |
401 | void resizeEvent(QResizeEvent* e ); | 405 | void resizeEvent(QResizeEvent* e ); |
402 | bool mBRdisabled; | 406 | bool mBRdisabled; |
403 | #ifndef DESKTOP_VERSION | 407 | #ifndef DESKTOP_VERSION |
404 | QCopChannel* infrared; | 408 | QCopChannel* infrared; |
405 | #endif | 409 | #endif |
406 | QTimer *mMessageTimer; | 410 | QTimer *mMessageTimer; |
407 | void initGUI(); | 411 | void initGUI(); |
408 | void initActions(); | 412 | void initActions(); |
409 | QString getPhoneFile(); | 413 | QString getPhoneFile(); |
@@ -477,32 +481,32 @@ class KABCore : public QWidget, public KSyncInterface | |||
477 | KAction *mActionManageCategories; | 481 | KAction *mActionManageCategories; |
478 | KAction *mActionAboutKAddressbook; | 482 | KAction *mActionAboutKAddressbook; |
479 | KAction *mActionLicence; | 483 | KAction *mActionLicence; |
480 | KAction *mActionFaq; | 484 | KAction *mActionFaq; |
481 | KAction *mActionWN; | 485 | KAction *mActionWN; |
482 | KAction *mActionSyncHowto; | 486 | KAction *mActionSyncHowto; |
483 | KAction *mActionStorageHowto; | 487 | KAction *mActionStorageHowto; |
484 | KAction *mActionKdeSyncHowto; | 488 | KAction *mActionKdeSyncHowto; |
485 | KAction *mActionMultiSyncHowto; | 489 | KAction *mActionMultiSyncHowto; |
486 | 490 | ||
487 | KAction *mActionDeleteView; | 491 | KAction *mActionDeleteView; |
488 | 492 | ||
489 | QPopupMenu *viewMenu; | 493 | Q3PopupMenu *viewMenu; |
490 | QPopupMenu *filterMenu; | 494 | Q3PopupMenu *filterMenu; |
491 | QPopupMenu *settingsMenu; | 495 | Q3PopupMenu *settingsMenu; |
492 | QPopupMenu *changeMenu; | 496 | Q3PopupMenu *changeMenu; |
493 | QPopupMenu *beamMenu; | 497 | Q3PopupMenu *beamMenu; |
494 | //US QAction *mActionSave; | 498 | //US QAction *mActionSave; |
495 | QPopupMenu *ImportMenu; | 499 | Q3PopupMenu *ImportMenu; |
496 | QPopupMenu *ExportMenu; | 500 | Q3PopupMenu *ExportMenu; |
497 | //LR additional methods | 501 | //LR additional methods |
498 | KAction *mActionRemoveVoice; | 502 | KAction *mActionRemoveVoice; |
499 | KAction *mActionSetFormattedName; | 503 | KAction *mActionSetFormattedName; |
500 | KAction * mActionImportOL; | 504 | KAction * mActionImportOL; |
501 | 505 | ||
502 | #ifndef KAB_EMBEDDED | 506 | #ifndef KAB_EMBEDDED |
503 | KAddressBookService *mAddressBookService; | 507 | KAddressBookService *mAddressBookService; |
504 | #endif //KAB_EMBEDDED | 508 | #endif //KAB_EMBEDDED |
505 | 509 | ||
506 | class KABCorePrivate; | 510 | class KABCorePrivate; |
507 | KABCorePrivate *d; | 511 | KABCorePrivate *d; |
508 | //US bool mBlockSaveFlag; | 512 | //US bool mBlockSaveFlag; |
@@ -515,25 +519,25 @@ class KABCore : public QWidget, public KSyncInterface | |||
515 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); | 519 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); |
516 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 520 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
517 | virtual void removeSyncInfo( QString syncProfile); | 521 | virtual void removeSyncInfo( QString syncProfile); |
518 | bool readOLdata( KABC::AddressBook* local ); | 522 | bool readOLdata( KABC::AddressBook* local ); |
519 | bool writeOLdata( KABC::AddressBook* local ); | 523 | bool writeOLdata( KABC::AddressBook* local ); |
520 | bool syncOL(); | 524 | bool syncOL(); |
521 | bool syncPhone(); | 525 | bool syncPhone(); |
522 | void message( QString m , bool startTimer = true); | 526 | void message( QString m , bool startTimer = true); |
523 | 527 | ||
524 | // LR ******************************* | 528 | // LR ******************************* |
525 | // sync stuff! | 529 | // sync stuff! |
526 | QString sentSyncFile(); | 530 | QString sentSyncFile(); |
527 | QPopupMenu *syncMenu; | 531 | Q3PopupMenu *syncMenu; |
528 | KSyncManager* syncManager; | 532 | KSyncManager* syncManager; |
529 | int mGlobalSyncMode; | 533 | int mGlobalSyncMode; |
530 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 534 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
531 | KABC::Addressee getLastSyncAddressee(); | 535 | KABC::Addressee getLastSyncAddressee(); |
532 | QDateTime mLastAddressbookSync; | 536 | QDateTime mLastAddressbookSync; |
533 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 537 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
534 | // ********************* | 538 | // ********************* |
535 | //OL sync stuff | 539 | //OL sync stuff |
536 | QString mOLsyncFolderID; | 540 | QString mOLsyncFolderID; |
537 | 541 | ||
538 | }; | 542 | }; |
539 | 543 | ||
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 42d541b..6f9c995 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -16,25 +16,25 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
25 | //#include <qstring.h> | 25 | //#include <qstring.h> |
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | #include <qtextstream.h> | 28 | #include <q3textstream.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
33 | 33 | ||
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | #include <kglobalsettings.h> | 37 | #include <kglobalsettings.h> |
38 | //US#include <kdebug.h> // defines kdDebug() | 38 | //US#include <kdebug.h> // defines kdDebug() |
39 | 39 | ||
40 | #include "kabprefs.h" | 40 | #include "kabprefs.h" |
@@ -82,25 +82,25 @@ KABPrefs::KABPrefs() | |||
82 | 82 | ||
83 | 83 | ||
84 | KPrefs::setCurrentGroup( "Extensions_General" ); | 84 | KPrefs::setCurrentGroup( "Extensions_General" ); |
85 | QStringList defaultExtensions; | 85 | QStringList defaultExtensions; |
86 | defaultExtensions << "merge"; | 86 | defaultExtensions << "merge"; |
87 | defaultExtensions << "distribution_list_editor"; | 87 | defaultExtensions << "distribution_list_editor"; |
88 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 88 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
89 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 89 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
90 | 90 | ||
91 | KPrefs::setCurrentGroup( "Views" ); | 91 | KPrefs::setCurrentGroup( "Views" ); |
92 | QString defaultView = i18n( "Default Table View" ); | 92 | QString defaultView = i18n( "Default Table View" ); |
93 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 93 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
94 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 94 | addItemStringList( "ViewNames", &mViewNames, QStringList(defaultView) ); |
95 | 95 | ||
96 | KPrefs::setCurrentGroup( "Filters" ); | 96 | KPrefs::setCurrentGroup( "Filters" ); |
97 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 97 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
98 | 98 | ||
99 | } | 99 | } |
100 | 100 | ||
101 | KABPrefs::~KABPrefs() | 101 | KABPrefs::~KABPrefs() |
102 | { | 102 | { |
103 | //qDebug("KABPrefs::~KABPrefs() "); | 103 | //qDebug("KABPrefs::~KABPrefs() "); |
104 | if (sInstance == this) | 104 | if (sInstance == this) |
105 | sInstance = staticDeleterAB.setObject(0); | 105 | sInstance = staticDeleterAB.setObject(0); |
106 | } | 106 | } |
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index ddbc0c0..aff725e 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -16,25 +16,27 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABPREFS_H | 24 | #ifndef KABPREFS_H |
25 | #define KABPREFS_H | 25 | #define KABPREFS_H |
26 | 26 | ||
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qdict.h> | 28 | #include <q3dict.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
29 | 31 | ||
30 | #include <libkdepim/kpimprefs.h> | 32 | #include <libkdepim/kpimprefs.h> |
31 | 33 | ||
32 | class KConfig; | 34 | class KConfig; |
33 | 35 | ||
34 | class KABPrefs : public KPimPrefs | 36 | class KABPrefs : public KPimPrefs |
35 | { | 37 | { |
36 | public: | 38 | public: |
37 | virtual ~KABPrefs(); | 39 | virtual ~KABPrefs(); |
38 | 40 | ||
39 | static KABPrefs *instance(); | 41 | static KABPrefs *instance(); |
40 | 42 | ||
@@ -64,26 +66,26 @@ class KABPrefs : public KPimPrefs | |||
64 | void usrReadConfig(); | 66 | void usrReadConfig(); |
65 | 67 | ||
66 | 68 | ||
67 | // GUI | 69 | // GUI |
68 | bool mFullMenuBarVisible; | 70 | bool mFullMenuBarVisible; |
69 | bool mJumpButtonBarVisible; | 71 | bool mJumpButtonBarVisible; |
70 | bool mDetailsPageVisible; | 72 | bool mDetailsPageVisible; |
71 | bool mMultipleViewsAtOnce; | 73 | bool mMultipleViewsAtOnce; |
72 | bool mSearchWithReturn; | 74 | bool mSearchWithReturn; |
73 | bool mAutoSearchWithWildcard; | 75 | bool mAutoSearchWithWildcard; |
74 | bool mHideSearchOnSwitch; | 76 | bool mHideSearchOnSwitch; |
75 | bool mAskForDelete; | 77 | bool mAskForDelete; |
76 | QValueList<int> mExtensionsSplitter; | 78 | Q3ValueList<int> mExtensionsSplitter; |
77 | QValueList<int> mDetailsSplitter; | 79 | Q3ValueList<int> mDetailsSplitter; |
78 | 80 | ||
79 | // Extensions stuff | 81 | // Extensions stuff |
80 | int mCurrentExtension; | 82 | int mCurrentExtension; |
81 | QStringList mActiveExtensions; | 83 | QStringList mActiveExtensions; |
82 | 84 | ||
83 | // Views stuff | 85 | // Views stuff |
84 | QString mCurrentView; | 86 | QString mCurrentView; |
85 | QStringList mViewNames; | 87 | QStringList mViewNames; |
86 | 88 | ||
87 | // Filter | 89 | // Filter |
88 | int mCurrentFilter; | 90 | int mCurrentFilter; |
89 | 91 | ||
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro index cd38e5f..4eb1f7f 100644 --- a/kaddressbook/kaddressbook.pro +++ b/kaddressbook/kaddressbook.pro | |||
@@ -4,58 +4,58 @@ TARGET = kapi | |||
4 | DESTDIR= ../bin | 4 | DESTDIR= ../bin |
5 | 5 | ||
6 | include( ../variables.pri ) | 6 | include( ../variables.pri ) |
7 | 7 | ||
8 | 8 | ||
9 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces | 9 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces |
10 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION | 10 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION |
11 | 11 | ||
12 | unix : { | 12 | unix : { |
13 | 13 | ||
14 | staticlib: { | 14 | staticlib: { |
15 | TARGET = kapi_linux | 15 | TARGET = kapi_linux |
16 | LIBS += ../bin/libmicrokabc_qtopia.a | 16 | LIBS += ../bin/libxmicrokabc_qtopia.a |
17 | LIBS += ../bin/libmicrokabc_file.a | 17 | LIBS += ../bin/libxmicrokabc_file.a |
18 | LIBS += ../bin/libmicrokabc_dir.a | 18 | LIBS += ../bin/libxmicrokabc_dir.a |
19 | LIBS += ../bin/libmicrokdepim.a | 19 | LIBS += ../bin/libxmicrokdepim.a |
20 | LIBS += ../bin/libmicrokcal.a | 20 | LIBS += ../bin/libxmicrokcal.a |
21 | LIBS += ../bin/libmicrokabc.a | 21 | LIBS += ../bin/libxmicrokabc.a |
22 | LIBS += ../bin/libmicrokde.a | 22 | LIBS += ../bin/libxmicrokde.a |
23 | LIBS += ../bin/libmicrokabc_qtopia.a | 23 | LIBS += ../bin/libxmicrokabc_qtopia.a |
24 | LIBS += ../bin/libmicrokabc_file.a | 24 | LIBS += ../bin/libxmicrokabc_file.a |
25 | LIBS += ../bin/libmicrokabc_dir.a | 25 | LIBS += ../bin/libxmicrokabc_dir.a |
26 | LIBS += ../bin/libmicrokdepim.a | 26 | LIBS += ../bin/libxmicrokdepim.a |
27 | LIBS += ../bin/libmicrokcal.a | 27 | LIBS += ../bin/libxmicrokcal.a |
28 | LIBS += ../bin/libmicrokabc.a | 28 | LIBS += ../bin/libxmicrokabc.a |
29 | LIBS += ../bin/libmicrokde.a | 29 | LIBS += ../bin/libxmicrokde.a |
30 | LIBS += ../libical/lib/libical.a | 30 | LIBS += ../libical/lib/libical.a |
31 | LIBS += ../libical/lib/libicalss.a | 31 | LIBS += ../libical/lib/libicalss.a |
32 | 32 | ||
33 | } else { | 33 | } else { |
34 | LIBS += ../bin/libmicrokdepim.so | 34 | LIBS += ../bin/libxmicrokdepim.so |
35 | LIBS += ../bin/libmicrokde.so | 35 | LIBS += ../bin/libxmicrokde.so |
36 | LIBS += ../bin/libmicrokabc.so | 36 | LIBS += ../bin/libxmicrokabc.so |
37 | LIBS += ../bin/libmicrokcal.so | 37 | LIBS += ../bin/libxmicrokcal.so |
38 | #LIBS += -lldap | 38 | #LIBS += -lldap |
39 | } | 39 | } |
40 | OBJECTS_DIR = obj/unix | 40 | OBJECTS_DIR = obj/unix |
41 | MOC_DIR = moc/unix | 41 | MOC_DIR = moc/unix |
42 | } | 42 | } |
43 | win32: { | 43 | win32: { |
44 | RC_FILE = winicons.rc | 44 | RC_FILE = winicons.rc |
45 | DEFINES += _WIN32_ | 45 | DEFINES += _WIN32_ |
46 | LIBS += ../bin/microkdepim.lib | 46 | LIBS += ../bin/xmicrokdepim.lib |
47 | LIBS += ../bin/microkcal.lib | 47 | LIBS += ../bin/xmicrokcal.lib |
48 | LIBS += ../bin/microkde.lib | 48 | LIBS += ../bin/xmicrokde.lib |
49 | LIBS += ../bin/microkabc.lib | 49 | LIBS += ../bin/xmicrokabc.lib |
50 | QMAKE_LINK += /NODEFAULTLIB:LIBC | 50 | QMAKE_LINK += /NODEFAULTLIB:LIBC |
51 | OBJECTS_DIR = obj/win | 51 | OBJECTS_DIR = obj/win |
52 | MOC_DIR = moc/win | 52 | MOC_DIR = moc/win |
53 | #olimport section | 53 | #olimport section |
54 | importol { | 54 | importol { |
55 | debug: { | 55 | debug: { |
56 | LIBS += mfc71ud.lib | 56 | LIBS += mfc71ud.lib |
57 | } | 57 | } |
58 | release: { | 58 | release: { |
59 | LIBS += mfc71u.lib | 59 | LIBS += mfc71u.lib |
60 | } | 60 | } |
61 | DEFINES += _OL_IMPORT_ | 61 | DEFINES += _OL_IMPORT_ |
@@ -195,12 +195,14 @@ views/colorlistbox.cpp \ | |||
195 | xxport/vcard_xxport.cpp \ | 195 | xxport/vcard_xxport.cpp \ |
196 | xxport/kde2_xxport.cpp \ | 196 | xxport/kde2_xxport.cpp \ |
197 | xxport/csv_xxport.cpp \ | 197 | xxport/csv_xxport.cpp \ |
198 | xxport/csvimportdialog.cpp \ | 198 | xxport/csvimportdialog.cpp \ |
199 | xxport/opie_xxport.cpp \ | 199 | xxport/opie_xxport.cpp \ |
200 | xxport/qtopia_xxport.cpp \ | 200 | xxport/qtopia_xxport.cpp \ |
201 | xxport/sharpdtm_xxport.cpp \ | 201 | xxport/sharpdtm_xxport.cpp \ |
202 | #details/look_details.cpp \ | 202 | #details/look_details.cpp \ |
203 | #mainwindow.cpp \ | 203 | #mainwindow.cpp \ |
204 | # calendarview.cpp \ | 204 | # calendarview.cpp \ |
205 | # timespanview.cpp | 205 | # timespanview.cpp |
206 | 206 | ||
207 | #The following line was inserted by qt3to4 | ||
208 | QT += xml qt3support | ||
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro index 64e3a4a..c4b2499 100644 --- a/kaddressbook/kaddressbookE.pro +++ b/kaddressbook/kaddressbookE.pro | |||
@@ -3,28 +3,28 @@ CONFIG += qt warn_on | |||
3 | 3 | ||
4 | 4 | ||
5 | TARGET = kapi | 5 | TARGET = kapi |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 6 | OBJECTS_DIR = obj/$(PLATFORM) |
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include | 10 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include |
11 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER | 11 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER |
12 | #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL | 12 | #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL |
13 | #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER | 13 | #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER |
14 | #DEFINES += KORG_NOLVALTERNATION | 14 | #DEFINES += KORG_NOLVALTERNATION |
15 | LIBS += -lmicrokdepim | 15 | LIBS += -lxmicrokdepim |
16 | LIBS += -lmicrokde | 16 | LIBS += -lxmicrokde |
17 | LIBS += -lmicroqtcompat | 17 | LIBS += -lmicroqtcompat |
18 | LIBS += -lmicrokabc | 18 | LIBS += -lxmicrokabc |
19 | LIBS += -lqpe | 19 | LIBS += -lqpe |
20 | LIBS += -ljpeg | 20 | LIBS += -ljpeg |
21 | LIBS += $(QTOPIALIB) | 21 | LIBS += $(QTOPIALIB) |
22 | LIBS += -L$(QPEDIR)/lib | 22 | LIBS += -L$(QPEDIR)/lib |
23 | LIBS += -Wl,-export-dynamic | 23 | LIBS += -Wl,-export-dynamic |
24 | LIBS += $(GCC3EXTRALIB1) | 24 | LIBS += $(GCC3EXTRALIB1) |
25 | LIBS += $(GCC3EXTRALIB2) | 25 | LIBS += $(GCC3EXTRALIB2) |
26 | 26 | ||
27 | INTERFACES = \ | 27 | INTERFACES = \ |
28 | # filteredit_base.ui \ | 28 | # filteredit_base.ui \ |
29 | # kofilterview_base.ui \ | 29 | # kofilterview_base.ui \ |
30 | 30 | ||
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index c417226..b317974 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -16,53 +16,56 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifdef KAB_EMBEDDED | 24 | #ifdef KAB_EMBEDDED |
25 | #include "kabprefs.h" | 25 | #include "kabprefs.h" |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qtoolbar.h> | 28 | #include <q3toolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3CString> | ||
32 | #include <QCloseEvent> | ||
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <kedittoolbar.h> | 34 | #include <kedittoolbar.h> |
32 | #include <kkeydialog.h> | 35 | #include <kkeydialog.h> |
33 | #include <kmessagebox.h> | 36 | #include <kmessagebox.h> |
34 | #include <kstatusbar.h> | 37 | #include <kstatusbar.h> |
35 | #endif //KAB_EMBEDDED | 38 | #endif //KAB_EMBEDDED |
36 | #include <klocale.h> | 39 | #include <klocale.h> |
37 | 40 | ||
38 | #include "kabcore.h" | 41 | #include "kabcore.h" |
39 | #include "kaddressbookmain.h" | 42 | #include "kaddressbookmain.h" |
40 | #include "kactioncollection.h" | 43 | #include "kactioncollection.h" |
41 | 44 | ||
42 | #ifdef KAB_EMBEDDED | 45 | #ifdef KAB_EMBEDDED |
43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" ) | 46 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" ) |
44 | #else //KAB_EMBEDDED | 47 | #else //KAB_EMBEDDED |
45 | //MOC_SKIP_BEGIN | 48 | #ifndef Q_MOC_RUN |
46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) | 49 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) |
47 | //MOC_SKIP_END | 50 | #endif |
48 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
49 | { | 52 | { |
50 | setIcon(SmallIcon( "ka24" ) ); | 53 | setIcon(SmallIcon( "ka24" ) ); |
51 | #if 0 | 54 | #if 0 |
52 | //US for embedded systems, create the toolbar before we initiate KABCore. | 55 | //US for embedded systems, create the toolbar before we initiate KABCore. |
53 | // KABCore will fill the toolbar with menues and icons | 56 | // KABCore will fill the toolbar with menues and icons |
54 | QMainWindow::ToolBarDock tbd; | 57 | Qt::ToolBarDock tbd; |
55 | tbd = Top; | 58 | tbd = Qt::DockTop; |
56 | iconToolBar = new QToolBar( this ); | 59 | iconToolBar = new Q3ToolBar( this ); |
57 | addToolBar (iconToolBar , tbd ); | 60 | addToolBar (iconToolBar , tbd ); |
58 | iconToolBar->setHorizontalStretchable(true); | 61 | iconToolBar->setHorizontalStretchable(true); |
59 | //US iconToolBar->setWidth(300); | 62 | //US iconToolBar->setWidth(300); |
60 | #endif // 0 | 63 | #endif // 0 |
61 | 64 | ||
62 | mCore = new KABCore( this, true, this ); | 65 | mCore = new KABCore( this, true, this ); |
63 | 66 | ||
64 | #ifdef KAB_EMBEDDED | 67 | #ifdef KAB_EMBEDDED |
65 | setCaption( i18n( "KAddressbook/Pi" ) ); | 68 | setCaption( i18n( "KAddressbook/Pi" ) ); |
66 | #else //KAB_EMBEDDED | 69 | #else //KAB_EMBEDDED |
67 | setCaption( i18n( "Address Book Browser" ) ); | 70 | setCaption( i18n( "Address Book Browser" ) ); |
68 | #endif //KAB_EMBEDDED | 71 | #endif //KAB_EMBEDDED |
@@ -76,25 +79,25 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW | |||
76 | //US statusBar()->show(); | 79 | //US statusBar()->show(); |
77 | 80 | ||
78 | #ifndef KAB_EMBEDDED | 81 | #ifndef KAB_EMBEDDED |
79 | setStandardToolBarMenuEnabled(true); | 82 | setStandardToolBarMenuEnabled(true); |
80 | 83 | ||
81 | createGUI( "kaddressbookui.rc", false ); | 84 | createGUI( "kaddressbookui.rc", false ); |
82 | 85 | ||
83 | 86 | ||
84 | #endif //KAB_EMBEDDED | 87 | #endif //KAB_EMBEDDED |
85 | setAutoSaveSettings(); | 88 | setAutoSaveSettings(); |
86 | mCore->restoreSettings(); | 89 | mCore->restoreSettings(); |
87 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
88 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & ))); | 91 | QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), mCore, SLOT (receiveStart ( const Q3CString &, const QByteArray & ))); |
89 | #endif | 92 | #endif |
90 | } | 93 | } |
91 | 94 | ||
92 | KAddressBookMain::~KAddressBookMain() | 95 | KAddressBookMain::~KAddressBookMain() |
93 | { | 96 | { |
94 | // mCore->saveSettings(); | 97 | // mCore->saveSettings(); |
95 | } | 98 | } |
96 | 99 | ||
97 | void KAddressBookMain::showMinimized () | 100 | void KAddressBookMain::showMinimized () |
98 | { | 101 | { |
99 | QWidget::showMinimized () ; | 102 | QWidget::showMinimized () ; |
100 | } | 103 | } |
@@ -226,16 +229,15 @@ void KAddressBookMain::closeEvent( QCloseEvent* ce ) | |||
226 | return; | 229 | return; |
227 | 230 | ||
228 | if (mModified == true) | 231 | if (mModified == true) |
229 | { | 232 | { |
230 | save(); | 233 | save(); |
231 | mCore->saveSettings(); | 234 | mCore->saveSettings(); |
232 | //KABPrefs::instance()->writeConfig(); | 235 | //KABPrefs::instance()->writeConfig(); |
233 | } | 236 | } |
234 | 237 | ||
235 | ce->accept(); | 238 | ce->accept(); |
236 | } | 239 | } |
237 | 240 | ||
238 | #ifndef KAB_EMBEDDED | 241 | #ifndef KAB_EMBEDDED_ |
239 | #include "kaddressbookmain.moc" | 242 | #include "moc_kaddressbookmain.cpp" |
240 | #endif //KAB_EMBEDDED | 243 | #endif //KAB_EMBEDDED |
241 | |||
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index b6d9b4b..d3f5cc7 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h | |||
@@ -15,76 +15,78 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KADDRESSBOOKMAIN_H | 24 | #ifndef KADDRESSBOOKMAIN_H |
25 | #define KADDRESSBOOKMAIN_H | 25 | #define KADDRESSBOOKMAIN_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | //Added by qt3to4: | ||
29 | #include <QCloseEvent> | ||
28 | 30 | ||
29 | #ifdef KAB_EMBEDDED | 31 | #ifdef KAB_EMBEDDED |
30 | class QToolBar; | 32 | class Q3ToolBar; |
31 | #include <qaction.h> | 33 | #include <qaction.h> |
32 | //#include <qmainwindow.h> | 34 | //#include <qmainwindow.h> |
33 | #include <kmainwindow.h> | 35 | #include <kmainwindow.h> |
34 | #else //KAB_EMBEDDED | 36 | #else //KAB_EMBEDDED |
35 | #include <kaction.h> | 37 | #include <kaction.h> |
36 | #include <kapplication.h> | 38 | #include <kapplication.h> |
37 | #include <kmainwindow.h> | 39 | #include <kmainwindow.h> |
38 | #include "kaddressbookiface.h" | 40 | #include "kaddressbookiface.h" |
39 | #endif //KAB_EMBEDDED | 41 | #endif //KAB_EMBEDDED |
40 | 42 | ||
41 | class KABCore; | 43 | class KABCore; |
42 | class KConfig; | 44 | class KConfig; |
43 | 45 | ||
44 | /** | 46 | /** |
45 | This class serves as the main window for KAddressBook. It handles the | 47 | This class serves as the main window for KAddressBook. It handles the |
46 | menus, toolbars, and status bars. | 48 | menus, toolbars, and status bars. |
47 | 49 | ||
48 | @short Main window class | 50 | @short Main window class |
49 | @author Don Sanders <dsanders@kde.org> | 51 | @author Don Sanders <dsanders@kde.org> |
50 | @version 0.1 | 52 | @version 0.1 |
51 | */ | 53 | */ |
52 | #ifdef KAB_EMBEDDED | 54 | #ifdef KAB_EMBEDDED |
53 | class KAddressBookMain : public KMainWindow | 55 | class KAddressBookMain : public KMainWindow |
54 | #else //KAB_EMBEDDED | 56 | #else //KAB_EMBEDDED |
55 | //MOC_SKIP_BEGIN | 57 | #ifndef Q_MOC_RUN |
56 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface | 58 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface |
57 | //MOC_SKIP_END | 59 | #endif |
58 | #endif //KAB_EMBEDDED | 60 | #endif //KAB_EMBEDDED |
59 | { | 61 | { |
60 | Q_OBJECT | 62 | Q_OBJECT |
61 | 63 | ||
62 | public: | 64 | public: |
63 | KAddressBookMain(); | 65 | KAddressBookMain(); |
64 | virtual ~KAddressBookMain(); | 66 | virtual ~KAddressBookMain(); |
65 | 67 | ||
66 | #ifdef KAB_EMBEDDED | 68 | #ifdef KAB_EMBEDDED |
67 | // QPEToolBar * getIconToolBar(); | 69 | // QPEToolBar * getIconToolBar(); |
68 | // QToolBar * getIconToolBar(); | 70 | // QToolBar * getIconToolBar(); |
69 | #endif //KAB_EMBEDDED | 71 | #endif //KAB_EMBEDDED |
70 | 72 | ||
71 | 73 | ||
72 | public slots: | 74 | public slots: |
73 | void showMinimized () ; | 75 | void showMinimized () ; |
74 | virtual void addEmail( QString addr ); | 76 | virtual void addEmail( QString addr ); |
75 | #ifndef KAB_EMBEDDED | 77 | #ifndef KAB_EMBEDDED |
76 | //MOC_SKIP_BEGIN | 78 | #ifndef Q_MOC_RUN |
77 | virtual ASYNC showContactEditor( QString uid ); | 79 | virtual ASYNC showContactEditor( QString uid ); |
78 | //MOC_SKIP_END | 80 | #endif |
79 | #endif //KAB_EMBEDDED | 81 | #endif //KAB_EMBEDDED |
80 | virtual void newContact(); | 82 | virtual void newContact(); |
81 | virtual QString getNameByPhone( QString phone ); | 83 | virtual QString getNameByPhone( QString phone ); |
82 | virtual void save(); | 84 | virtual void save(); |
83 | virtual void exit(); | 85 | virtual void exit(); |
84 | protected: | 86 | protected: |
85 | void initActions(); | 87 | void initActions(); |
86 | #ifdef KAB_EMBEDDED | 88 | #ifdef KAB_EMBEDDED |
87 | //US new method to setup menues and toolbars on embedded systems | 89 | //US new method to setup menues and toolbars on embedded systems |
88 | void createGUI(); | 90 | void createGUI(); |
89 | #endif //KAB_EMBEDDED | 91 | #endif //KAB_EMBEDDED |
90 | 92 | ||
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 86898e2..4823b37 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp | |||
@@ -23,24 +23,26 @@ | |||
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | 26 | ||
27 | #include <kabc/distributionlistdialog.h> | 27 | #include <kabc/distributionlistdialog.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | 30 | ||
31 | #include "viewmanager.h" | 31 | #include "viewmanager.h" |
32 | 32 | ||
33 | #endif //KAB_EMBEDDED | 33 | #endif //KAB_EMBEDDED |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3VBoxLayout> | ||
35 | 37 | ||
36 | #include <kabc/distributionlistdialog.h> | 38 | #include <kabc/distributionlistdialog.h> |
37 | #include <kabc/addressbook.h> | 39 | #include <kabc/addressbook.h> |
38 | #include <kdebug.h> | 40 | #include <kdebug.h> |
39 | 41 | ||
40 | #include "kaddressbookview.h" | 42 | #include "kaddressbookview.h" |
41 | 43 | ||
42 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, | 44 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, |
43 | const char *name ) | 45 | const char *name ) |
44 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() | 46 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() |
45 | { | 47 | { |
46 | 48 | ||
@@ -124,25 +126,25 @@ KABC::Addressee::List KAddressBookView::addressees() | |||
124 | KABC::AddressBook::Iterator it; | 126 | KABC::AddressBook::Iterator it; |
125 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 127 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
126 | if ( mFilter.filterAddressee( *it ) ) | 128 | if ( mFilter.filterAddressee( *it ) ) |
127 | addresseeList.append( *it ); | 129 | addresseeList.append( *it ); |
128 | } | 130 | } |
129 | 131 | ||
130 | return addresseeList; | 132 | return addresseeList; |
131 | } | 133 | } |
132 | 134 | ||
133 | void KAddressBookView::initGUI() | 135 | void KAddressBookView::initGUI() |
134 | { | 136 | { |
135 | // Create the layout | 137 | // Create the layout |
136 | QVBoxLayout *layout = new QVBoxLayout( this ); | 138 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
137 | 139 | ||
138 | // Add the view widget | 140 | // Add the view widget |
139 | mViewWidget = new QWidget( this ); | 141 | mViewWidget = new QWidget( this ); |
140 | layout->addWidget( mViewWidget ); | 142 | layout->addWidget( mViewWidget ); |
141 | } | 143 | } |
142 | 144 | ||
143 | KABC::Field::List KAddressBookView::fields() const | 145 | KABC::Field::List KAddressBookView::fields() const |
144 | { | 146 | { |
145 | return mFieldList; | 147 | return mFieldList; |
146 | } | 148 | } |
147 | KABC::Field::List KAddressBookView::allFields() const | 149 | KABC::Field::List KAddressBookView::allFields() const |
148 | { | 150 | { |
@@ -174,15 +176,15 @@ QWidget *KAddressBookView::viewWidget() | |||
174 | return mViewWidget; | 176 | return mViewWidget; |
175 | } | 177 | } |
176 | 178 | ||
177 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, | 179 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, |
178 | QWidget *parent, | 180 | QWidget *parent, |
179 | const char *name ) | 181 | const char *name ) |
180 | { | 182 | { |
181 | return new ViewConfigureWidget( ab, parent, name ); | 183 | return new ViewConfigureWidget( ab, parent, name ); |
182 | } | 184 | } |
183 | 185 | ||
184 | 186 | ||
185 | 187 | ||
186 | #ifndef KAB_EMBEDDED | 188 | #ifndef KAB_EMBEDDED_ |
187 | #include "kaddressbookview.moc" | 189 | #include "moc_kaddressbookview.cpp" |
188 | #endif //KAB_EMBEDDED | 190 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 3a3f71a..e423cd7 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -1,12 +1,14 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <QDropEvent> | ||
1 | /* | 3 | /* |
2 | This file is part of KAddressBook. | 4 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 5 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 6 | ||
5 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 10 | (at your option) any later version. |
9 | 11 | ||
10 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
@@ -31,25 +33,25 @@ | |||
31 | class KConfig; | 33 | class KConfig; |
32 | class QDropEvent; | 34 | class QDropEvent; |
33 | 35 | ||
34 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
35 | #include <kabc/field.h> | 37 | #include <kabc/field.h> |
36 | #include <qwidget.h> | 38 | #include <qwidget.h> |
37 | #include <qregexp.h> | 39 | #include <qregexp.h> |
38 | 40 | ||
39 | #include "viewconfigurewidget.h" | 41 | #include "viewconfigurewidget.h" |
40 | #include "filter.h" | 42 | #include "filter.h" |
41 | 43 | ||
42 | #ifdef DESKTOP_VERSION | 44 | #ifdef DESKTOP_VERSION |
43 | #include <qpaintdevicemetrics.h> | 45 | #include <q3paintdevicemetrics.h> |
44 | #include <qprinter.h> | 46 | #include <qprinter.h> |
45 | #include <qpainter.h> | 47 | #include <qpainter.h> |
46 | #endif | 48 | #endif |
47 | 49 | ||
48 | namespace KABC { class AddressBook; } | 50 | namespace KABC { class AddressBook; } |
49 | 51 | ||
50 | /** | 52 | /** |
51 | Base class for all views in kaddressbook. This class implements | 53 | Base class for all views in kaddressbook. This class implements |
52 | all the common methods needed to provide a view to the user. | 54 | all the common methods needed to provide a view to the user. |
53 | 55 | ||
54 | To implement a specific view (table, card, etc), just inherit from | 56 | To implement a specific view (table, card, etc), just inherit from |
55 | this class and implement all the pure virtuals. | 57 | this class and implement all the pure virtuals. |
@@ -166,27 +168,27 @@ class KAddressBookView : public QWidget | |||
166 | in the document are visible. If <i>uid</i> is valid, only the | 168 | in the document are visible. If <i>uid</i> is valid, only the |
167 | addressee with uid needs to be refreshed. This is an optimization | 169 | addressee with uid needs to be refreshed. This is an optimization |
168 | only. | 170 | only. |
169 | */ | 171 | */ |
170 | virtual void refresh( QString uid = QString::null ) = 0; | 172 | virtual void refresh( QString uid = QString::null ) = 0; |
171 | 173 | ||
172 | /** | 174 | /** |
173 | This method must be overloaded in subclasses. Select (highlight) | 175 | This method must be overloaded in subclasses. Select (highlight) |
174 | the addressee matching <i>uid</i>. If uid | 176 | the addressee matching <i>uid</i>. If uid |
175 | is equal to QString::null, then all addressees should be selected. | 177 | is equal to QString::null, then all addressees should be selected. |
176 | */ | 178 | */ |
177 | #ifndef KAB_EMBEDDED | 179 | #ifndef KAB_EMBEDDED |
178 | //MOC_SKIP_BEGIN | 180 | #ifndef Q_MOC_RUN |
179 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; | 181 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; |
180 | //MOC_SKIP_END | 182 | #endif |
181 | #else //KAB_EMBEDDED | 183 | #else //KAB_EMBEDDED |
182 | //US my moc can not handle the default parameters. Is this a problem ??? | 184 | //US my moc can not handle the default parameters. Is this a problem ??? |
183 | virtual void setSelected( QString uid, bool selected) = 0; | 185 | virtual void setSelected( QString uid, bool selected) = 0; |
184 | #endif //KAB_EMBEDDED | 186 | #endif //KAB_EMBEDDED |
185 | 187 | ||
186 | signals: | 188 | signals: |
187 | 189 | ||
188 | void printView(); | 190 | void printView(); |
189 | /** | 191 | /** |
190 | This signal should be emitted by a subclass whenever an addressee | 192 | This signal should be emitted by a subclass whenever an addressee |
191 | is modified. | 193 | is modified. |
192 | */ | 194 | */ |
@@ -253,27 +255,27 @@ class KAddressBookView : public QWidget | |||
253 | void initGUI(); | 255 | void initGUI(); |
254 | 256 | ||
255 | DefaultFilterType mDefaultFilterType; | 257 | DefaultFilterType mDefaultFilterType; |
256 | Filter mFilter; | 258 | Filter mFilter; |
257 | QString mDefaultFilterName; | 259 | QString mDefaultFilterName; |
258 | KABC::AddressBook *mAddressBook; | 260 | KABC::AddressBook *mAddressBook; |
259 | KABC::Field::List mFieldList; | 261 | KABC::Field::List mFieldList; |
260 | 262 | ||
261 | QWidget *mViewWidget; | 263 | QWidget *mViewWidget; |
262 | }; | 264 | }; |
263 | 265 | ||
264 | #ifndef KAB_EMBEDDED | 266 | #ifndef KAB_EMBEDDED |
265 | //MOC_SKIP_BEGIN | 267 | #ifndef Q_MOC_RUN |
266 | class ViewFactory : public KLibFactory | 268 | class ViewFactory : public KLibFactory |
267 | //MOC_SKIP_END | 269 | #endif |
268 | #else //KAB_EMBEDDED | 270 | #else //KAB_EMBEDDED |
269 | class ViewFactory | 271 | class ViewFactory |
270 | #endif //KAB_EMBEDDED | 272 | #endif //KAB_EMBEDDED |
271 | { | 273 | { |
272 | 274 | ||
273 | public: | 275 | public: |
274 | virtual KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, | 276 | virtual KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, |
275 | const char *name = 0 ) = 0; | 277 | const char *name = 0 ) = 0; |
276 | 278 | ||
277 | /** | 279 | /** |
278 | @return The type of the view. This is normally a small one word | 280 | @return The type of the view. This is normally a small one word |
279 | string (ie: Table, Icon, Tree, etc). | 281 | string (ie: Table, Icon, Tree, etc). |
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp index 168d39e..8055085 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.cpp +++ b/kaddressbook/kcmconfigs/addresseewidget.cpp | |||
@@ -12,102 +12,106 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qgroupbox.h> | 24 | #include <q3groupbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlistbox.h> | 27 | #include <q3listbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <QDesktopWidget> | ||
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
33 | #include <Q3HBoxLayout> | ||
30 | 34 | ||
31 | #include <kbuttonbox.h> | 35 | #include <kbuttonbox.h> |
32 | #include <kcombobox.h> | 36 | #include <kcombobox.h> |
33 | #include <kconfig.h> | 37 | #include <kconfig.h> |
34 | #include <kdialog.h> | 38 | #include <kdialog.h> |
35 | #include <klocale.h> | 39 | #include <klocale.h> |
36 | #include <kglobal.h> | 40 | #include <kglobal.h> |
37 | #include <klineedit.h> | 41 | #include <klineedit.h> |
38 | #include <kstandarddirs.h> | 42 | #include <kstandarddirs.h> |
39 | 43 | ||
40 | #include "addresseewidget.h" | 44 | #include "addresseewidget.h" |
41 | 45 | ||
42 | NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, | 46 | NamePartWidget::NamePartWidget( const QString &title, QWidget *parent, |
43 | const char *name ) | 47 | const char *name ) |
44 | : QWidget( parent, name ) | 48 | : QWidget( parent, name ) |
45 | { | 49 | { |
46 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 50 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
47 | { | 51 | { |
48 | QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(), | 52 | Q3GridLayout* layout = new Q3GridLayout( this, 1, 1, KDialog::marginHintSmall(), |
49 | KDialog::spacingHintSmall() ); | 53 | KDialog::spacingHintSmall() ); |
50 | 54 | ||
51 | QLabel *label = new QLabel( i18n( title ), this ); | 55 | QLabel *label = new QLabel( i18n( title ), this ); |
52 | layout->addWidget( label, 0, 1 ); | 56 | layout->addWidget( label, 0, 1 ); |
53 | 57 | ||
54 | mBox = new QListBox( this ); | 58 | mBox = new Q3ListBox( this ); |
55 | mBox->setMaximumSize(70, 70); | 59 | mBox->setMaximumSize(70, 70); |
56 | layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); | 60 | layout->addMultiCellWidget( mBox, 0, 1, 0, 0 ); |
57 | 61 | ||
58 | KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); | 62 | KButtonBox *bbox = new KButtonBox( this, Qt::Vertical ); |
59 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); | 63 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); |
60 | mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); | 64 | mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) ); |
61 | bbox->layout(); | 65 | bbox->layout(); |
62 | layout->addMultiCellWidget( bbox, 0, 1, 2,2); | 66 | layout->addMultiCellWidget( bbox, 0, 1, 2,2); |
63 | 67 | ||
64 | mEdit = new KLineEdit( this ); | 68 | mEdit = new KLineEdit( this ); |
65 | layout->addWidget( mEdit, 1, 1 ); | 69 | layout->addWidget( mEdit, 1, 1 ); |
66 | //mEdit->setMinimumWidth(50); | 70 | //mEdit->setMinimumWidth(50); |
67 | 71 | ||
68 | // layout->addWidget( group ); | 72 | // layout->addWidget( group ); |
69 | 73 | ||
70 | } | 74 | } |
71 | else | 75 | else |
72 | { | 76 | { |
73 | QHBoxLayout *layout = new QHBoxLayout( this ); | 77 | Q3HBoxLayout *layout = new Q3HBoxLayout( this ); |
74 | 78 | ||
75 | QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); | 79 | Q3GroupBox *group = new Q3GroupBox( 0, Qt::Vertical, title, this ); |
76 | QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, | 80 | Q3GridLayout *groupLayout = new Q3GridLayout( group->layout(), 2, 2, |
77 | KDialog::spacingHint() ); | 81 | KDialog::spacingHint() ); |
78 | 82 | ||
79 | mBox = new QListBox( group ); | 83 | mBox = new Q3ListBox( group ); |
80 | 84 | ||
81 | groupLayout->addWidget( mBox, 0, 0 ); | 85 | groupLayout->addWidget( mBox, 0, 0 ); |
82 | 86 | ||
83 | KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); | 87 | KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); |
84 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); | 88 | mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) ); |
85 | mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); | 89 | mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); |
86 | bbox->layout(); | 90 | bbox->layout(); |
87 | groupLayout->addWidget( bbox, 0, 1 ); | 91 | groupLayout->addWidget( bbox, 0, 1 ); |
88 | 92 | ||
89 | mEdit = new KLineEdit( group ); | 93 | mEdit = new KLineEdit( group ); |
90 | groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); | 94 | groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 ); |
91 | 95 | ||
92 | layout->addWidget( group ); | 96 | layout->addWidget( group ); |
93 | 97 | ||
94 | } | 98 | } |
95 | 99 | ||
96 | mAddButton->setEnabled( false ); | 100 | mAddButton->setEnabled( false ); |
97 | mRemoveButton->setEnabled( false ); | 101 | mRemoveButton->setEnabled( false ); |
98 | 102 | ||
99 | 103 | ||
100 | connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), | 104 | connect( mBox, SIGNAL( selectionChanged( Q3ListBoxItem* ) ), |
101 | SLOT( selectionChanged( QListBoxItem* ) ) ); | 105 | SLOT( selectionChanged( Q3ListBoxItem* ) ) ); |
102 | connect( mEdit, SIGNAL( textChanged( const QString& ) ), | 106 | connect( mEdit, SIGNAL( textChanged( const QString& ) ), |
103 | SLOT( textChanged( const QString& ) ) ); | 107 | SLOT( textChanged( const QString& ) ) ); |
104 | connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); | 108 | connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) ); |
105 | 109 | ||
106 | } | 110 | } |
107 | 111 | ||
108 | NamePartWidget::~NamePartWidget() | 112 | NamePartWidget::~NamePartWidget() |
109 | { | 113 | { |
110 | } | 114 | } |
111 | 115 | ||
112 | void NamePartWidget::setNameParts( const QStringList &list ) | 116 | void NamePartWidget::setNameParts( const QStringList &list ) |
113 | { | 117 | { |
@@ -134,72 +138,72 @@ void NamePartWidget::add() | |||
134 | mEdit->setText( "" ); | 138 | mEdit->setText( "" ); |
135 | } | 139 | } |
136 | 140 | ||
137 | void NamePartWidget::remove() | 141 | void NamePartWidget::remove() |
138 | { | 142 | { |
139 | mBox->removeItem( mBox->currentItem() ); | 143 | mBox->removeItem( mBox->currentItem() ); |
140 | if ( mBox->count() == 0 ) | 144 | if ( mBox->count() == 0 ) |
141 | selectionChanged( 0 ); | 145 | selectionChanged( 0 ); |
142 | 146 | ||
143 | emit modified(); | 147 | emit modified(); |
144 | } | 148 | } |
145 | 149 | ||
146 | void NamePartWidget::selectionChanged( QListBoxItem *item ) | 150 | void NamePartWidget::selectionChanged( Q3ListBoxItem *item ) |
147 | { | 151 | { |
148 | mRemoveButton->setEnabled( item != 0 ); | 152 | mRemoveButton->setEnabled( item != 0 ); |
149 | } | 153 | } |
150 | 154 | ||
151 | void NamePartWidget::textChanged( const QString& text ) | 155 | void NamePartWidget::textChanged( const QString& text ) |
152 | { | 156 | { |
153 | mAddButton->setEnabled( !text.isEmpty() ); | 157 | mAddButton->setEnabled( !text.isEmpty() ); |
154 | } | 158 | } |
155 | 159 | ||
156 | 160 | ||
157 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) | 161 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) |
158 | : QWidget( parent, name ) | 162 | : QWidget( parent, name ) |
159 | { | 163 | { |
160 | QGridLayout *layout; | 164 | Q3GridLayout *layout; |
161 | 165 | ||
162 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); | 166 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); |
163 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); | 167 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); |
164 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); | 168 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); |
165 | QString dfn; | 169 | QString dfn; |
166 | if (QApplication::desktop()->width() > 320 ) | 170 | if (QApplication::desktop()->width() > 320 ) |
167 | dfn = i18n( "Default formatted name:" ); | 171 | dfn = i18n( "Default formatted name:" ); |
168 | else | 172 | else |
169 | dfn = i18n( "Def. formatted name:" ); | 173 | dfn = i18n( "Def. formatted name:" ); |
170 | 174 | ||
171 | QLabel *label = new QLabel( dfn, this ); | 175 | QLabel *label = new QLabel( dfn, this ); |
172 | 176 | ||
173 | mFormattedNameCombo = new KComboBox( this ); | 177 | mFormattedNameCombo = new KComboBox( this ); |
174 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); | 178 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); |
175 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); | 179 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); |
176 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); | 180 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); |
177 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); | 181 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); |
178 | 182 | ||
179 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 183 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
180 | { | 184 | { |
181 | layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), | 185 | layout = new Q3GridLayout( this, 4, 2, KDialog::marginHintSmall(), |
182 | KDialog::spacingHintSmall() ); | 186 | KDialog::spacingHintSmall() ); |
183 | 187 | ||
184 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); | 188 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); |
185 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); | 189 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); |
186 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); | 190 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); |
187 | layout->addWidget( label, 3, 0 ); | 191 | layout->addWidget( label, 3, 0 ); |
188 | layout->addWidget( mFormattedNameCombo, 3, 1 ); | 192 | layout->addWidget( mFormattedNameCombo, 3, 1 ); |
189 | 193 | ||
190 | } | 194 | } |
191 | else | 195 | else |
192 | { | 196 | { |
193 | layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), | 197 | layout = new Q3GridLayout( this, 2, 3, KDialog::marginHint(), |
194 | KDialog::spacingHint() ); | 198 | KDialog::spacingHint() ); |
195 | 199 | ||
196 | layout->addWidget( mPrefix, 0, 0 ); | 200 | layout->addWidget( mPrefix, 0, 0 ); |
197 | layout->addWidget( mInclusion, 0, 1 ); | 201 | layout->addWidget( mInclusion, 0, 1 ); |
198 | layout->addWidget( mSuffix, 0, 2 ); | 202 | layout->addWidget( mSuffix, 0, 2 ); |
199 | layout->addWidget( label, 1, 0 ); | 203 | layout->addWidget( label, 1, 0 ); |
200 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); | 204 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); |
201 | } | 205 | } |
202 | 206 | ||
203 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 207 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
204 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); | 208 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); |
205 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 209 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
@@ -224,15 +228,15 @@ void AddresseeWidget::restoreSettings() | |||
224 | void AddresseeWidget::saveSettings() | 228 | void AddresseeWidget::saveSettings() |
225 | { | 229 | { |
226 | qDebug("AddresseeWidget::saveSettings() "); | 230 | qDebug("AddresseeWidget::saveSettings() "); |
227 | KConfig config( locateLocal("config","kabcrc") ); | 231 | KConfig config( locateLocal("config","kabcrc") ); |
228 | config.setGroup( "General" ); | 232 | config.setGroup( "General" ); |
229 | 233 | ||
230 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); | 234 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); |
231 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); | 235 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); |
232 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); | 236 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); |
233 | config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); | 237 | config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); |
234 | } | 238 | } |
235 | 239 | ||
236 | #ifndef KAB_EMBEDDED | 240 | #ifndef KAB_EMBEDDED_ |
237 | #include "addresseewidget.moc" | 241 | #include "moc_addresseewidget.cpp" |
238 | #endif //KAB_EMBEDDED | 242 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/addresseewidget.h b/kaddressbook/kcmconfigs/addresseewidget.h index 09330c8..f2a95a8 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.h +++ b/kaddressbook/kcmconfigs/addresseewidget.h | |||
@@ -20,54 +20,54 @@ | |||
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADDRESSEEWIDGET_H | 24 | #ifndef ADDRESSEEWIDGET_H |
25 | #define ADDRESSEEWIDGET_H | 25 | #define ADDRESSEEWIDGET_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | class KComboBox; | 29 | class KComboBox; |
30 | class KLineEdit; | 30 | class KLineEdit; |
31 | 31 | ||
32 | class QListBox; | 32 | class Q3ListBox; |
33 | class QListBoxItem; | 33 | class Q3ListBoxItem; |
34 | class QPushButton; | 34 | class QPushButton; |
35 | 35 | ||
36 | class NamePartWidget : public QWidget | 36 | class NamePartWidget : public QWidget |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | 39 | ||
40 | public: | 40 | public: |
41 | NamePartWidget( const QString &title, QWidget *parent, | 41 | NamePartWidget( const QString &title, QWidget *parent, |
42 | const char *name = 0 ); | 42 | const char *name = 0 ); |
43 | ~NamePartWidget(); | 43 | ~NamePartWidget(); |
44 | 44 | ||
45 | void setNameParts( const QStringList &list ); | 45 | void setNameParts( const QStringList &list ); |
46 | QStringList nameParts() const; | 46 | QStringList nameParts() const; |
47 | 47 | ||
48 | signals: | 48 | signals: |
49 | void modified(); | 49 | void modified(); |
50 | 50 | ||
51 | private slots: | 51 | private slots: |
52 | void add(); | 52 | void add(); |
53 | void remove(); | 53 | void remove(); |
54 | 54 | ||
55 | void selectionChanged( QListBoxItem* ); | 55 | void selectionChanged( Q3ListBoxItem* ); |
56 | void textChanged( const QString& ); | 56 | void textChanged( const QString& ); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | KLineEdit *mEdit; | 59 | KLineEdit *mEdit; |
60 | 60 | ||
61 | QListBox *mBox; | 61 | Q3ListBox *mBox; |
62 | QPushButton *mAddButton; | 62 | QPushButton *mAddButton; |
63 | QPushButton *mRemoveButton; | 63 | QPushButton *mRemoveButton; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | class AddresseeWidget : public QWidget | 66 | class AddresseeWidget : public QWidget |
67 | { | 67 | { |
68 | Q_OBJECT | 68 | Q_OBJECT |
69 | 69 | ||
70 | public: | 70 | public: |
71 | AddresseeWidget( QWidget *parent, const char *name = 0 ); | 71 | AddresseeWidget( QWidget *parent, const char *name = 0 ); |
72 | ~AddresseeWidget(); | 72 | ~AddresseeWidget(); |
73 | 73 | ||
diff --git a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp index e87b000..33b66ad 100644 --- a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp +++ b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp | |||
@@ -13,47 +13,50 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3GridLayout> | ||
27 | #include <Q3Frame> | ||
25 | 28 | ||
26 | #include <klocale.h> | 29 | #include <klocale.h> |
27 | 30 | ||
28 | #include "configurewidget.h" | 31 | #include "configurewidget.h" |
29 | 32 | ||
30 | #include "extensionconfigdialog.h" | 33 | #include "extensionconfigdialog.h" |
31 | 34 | ||
32 | ExtensionConfigDialog::ExtensionConfigDialog( ExtensionFactory *factory, KConfig *config, | 35 | ExtensionConfigDialog::ExtensionConfigDialog( ExtensionFactory *factory, KConfig *config, |
33 | QWidget *parent, const char *name ) | 36 | QWidget *parent, const char *name ) |
34 | : KDialogBase( Plain, i18n( "Extension Settings" ), Ok | Cancel, Ok, parent, | 37 | : KDialogBase( Plain, i18n( "Extension Settings" ), Ok | Cancel, Ok, parent, |
35 | name, true, true ), mWidget( 0 ), mConfig( config ) | 38 | name, true, true ), mWidget( 0 ), mConfig( config ) |
36 | { | 39 | { |
37 | QFrame *page = plainPage(); | 40 | Q3Frame *page = plainPage(); |
38 | QGridLayout *layout = new QGridLayout( page, 1, 1, marginHint(), spacingHint() ); | 41 | Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHint(), spacingHint() ); |
39 | 42 | ||
40 | mWidget = factory->configureWidget( page, "ExtensionConfigWidget" ); | 43 | mWidget = factory->configureWidget( page, "ExtensionConfigWidget" ); |
41 | layout->addWidget( mWidget, 0, 0 ); | 44 | layout->addWidget( mWidget, 0, 0 ); |
42 | 45 | ||
43 | mWidget->restoreSettings( mConfig ); | 46 | mWidget->restoreSettings( mConfig ); |
44 | } | 47 | } |
45 | 48 | ||
46 | ExtensionConfigDialog::~ExtensionConfigDialog() | 49 | ExtensionConfigDialog::~ExtensionConfigDialog() |
47 | { | 50 | { |
48 | } | 51 | } |
49 | 52 | ||
50 | void ExtensionConfigDialog::slotOk() | 53 | void ExtensionConfigDialog::slotOk() |
51 | { | 54 | { |
52 | mWidget->saveSettings( mConfig ); | 55 | mWidget->saveSettings( mConfig ); |
53 | 56 | ||
54 | KDialogBase::slotOk(); | 57 | KDialogBase::slotOk(); |
55 | } | 58 | } |
56 | 59 | ||
57 | #ifndef KAB_EMBEDDED | 60 | #ifndef KAB_EMBEDDED_ |
58 | #include "extensionconfigdialog.moc" | 61 | #include "moc_extensionconfigdialog.cpp" |
59 | #endif //KAB_EMBEDDED | 62 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 9e4db74..d2b7ef1 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -13,34 +13,38 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <q3frame.h> |
26 | #include <qgroupbox.h> | 26 | #include <q3groupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qvbox.h> | 34 | #include <q3vbox.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3HBoxLayout> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3VBoxLayout> | ||
35 | 39 | ||
36 | #include <kconfig.h> | 40 | #include <kconfig.h> |
37 | #include <kdebug.h> | 41 | #include <kdebug.h> |
38 | #include <kdialog.h> | 42 | #include <kdialog.h> |
39 | #include <klistview.h> | 43 | #include <klistview.h> |
40 | #include <klocale.h> | 44 | #include <klocale.h> |
41 | #include <kglobal.h> | 45 | #include <kglobal.h> |
42 | #include <kmessagebox.h> | 46 | #include <kmessagebox.h> |
43 | #include <kstandarddirs.h> | 47 | #include <kstandarddirs.h> |
44 | 48 | ||
45 | #ifndef KAB_EMBEDDED | 49 | #ifndef KAB_EMBEDDED |
46 | #include <ktrader.h> | 50 | #include <ktrader.h> |
@@ -48,85 +52,85 @@ | |||
48 | #include <mergewidget.h> | 52 | #include <mergewidget.h> |
49 | #include <distributionlistwidget.h> | 53 | #include <distributionlistwidget.h> |
50 | #endif // KAB_EMBEDDED | 54 | #endif // KAB_EMBEDDED |
51 | 55 | ||
52 | #include "addresseewidget.h" | 56 | #include "addresseewidget.h" |
53 | #include "extensionconfigdialog.h" | 57 | #include "extensionconfigdialog.h" |
54 | #include "extensionwidget.h" | 58 | #include "extensionwidget.h" |
55 | #include "kabprefs.h" | 59 | #include "kabprefs.h" |
56 | 60 | ||
57 | #include "kabconfigwidget.h" | 61 | #include "kabconfigwidget.h" |
58 | #include <kglobalsettings.h> | 62 | #include <kglobalsettings.h> |
59 | 63 | ||
60 | class ExtensionItem : public QCheckListItem | 64 | class ExtensionItem : public Q3CheckListItem |
61 | { | 65 | { |
62 | public: | 66 | public: |
63 | 67 | ||
64 | #ifndef KAB_EMBEDDED | 68 | #ifndef KAB_EMBEDDED |
65 | ExtensionItem( QListView *parent, const QString &text ); | 69 | ExtensionItem( Q3ListView *parent, const QString &text ); |
66 | void setService( const KService::Ptr &ptr ); | 70 | void setService( const KService::Ptr &ptr ); |
67 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
68 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 72 | ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ); |
69 | void setFactory( ExtensionFactory* fac ); | 73 | void setFactory( ExtensionFactory* fac ); |
70 | #endif //KAB_EMBEDDED | 74 | #endif //KAB_EMBEDDED |
71 | 75 | ||
72 | bool configWidgetAvailable() const; | 76 | bool configWidgetAvailable() const; |
73 | ExtensionFactory *factory() const; | 77 | ExtensionFactory *factory() const; |
74 | 78 | ||
75 | virtual QString text( int column ) const; | 79 | virtual QString text( int column ) const; |
76 | 80 | ||
77 | private: | 81 | private: |
78 | #ifndef KAB_EMBEDDED | 82 | #ifndef KAB_EMBEDDED |
79 | KService::Ptr mPtr; | 83 | KService::Ptr mPtr; |
80 | #else //KAB_EMBEDDED | 84 | #else //KAB_EMBEDDED |
81 | ExtensionFactory* mFactory; | 85 | ExtensionFactory* mFactory; |
82 | QString mName; | 86 | QString mName; |
83 | QString mComment; | 87 | QString mComment; |
84 | 88 | ||
85 | #endif //KAB_EMBEDDED | 89 | #endif //KAB_EMBEDDED |
86 | 90 | ||
87 | }; | 91 | }; |
88 | 92 | ||
89 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 93 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
90 | : KPrefsWidget( prefs, parent, name ) | 94 | : KPrefsWidget( prefs, parent, name ) |
91 | { | 95 | { |
92 | 96 | ||
93 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 97 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0, |
94 | KDialog::spacingHintSmall() ); | 98 | KDialog::spacingHintSmall() ); |
95 | 99 | ||
96 | QTabWidget *tabWidget = new QTabWidget( this ); | 100 | QTabWidget *tabWidget = new QTabWidget( this ); |
97 | topLayout->addWidget( tabWidget ); | 101 | topLayout->addWidget( tabWidget ); |
98 | 102 | ||
99 | // General page | 103 | // General page |
100 | QWidget *generalPage = new QWidget( this ); | 104 | QWidget *generalPage = new QWidget( this ); |
101 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 105 | Q3VBoxLayout *layout = new Q3VBoxLayout( generalPage, KDialog::marginHintSmall(), |
102 | KDialog::spacingHintSmall() ); | 106 | KDialog::spacingHintSmall() ); |
103 | 107 | ||
104 | 108 | ||
105 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 109 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
106 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 110 | Q3HBoxLayout *hboxLayout = new Q3HBoxLayout( hBox); |
107 | KPrefsWidFont *detailsFont = | 111 | KPrefsWidFont *detailsFont = |
108 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 112 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
109 | &(KABPrefs::instance()->mDetailsFont),hBox); | 113 | &(KABPrefs::instance()->mDetailsFont),hBox); |
110 | hboxLayout->addWidget(detailsFont->label()); | 114 | hboxLayout->addWidget(detailsFont->label()); |
111 | hboxLayout->addWidget(detailsFont->preview()); | 115 | hboxLayout->addWidget(detailsFont->preview()); |
112 | hboxLayout->addWidget(detailsFont->button()); | 116 | hboxLayout->addWidget(detailsFont->button()); |
113 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 117 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
114 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 118 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
115 | //hBox->setBackgroundColor( black); | 119 | //hBox->setBackgroundColor( black); |
116 | layout->addWidget( hBox ); | 120 | layout->addWidget( hBox ); |
117 | 121 | ||
118 | //general groupbox | 122 | //general groupbox |
119 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 123 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
120 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 124 | Q3VBoxLayout *boxLayout = new Q3VBoxLayout( vBox ); |
121 | boxLayout->setAlignment( Qt::AlignTop ); | 125 | boxLayout->setAlignment( Qt::AlignTop ); |
122 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 126 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
123 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 127 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
124 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | 128 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); |
125 | boxLayout->addWidget( mMenuBarBox ); | 129 | boxLayout->addWidget( mMenuBarBox ); |
126 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 130 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
127 | boxLayout->addWidget( mSearchReturnBox ); | 131 | boxLayout->addWidget( mSearchReturnBox ); |
128 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); | 132 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); |
129 | boxLayout->addWidget( mAutoSearchWithWildcardBox); | 133 | boxLayout->addWidget( mAutoSearchWithWildcardBox); |
130 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); | 134 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); |
131 | boxLayout->addWidget( mHideSearchOnSwitchBox ); | 135 | boxLayout->addWidget( mHideSearchOnSwitchBox ); |
132 | 136 | ||
@@ -145,31 +149,31 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
145 | mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" ); | 149 | mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" ); |
146 | boxLayout->addWidget( mAskForDelete ); | 150 | boxLayout->addWidget( mAskForDelete ); |
147 | 151 | ||
148 | mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); | 152 | mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" ); |
149 | boxLayout->addWidget( mAskForQuit ); | 153 | boxLayout->addWidget( mAskForQuit ); |
150 | 154 | ||
151 | layout->addWidget( vBox ); | 155 | layout->addWidget( vBox ); |
152 | 156 | ||
153 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 157 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
154 | 158 | ||
155 | // Extension page | 159 | // Extension page |
156 | QWidget *extensionPage = new QWidget( this ); | 160 | QWidget *extensionPage = new QWidget( this ); |
157 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 161 | Q3VBoxLayout *extensionLayout = new Q3VBoxLayout( extensionPage, KDialog::marginHintSmall(), |
158 | KDialog::spacingHintSmall() ); | 162 | KDialog::spacingHintSmall() ); |
159 | 163 | ||
160 | //extensions groupbox | 164 | //extensions groupbox |
161 | 165 | ||
162 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 166 | Q3GroupBox* groupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
163 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 167 | boxLayout = new Q3VBoxLayout( groupBox->layout() ); |
164 | boxLayout->setAlignment( Qt::AlignTop ); | 168 | boxLayout->setAlignment( Qt::AlignTop ); |
165 | boxLayout->setMargin(KDialog::marginHintSmall()); | 169 | boxLayout->setMargin(KDialog::marginHintSmall()); |
166 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 170 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
167 | groupBox->layout()->setMargin(1) ; | 171 | groupBox->layout()->setMargin(1) ; |
168 | groupBox->layout()->setSpacing(0); | 172 | groupBox->layout()->setSpacing(0); |
169 | mExtensionView = new KListView( groupBox ); | 173 | mExtensionView = new KListView( groupBox ); |
170 | mExtensionView->setAllColumnsShowFocus( true ); | 174 | mExtensionView->setAllColumnsShowFocus( true ); |
171 | mExtensionView->addColumn( i18n( "Name" ) ); | 175 | mExtensionView->addColumn( i18n( "Name" ) ); |
172 | mExtensionView->addColumn( i18n( "Description" ) ); | 176 | mExtensionView->addColumn( i18n( "Description" ) ); |
173 | //mExtensionView->setMaximumHeight(80); | 177 | //mExtensionView->setMaximumHeight(80); |
174 | 178 | ||
175 | boxLayout->addWidget( mExtensionView ); | 179 | boxLayout->addWidget( mExtensionView ); |
@@ -180,28 +184,28 @@ KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char * | |||
180 | 184 | ||
181 | extensionLayout->addWidget( groupBox ); | 185 | extensionLayout->addWidget( groupBox ); |
182 | 186 | ||
183 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 187 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
184 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 188 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
185 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 189 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
186 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 190 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
187 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 191 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
188 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 192 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
189 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 193 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
190 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 194 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
191 | connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 195 | connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
192 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 196 | connect( mExtensionView, SIGNAL( selectionChanged( Q3ListViewItem* ) ), |
193 | SLOT( selectionChanged( QListViewItem* ) ) ); | 197 | SLOT( selectionChanged( Q3ListViewItem* ) ) ); |
194 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 198 | connect( mExtensionView, SIGNAL( clicked( Q3ListViewItem* ) ), |
195 | SLOT( itemClicked( QListViewItem* ) ) ); | 199 | SLOT( itemClicked( Q3ListViewItem* ) ) ); |
196 | connect( mConfigureButton, SIGNAL( clicked() ), | 200 | connect( mConfigureButton, SIGNAL( clicked() ), |
197 | SLOT( configureExtension() ) ); | 201 | SLOT( configureExtension() ) ); |
198 | 202 | ||
199 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 203 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
200 | 204 | ||
201 | // Addressee page | 205 | // Addressee page |
202 | mAddresseeWidget = new AddresseeWidget( this ); | 206 | mAddresseeWidget = new AddresseeWidget( this ); |
203 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 207 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
204 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 208 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
205 | 209 | ||
206 | } | 210 | } |
207 | 211 | ||
@@ -286,26 +290,26 @@ void KABConfigWidget::restoreExtensionSettings() | |||
286 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 290 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
287 | item->setOn( true ); | 291 | item->setOn( true ); |
288 | 292 | ||
289 | 293 | ||
290 | #endif //KAB_EMBEDDED | 294 | #endif //KAB_EMBEDDED |
291 | 295 | ||
292 | } | 296 | } |
293 | 297 | ||
294 | void KABConfigWidget::saveExtensionSettings() | 298 | void KABConfigWidget::saveExtensionSettings() |
295 | { | 299 | { |
296 | QStringList activeExtensions; | 300 | QStringList activeExtensions; |
297 | 301 | ||
298 | QPtrList<QListViewItem> list; | 302 | Q3PtrList<Q3ListViewItem> list; |
299 | QListViewItemIterator it( mExtensionView ); | 303 | Q3ListViewItemIterator it( mExtensionView ); |
300 | while ( it.current() ) { | 304 | while ( it.current() ) { |
301 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 305 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
302 | if ( item ) { | 306 | if ( item ) { |
303 | if ( item->isOn() ) | 307 | if ( item->isOn() ) |
304 | activeExtensions.append( item->factory()->identifier() ); | 308 | activeExtensions.append( item->factory()->identifier() ); |
305 | } | 309 | } |
306 | ++it; | 310 | ++it; |
307 | } | 311 | } |
308 | 312 | ||
309 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 313 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
310 | } | 314 | } |
311 | 315 | ||
@@ -319,52 +323,52 @@ void KABConfigWidget::configureExtension() | |||
319 | KConfig config( "kaddressbookrc" ); | 323 | KConfig config( "kaddressbookrc" ); |
320 | #else //KAB_EMBEDDED | 324 | #else //KAB_EMBEDDED |
321 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 325 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
322 | #endif //KAB_EMBEDDED | 326 | #endif //KAB_EMBEDDED |
323 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 327 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
324 | 328 | ||
325 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 329 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
326 | dlg.exec(); | 330 | dlg.exec(); |
327 | 331 | ||
328 | config.sync(); | 332 | config.sync(); |
329 | } | 333 | } |
330 | 334 | ||
331 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 335 | void KABConfigWidget::selectionChanged( Q3ListViewItem *i ) |
332 | { | 336 | { |
333 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 337 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
334 | if ( !item ) | 338 | if ( !item ) |
335 | return; | 339 | return; |
336 | 340 | ||
337 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 341 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
338 | } | 342 | } |
339 | 343 | ||
340 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 344 | void KABConfigWidget::itemClicked( Q3ListViewItem *item ) |
341 | { | 345 | { |
342 | if ( item != 0 ) | 346 | if ( item != 0 ) |
343 | modified(); | 347 | modified(); |
344 | } | 348 | } |
345 | 349 | ||
346 | #ifndef KAB_EMBEDDED | 350 | #ifndef KAB_EMBEDDED |
347 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 351 | ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text ) |
348 | : QCheckListItem( parent, text, CheckBox ) | 352 | : Q3CheckListItem( parent, text, CheckBox ) |
349 | { | 353 | { |
350 | } | 354 | } |
351 | 355 | ||
352 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 356 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
353 | { | 357 | { |
354 | mPtr = ptr; | 358 | mPtr = ptr; |
355 | } | 359 | } |
356 | #else //KAB_EMBEDDED | 360 | #else //KAB_EMBEDDED |
357 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 361 | ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment ) |
358 | : QCheckListItem( parent, text, CheckBox ) | 362 | : Q3CheckListItem( parent, text, CheckBox ) |
359 | { | 363 | { |
360 | mName = name; | 364 | mName = name; |
361 | mComment = comment; | 365 | mComment = comment; |
362 | } | 366 | } |
363 | 367 | ||
364 | 368 | ||
365 | void ExtensionItem::setFactory( ExtensionFactory* fac ) | 369 | void ExtensionItem::setFactory( ExtensionFactory* fac ) |
366 | { | 370 | { |
367 | mFactory = fac; | 371 | mFactory = fac; |
368 | } | 372 | } |
369 | #endif //KAB_EMBEDDED | 373 | #endif //KAB_EMBEDDED |
370 | 374 | ||
@@ -409,16 +413,15 @@ QString ExtensionItem::text( int column ) const | |||
409 | else | 413 | else |
410 | return QString::null; | 414 | return QString::null; |
411 | #else //KAB_EMBEDDED | 415 | #else //KAB_EMBEDDED |
412 | if ( column == 0 ) | 416 | if ( column == 0 ) |
413 | return mName; | 417 | return mName; |
414 | else if ( column == 1 ) | 418 | else if ( column == 1 ) |
415 | return mComment; | 419 | return mComment; |
416 | else | 420 | else |
417 | return QString::null; | 421 | return QString::null; |
418 | #endif //KAB_EMBEDDED | 422 | #endif //KAB_EMBEDDED |
419 | } | 423 | } |
420 | 424 | ||
421 | #ifndef KAB_EMBEDDED | 425 | #ifndef KAB_EMBEDDED_ |
422 | #include "kabconfigwidget.moc" | 426 | #include "moc_kabconfigwidget.cpp" |
423 | #endif //KAB_EMBEDDED | 427 | #endif //KAB_EMBEDDED |
424 | |||
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index f2a6b1b..4b6e58c 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h | |||
@@ -18,25 +18,25 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCONFIGWIDGET_H | 24 | #ifndef KABCONFIGWIDGET_H |
25 | #define KABCONFIGWIDGET_H | 25 | #define KABCONFIGWIDGET_H |
26 | 26 | ||
27 | #include <kprefswidget.h> | 27 | #include <kprefswidget.h> |
28 | 28 | ||
29 | class QCheckBox; | 29 | class QCheckBox; |
30 | class QListViewItem; | 30 | class Q3ListViewItem; |
31 | class QPushButton; | 31 | class QPushButton; |
32 | class QComboBox; | 32 | class QComboBox; |
33 | class QLineEdit; | 33 | class QLineEdit; |
34 | class KListView; | 34 | class KListView; |
35 | class KABPrefs; | 35 | class KABPrefs; |
36 | 36 | ||
37 | class AddresseeWidget; | 37 | class AddresseeWidget; |
38 | 38 | ||
39 | class KABConfigWidget : public KPrefsWidget | 39 | class KABConfigWidget : public KPrefsWidget |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
@@ -44,26 +44,26 @@ class KABConfigWidget : public KPrefsWidget | |||
44 | KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); | 44 | KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | /** Implement this to read custom configuration widgets. */ | 47 | /** Implement this to read custom configuration widgets. */ |
48 | virtual void usrReadConfig(); | 48 | virtual void usrReadConfig(); |
49 | /** Implement this to write custom configuration widgets. */ | 49 | /** Implement this to write custom configuration widgets. */ |
50 | virtual void usrWriteConfig(); | 50 | virtual void usrWriteConfig(); |
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | private slots: | 54 | private slots: |
55 | void configureExtension(); | 55 | void configureExtension(); |
56 | void selectionChanged( QListViewItem* ); | 56 | void selectionChanged( Q3ListViewItem* ); |
57 | void itemClicked( QListViewItem* ); | 57 | void itemClicked( Q3ListViewItem* ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | void restoreExtensionSettings(); | 60 | void restoreExtensionSettings(); |
61 | void saveExtensionSettings(); | 61 | void saveExtensionSettings(); |
62 | 62 | ||
63 | KListView *mExtensionView; | 63 | KListView *mExtensionView; |
64 | QCheckBox *mSearchReturnBox; | 64 | QCheckBox *mSearchReturnBox; |
65 | QCheckBox *mNameParsing; | 65 | QCheckBox *mNameParsing; |
66 | QCheckBox *mViewsSingleClickBox; | 66 | QCheckBox *mViewsSingleClickBox; |
67 | QCheckBox *mAutoSearchWithWildcardBox; | 67 | QCheckBox *mAutoSearchWithWildcardBox; |
68 | QCheckBox *mHideSearchOnSwitchBox; | 68 | QCheckBox *mHideSearchOnSwitchBox; |
69 | QCheckBox *mMultipleViewsAtOnce; | 69 | QCheckBox *mMultipleViewsAtOnce; |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp index cbfedbd..55ffcd8 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp +++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp | |||
@@ -13,24 +13,26 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3VBoxLayout> | ||
25 | 27 | ||
26 | #ifndef KAB_EMBEDDED | 28 | #ifndef KAB_EMBEDDED |
27 | #include <kaboutdata.h> | 29 | #include <kaboutdata.h> |
28 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
29 | #include <kdebug.h> | 31 | #include <kdebug.h> |
30 | //#include <klocale.h> | 32 | //#include <klocale.h> |
31 | //#include <stdlib.h> | 33 | //#include <stdlib.h> |
32 | 34 | ||
33 | #include "kabconfigwidget.h" | 35 | #include "kabconfigwidget.h" |
34 | 36 | ||
35 | #include "kcmkabconfig.h" | 37 | #include "kcmkabconfig.h" |
36 | 38 | ||
@@ -39,25 +41,25 @@ | |||
39 | 41 | ||
40 | extern "C" | 42 | extern "C" |
41 | { | 43 | { |
42 | KCModule *create_kabconfig( QWidget *parent, const char * ) { | 44 | KCModule *create_kabconfig( QWidget *parent, const char * ) { |
43 | return new KCMKabConfig( parent, "kcmkabconfig" ); | 45 | return new KCMKabConfig( parent, "kcmkabconfig" ); |
44 | } | 46 | } |
45 | } | 47 | } |
46 | 48 | ||
47 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) | 49 | KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name ) |
48 | : KCModule( KABPrefs::instance(), parent, name ) | 50 | : KCModule( KABPrefs::instance(), parent, name ) |
49 | { | 51 | { |
50 | //abort(); | 52 | //abort(); |
51 | QVBoxLayout *layout = new QVBoxLayout( this ); | 53 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
52 | mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" ); | 54 | mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" ); |
53 | layout->addWidget( mConfigWidget ); | 55 | layout->addWidget( mConfigWidget ); |
54 | layout->setSpacing( 0 ); | 56 | layout->setSpacing( 0 ); |
55 | layout->setMargin( 0 ); | 57 | layout->setMargin( 0 ); |
56 | 58 | ||
57 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 59 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
58 | } | 60 | } |
59 | 61 | ||
60 | void KCMKabConfig::load() | 62 | void KCMKabConfig::load() |
61 | { | 63 | { |
62 | mConfigWidget->readConfig(); | 64 | mConfigWidget->readConfig(); |
63 | } | 65 | } |
@@ -78,15 +80,15 @@ const KAboutData* KCMKabConfig::aboutData() const | |||
78 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), | 80 | KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ), |
79 | I18N_NOOP( "KAddressBook Configure Dialog" ), | 81 | I18N_NOOP( "KAddressBook Configure Dialog" ), |
80 | 0, 0, KAboutData::License_GPL, | 82 | 0, 0, KAboutData::License_GPL, |
81 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); | 83 | I18N_NOOP( "(c), 2003 Tobias Koenig" ) ); |
82 | 84 | ||
83 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); | 85 | about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" ); |
84 | 86 | ||
85 | return about; | 87 | return about; |
86 | 88 | ||
87 | } | 89 | } |
88 | #endif //KAB_EMBEDDED | 90 | #endif //KAB_EMBEDDED |
89 | 91 | ||
90 | #ifndef KAB_EMBEDDED | 92 | #ifndef KAB_EMBEDDED_ |
91 | #include "kcmkabconfig.moc" | 93 | #include "moc_kcmkabconfig.cpp" |
92 | #endif //KAB_EMBEDDED | 94 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/keywidget.cpp b/kaddressbook/keywidget.cpp index c117d34..8ebee19 100644 --- a/kaddressbook/keywidget.cpp +++ b/kaddressbook/keywidget.cpp | |||
@@ -19,49 +19,51 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | 25 | ||
26 | #include <qinputdialog.h> | 26 | #include <qinputdialog.h> |
27 | 27 | ||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
31 | 33 | ||
32 | #ifndef KAB_EMBEDDED | 34 | #ifndef KAB_EMBEDDED |
33 | #include <kaccelmanager.h> | 35 | #include <kaccelmanager.h> |
34 | #include <kio/netaccess.h> | 36 | #include <kio/netaccess.h> |
35 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
36 | #else //KAB_EMBEDDED | 38 | #else //KAB_EMBEDDED |
37 | #include <qmap.h> | 39 | #include <qmap.h> |
38 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
39 | #include <qtextstream.h> | 41 | #include <q3textstream.h> |
40 | #include <kurl.h> | 42 | #include <kurl.h> |
41 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
42 | 44 | ||
43 | #include <kapplication.h> | 45 | #include <kapplication.h> |
44 | #include <kcombobox.h> | 46 | #include <kcombobox.h> |
45 | #include <kdialog.h> | 47 | #include <kdialog.h> |
46 | #include <kfiledialog.h> | 48 | #include <kfiledialog.h> |
47 | #include <klocale.h> | 49 | #include <klocale.h> |
48 | #include <ktempfile.h> | 50 | #include <ktempfile.h> |
49 | 51 | ||
50 | #include "keywidget.h" | 52 | #include "keywidget.h" |
51 | 53 | ||
52 | KeyWidget::KeyWidget( QWidget *parent, const char *name ) | 54 | KeyWidget::KeyWidget( QWidget *parent, const char *name ) |
53 | : QWidget( parent, name ) | 55 | : QWidget( parent, name ) |
54 | { | 56 | { |
55 | QGridLayout *layout = new QGridLayout( this, 2, 2, KDialog::marginHint(), | 57 | Q3GridLayout *layout = new Q3GridLayout( this, 2, 2, KDialog::marginHint(), |
56 | KDialog::spacingHint() ); | 58 | KDialog::spacingHint() ); |
57 | 59 | ||
58 | QLabel *label = new QLabel( i18n( "Keys:" ), this ); | 60 | QLabel *label = new QLabel( i18n( "Keys:" ), this ); |
59 | layout->addWidget( label, 0, 0 ); | 61 | layout->addWidget( label, 0, 0 ); |
60 | 62 | ||
61 | mKeyCombo = new KComboBox( this ); | 63 | mKeyCombo = new KComboBox( this ); |
62 | layout->addWidget( mKeyCombo, 0, 1 ); | 64 | layout->addWidget( mKeyCombo, 0, 1 ); |
63 | 65 | ||
64 | mAddButton = new QPushButton( i18n( "Add" ), this ); | 66 | mAddButton = new QPushButton( i18n( "Add" ), this ); |
65 | layout->addWidget( mAddButton, 1, 0 ); | 67 | layout->addWidget( mAddButton, 1, 0 ); |
66 | 68 | ||
67 | mRemoveButton = new QPushButton( i18n( "Remove" ), this ); | 69 | mRemoveButton = new QPushButton( i18n( "Remove" ), this ); |
@@ -127,55 +129,55 @@ void KeyWidget::addKey() | |||
127 | if ( !keyTypeNames.contains( name ) ) | 129 | if ( !keyTypeNames.contains( name ) ) |
128 | type = KABC::Key::Custom; | 130 | type = KABC::Key::Custom; |
129 | 131 | ||
130 | #ifndef KAB_EMBEDDED | 132 | #ifndef KAB_EMBEDDED |
131 | KURL url = KFileDialog::getOpenURL(); | 133 | KURL url = KFileDialog::getOpenURL(); |
132 | 134 | ||
133 | if ( url.isEmpty() ) | 135 | if ( url.isEmpty() ) |
134 | return; | 136 | return; |
135 | 137 | ||
136 | QString tmpFile; | 138 | QString tmpFile; |
137 | if ( KIO::NetAccess::download( url, tmpFile ) ) { | 139 | if ( KIO::NetAccess::download( url, tmpFile ) ) { |
138 | QFile file( tmpFile ); | 140 | QFile file( tmpFile ); |
139 | if ( !file.open( IO_ReadOnly ) ) { | 141 | if ( !file.open( QIODevice::ReadOnly ) ) { |
140 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 142 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
141 | KMessageBox::error( this, text.arg( url.url() ) ); | 143 | KMessageBox::error( this, text.arg( url.url() ) ); |
142 | return; | 144 | return; |
143 | } | 145 | } |
144 | 146 | ||
145 | 147 | ||
146 | #else //KAB_EMBEDDED | 148 | #else //KAB_EMBEDDED |
147 | QString keyfile = KFileDialog::getOpenFileName( "huhu", | 149 | QString keyfile = KFileDialog::getOpenFileName( "huhu", |
148 | "Select Key", this ); | 150 | "Select Key", this ); |
149 | 151 | ||
150 | if ( keyfile.isEmpty() ) | 152 | if ( keyfile.isEmpty() ) |
151 | return; | 153 | return; |
152 | 154 | ||
153 | { | 155 | { |
154 | QFile file( keyfile ); | 156 | QFile file( keyfile ); |
155 | if ( !file.open( IO_ReadOnly ) ) { | 157 | if ( !file.open( QIODevice::ReadOnly ) ) { |
156 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 158 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
157 | QString caption( i18n( "Error" ) ); | 159 | QString caption( i18n( "Error" ) ); |
158 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); | 160 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); |
159 | return; | 161 | return; |
160 | } | 162 | } |
161 | 163 | ||
162 | #endif //KAB_EMBEDDED | 164 | #endif //KAB_EMBEDDED |
163 | 165 | ||
164 | 166 | ||
165 | 167 | ||
166 | QTextStream s( &file ); | 168 | Q3TextStream s( &file ); |
167 | QString data; | 169 | QString data; |
168 | 170 | ||
169 | s.setEncoding( QTextStream::UnicodeUTF8 ); | 171 | s.setEncoding( Q3TextStream::UnicodeUTF8 ); |
170 | s >> data; | 172 | s >> data; |
171 | file.close(); | 173 | file.close(); |
172 | 174 | ||
173 | KABC::Key key( data, type ); | 175 | KABC::Key key( data, type ); |
174 | if ( type == KABC::Key::Custom ) | 176 | if ( type == KABC::Key::Custom ) |
175 | key.setCustomTypeString( name ); | 177 | key.setCustomTypeString( name ); |
176 | mKeyList.append( key ); | 178 | mKeyList.append( key ); |
177 | 179 | ||
178 | emit changed(); | 180 | emit changed(); |
179 | 181 | ||
180 | #ifndef KAB_EMBEDDED | 182 | #ifndef KAB_EMBEDDED |
181 | KIO::NetAccess::removeTempFile( tmpFile ); | 183 | KIO::NetAccess::removeTempFile( tmpFile ); |
@@ -212,47 +214,47 @@ void KeyWidget::removeKey() | |||
212 | 214 | ||
213 | updateKeyCombo(); | 215 | updateKeyCombo(); |
214 | } | 216 | } |
215 | 217 | ||
216 | void KeyWidget::exportKey() | 218 | void KeyWidget::exportKey() |
217 | { | 219 | { |
218 | KABC::Key key = (*mKeyList.at( mKeyCombo->currentItem() ) ); | 220 | KABC::Key key = (*mKeyList.at( mKeyCombo->currentItem() ) ); |
219 | 221 | ||
220 | #ifndef KAB_EMBEDDED | 222 | #ifndef KAB_EMBEDDED |
221 | KURL url = KFileDialog::getSaveURL(); | 223 | KURL url = KFileDialog::getSaveURL(); |
222 | 224 | ||
223 | KTempFile tempFile; | 225 | KTempFile tempFile; |
224 | QTextStream *s = tempFile.textStream(); | 226 | Q3TextStream *s = tempFile.textStream(); |
225 | s->setEncoding( QTextStream::UnicodeUTF8 ); | 227 | s->setEncoding( Q3TextStream::UnicodeUTF8 ); |
226 | (*s) << key.textData(); | 228 | (*s) << key.textData(); |
227 | tempFile.close(); | 229 | tempFile.close(); |
228 | 230 | ||
229 | KIO::NetAccess::upload( tempFile.name(), url, kapp->mainWidget() ); | 231 | KIO::NetAccess::upload( tempFile.name(), url, kapp->mainWidget() ); |
230 | #else //KAB_EMBEDDED | 232 | #else //KAB_EMBEDDED |
231 | QString keyfile = KFileDialog::getSaveFileName( "huhu", | 233 | QString keyfile = KFileDialog::getSaveFileName( "huhu", |
232 | "Save Key", this ); | 234 | "Save Key", this ); |
233 | 235 | ||
234 | if ( keyfile.isEmpty() ) | 236 | if ( keyfile.isEmpty() ) |
235 | return; | 237 | return; |
236 | 238 | ||
237 | QFile file( keyfile ); | 239 | QFile file( keyfile ); |
238 | if ( !file.open( IO_ReadWrite ) ) { | 240 | if ( !file.open( QIODevice::ReadWrite ) ) { |
239 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); | 241 | QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) ); |
240 | QString caption( i18n( "Error" ) ); | 242 | QString caption( i18n( "Error" ) ); |
241 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); | 243 | QMessageBox::critical( this, caption, text.arg( keyfile ) ); |
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
245 | QTextStream s( &file ); | 247 | Q3TextStream s( &file ); |
246 | s.setEncoding( QTextStream::UnicodeUTF8 ); | 248 | s.setEncoding( Q3TextStream::UnicodeUTF8 ); |
247 | s << key.textData(); | 249 | s << key.textData(); |
248 | file.close(); | 250 | file.close(); |
249 | 251 | ||
250 | 252 | ||
251 | #endif //KAB_EMBEDDED | 253 | #endif //KAB_EMBEDDED |
252 | 254 | ||
253 | } | 255 | } |
254 | 256 | ||
255 | void KeyWidget::updateKeyCombo() | 257 | void KeyWidget::updateKeyCombo() |
256 | { | 258 | { |
257 | int pos = mKeyCombo->currentItem(); | 259 | int pos = mKeyCombo->currentItem(); |
258 | mKeyCombo->clear(); | 260 | mKeyCombo->clear(); |
@@ -263,15 +265,15 @@ void KeyWidget::updateKeyCombo() | |||
263 | mKeyCombo->insertItem( (*it).customTypeString() ); | 265 | mKeyCombo->insertItem( (*it).customTypeString() ); |
264 | else | 266 | else |
265 | mKeyCombo->insertItem( KABC::Key::typeLabel( (*it).type() ) ); | 267 | mKeyCombo->insertItem( KABC::Key::typeLabel( (*it).type() ) ); |
266 | } | 268 | } |
267 | 269 | ||
268 | mKeyCombo->setCurrentItem( pos ); | 270 | mKeyCombo->setCurrentItem( pos ); |
269 | 271 | ||
270 | bool state = ( mKeyList.count() != 0 ); | 272 | bool state = ( mKeyList.count() != 0 ); |
271 | mRemoveButton->setEnabled( state ); | 273 | mRemoveButton->setEnabled( state ); |
272 | mExportButton->setEnabled( state ); | 274 | mExportButton->setEnabled( state ); |
273 | } | 275 | } |
274 | 276 | ||
275 | #ifndef KAB_EMBEDDED | 277 | #ifndef KAB_EMBEDDED_ |
276 | #include "keywidget.moc" | 278 | #include "moc_keywidget.cpp" |
277 | #endif //KAB_EMBEDDED | 279 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 2f3531d..e373105 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,44 +1,43 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <q3mainwindow.h> |
9 | #include <qmainwindow.h> | ||
10 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
11 | #include <stdlib.h> | 10 | #include <stdlib.h> |
12 | #endif | 11 | #endif |
13 | 12 | ||
14 | #include <qtextcodec.h> | 13 | #include <qtextcodec.h> |
15 | #include <kstandarddirs.h> | 14 | #include <kstandarddirs.h> |
16 | #include <qregexp.h> | 15 | #include <qregexp.h> |
17 | #include <kglobal.h> | 16 | #include <kglobal.h> |
18 | #include <stdio.h> | 17 | #include <stdio.h> |
19 | #include <qdir.h> | 18 | #include <qdir.h> |
20 | #include "kabprefs.h" | 19 | #include "kabprefs.h" |
21 | #include "kaddressbookmain.h" | 20 | #include "kaddressbookmain.h" |
22 | #include "externalapphandler.h" | 21 | #include "externalapphandler.h" |
23 | #include <libkdepim/kpimglobalprefs.h> | 22 | #include <libkdepim/kpimglobalprefs.h> |
24 | void dumpMissing(); | 23 | void dumpMissing(); |
25 | int main( int argc, char **argv ) | 24 | int main( int argc, char **argv ) |
26 | { | 25 | { |
26 | if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi"); | ||
27 | #ifndef DESKTOP_VERSION | 27 | #ifndef DESKTOP_VERSION |
28 | QPEApplication a( argc, argv ); | 28 | QPEApplication a( argc, argv ); |
29 | a.setKeepRunning (); | 29 | a.setKeepRunning (); |
30 | #else | 30 | #else |
31 | QApplication a( argc, argv ); | 31 | QApplication a( argc, argv ); |
32 | QApplication::setStyle( new QPlatinumStyle ()); | ||
33 | #ifdef _WIN32_ | 32 | #ifdef _WIN32_ |
34 | QString hdir ( getenv( "HOME") ); | 33 | QString hdir ( getenv( "HOME") ); |
35 | if ( hdir.isEmpty() ) { | 34 | if ( hdir.isEmpty() ) { |
36 | QString hd ("C:/" ); | 35 | QString hd ("C:/" ); |
37 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); | 36 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); |
38 | if ( QDir::homeDirPath().lower() == hd.lower() ) { | 37 | if ( QDir::homeDirPath().lower() == hd.lower() ) { |
39 | _putenv( "HOME=C:"); | 38 | _putenv( "HOME=C:"); |
40 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); | 39 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); |
41 | } | 40 | } |
42 | } else { | 41 | } else { |
43 | QDir app_dir; | 42 | QDir app_dir; |
44 | if ( !app_dir.exists(hdir) ) | 43 | if ( !app_dir.exists(hdir) ) |
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index 199f3d6..96822d8 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp | |||
@@ -14,30 +14,32 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qlistbox.h> | 26 | #include <q3listbox.h> |
27 | #include <qlistview.h> | 27 | #include <q3listview.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3GridLayout> | ||
32 | 34 | ||
33 | #ifndef KAB_EMBEDDED | 35 | #ifndef KAB_EMBEDDED |
34 | #include <kaccelmanager.h> | 36 | #include <kaccelmanager.h> |
35 | #else //KAB_EMBEDDED | 37 | #else //KAB_EMBEDDED |
36 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
37 | #endif //KAB_EMBEDDED | 39 | #endif //KAB_EMBEDDED |
38 | 40 | ||
39 | #include <kapplication.h> | 41 | #include <kapplication.h> |
40 | #include <kbuttonbox.h> | 42 | #include <kbuttonbox.h> |
41 | #include <kconfig.h> | 43 | #include <kconfig.h> |
42 | #include <klineedit.h> | 44 | #include <klineedit.h> |
43 | #include <klistview.h> | 45 | #include <klistview.h> |
@@ -48,25 +50,25 @@ | |||
48 | #include <kiconloader.h> | 50 | #include <kiconloader.h> |
49 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
50 | 52 | ||
51 | #include "nameeditdialog.h" | 53 | #include "nameeditdialog.h" |
52 | 54 | ||
53 | NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, | 55 | NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, |
54 | QWidget *parent, const char *name ) | 56 | QWidget *parent, const char *name ) |
55 | : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel, |
56 | Ok, parent, name, true ) | 58 | Ok, parent, name, true ) |
57 | { | 59 | { |
58 | 60 | ||
59 | QWidget *page = plainPage(); | 61 | QWidget *page = plainPage(); |
60 | QGridLayout *layout = new QGridLayout( page, 5, 3 ); | 62 | Q3GridLayout *layout = new Q3GridLayout( page, 5, 3 ); |
61 | layout->setSpacing( spacingHint() ); | 63 | layout->setSpacing( spacingHint() ); |
62 | layout->addColSpacing( 2, 100 ); | 64 | layout->addColSpacing( 2, 100 ); |
63 | QLabel *label; | 65 | QLabel *label; |
64 | 66 | ||
65 | label = new QLabel( i18n( "Honorific prefixes:" ), page ); | 67 | label = new QLabel( i18n( "Honorific prefixes:" ), page ); |
66 | layout->addWidget( label, 0, 0 ); | 68 | layout->addWidget( label, 0, 0 ); |
67 | mPrefixCombo = new KComboBox( page ); | 69 | mPrefixCombo = new KComboBox( page ); |
68 | mPrefixCombo->setDuplicatesEnabled( false ); | 70 | mPrefixCombo->setDuplicatesEnabled( false ); |
69 | mPrefixCombo->setEditable( true ); | 71 | mPrefixCombo->setEditable( true ); |
70 | label->setBuddy( mPrefixCombo ); | 72 | label->setBuddy( mPrefixCombo ); |
71 | layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 ); | 73 | layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 ); |
72 | 74 | ||
@@ -286,15 +288,15 @@ void NameEditDialog::updateTypeCombo() | |||
286 | mFormattedNameCombo->setCurrentItem( pos ); | 288 | mFormattedNameCombo->setCurrentItem( pos ); |
287 | } | 289 | } |
288 | 290 | ||
289 | void NameEditDialog::slotHelp() | 291 | void NameEditDialog::slotHelp() |
290 | { | 292 | { |
291 | #ifndef KAB_EMBEDDED | 293 | #ifndef KAB_EMBEDDED |
292 | kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); | 294 | kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); |
293 | #else //KAB_EMBEDDED | 295 | #else //KAB_EMBEDDED |
294 | qDebug("NameEditDialog::slotHelp Help is not supported yet"); | 296 | qDebug("NameEditDialog::slotHelp Help is not supported yet"); |
295 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
296 | } | 298 | } |
297 | 299 | ||
298 | #ifndef KAB_EMBEDDED | 300 | #ifndef KAB_EMBEDDED_ |
299 | #include "nameeditdialog.moc" | 301 | #include "moc_nameeditdialog.cpp" |
300 | #endif //KAB_EMBEDDED | 302 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/old_mainwindow.cpp b/kaddressbook/old_mainwindow.cpp index 0e886d9..7a445c7 100644 --- a/kaddressbook/old_mainwindow.cpp +++ b/kaddressbook/old_mainwindow.cpp | |||
@@ -307,31 +307,31 @@ QPixmap MainWindow::loadPixmap( QString name ) | |||
307 | return pixmapLoader; | 307 | return pixmapLoader; |
308 | #else | 308 | #else |
309 | return Resource::loadPixmap( name ); | 309 | return Resource::loadPixmap( name ); |
310 | #endif | 310 | #endif |
311 | */ | 311 | */ |
312 | } | 312 | } |
313 | 313 | ||
314 | void MainWindow::initActions() | 314 | void MainWindow::initActions() |
315 | { | 315 | { |
316 | iconToolBar->clear(); | 316 | iconToolBar->clear(); |
317 | KABPrefs *p = KABPrefs::instance(); | 317 | KABPrefs *p = KABPrefs::instance(); |
318 | QPEMenuBar *menuBar1 = new QPEMenuBar( iconToolBar ); | 318 | QPEMenuBar *menuBar1 = new QPEMenuBar( iconToolBar ); |
319 | QPopupMenu *menuBar = new QPopupMenu( this ); | 319 | Q3PopupMenu *menuBar = new Q3PopupMenu( this ); |
320 | menuBar1->insertItem( "ME", menuBar); | 320 | menuBar1->insertItem( "ME", menuBar); |
321 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 321 | Q3PopupMenu *fileMenu = new Q3PopupMenu( this ); |
322 | QPopupMenu *editMenu = new QPopupMenu( this ); | 322 | Q3PopupMenu *editMenu = new Q3PopupMenu( this ); |
323 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 323 | Q3PopupMenu *viewMenu = new Q3PopupMenu( this ); |
324 | QPopupMenu *settingsMenu = new QPopupMenu( this ); | 324 | Q3PopupMenu *settingsMenu = new Q3PopupMenu( this ); |
325 | QPopupMenu *importMenu = new QPopupMenu( this ); | 325 | Q3PopupMenu *importMenu = new Q3PopupMenu( this ); |
326 | 326 | ||
327 | menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 327 | menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
328 | 328 | ||
329 | QIconSet icon; | 329 | QIconSet icon; |
330 | 330 | ||
331 | 331 | ||
332 | icon = loadPixmap( pathString + "newtodo" ); | 332 | icon = loadPixmap( pathString + "newtodo" ); |
333 | configureToolBarMenu->insertItem(icon, "New todo", 20 ); | 333 | configureToolBarMenu->insertItem(icon, "New todo", 20 ); |
334 | QAction* nt_action = new QAction( "New Todo", icon, "New Todo...", 0, this ); | 334 | QAction* nt_action = new QAction( "New Todo", icon, "New Todo...", 0, this ); |
335 | nt_action->addTo( actionMenu ); | 335 | nt_action->addTo( actionMenu ); |
336 | connect( nt_action, SIGNAL( activated() ), | 336 | connect( nt_action, SIGNAL( activated() ), |
337 | mView, SLOT( newTodo() ) ); | 337 | mView, SLOT( newTodo() ) ); |
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index df3b551..3661677 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -18,88 +18,94 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | #include <qlistbox.h> | 30 | #include <q3listbox.h> |
31 | #include <qlistview.h> | 31 | #include <q3listview.h> |
32 | #include <qbuttongroup.h> | 32 | #include <q3buttongroup.h> |
33 | #include <qhbox.h> | 33 | #include <q3hbox.h> |
34 | #include <qcursor.h> | 34 | #include <qcursor.h> |
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | //Added by qt3to4: | ||
38 | #include <Q3ValueList> | ||
39 | #include <Q3GridLayout> | ||
40 | #include <Q3Frame> | ||
41 | #include <Q3PopupMenu> | ||
42 | #include <Q3VBoxLayout> | ||
37 | 43 | ||
38 | #include <kbuttonbox.h> | 44 | #include <kbuttonbox.h> |
39 | #include <klistview.h> | 45 | #include <klistview.h> |
40 | #include <kapplication.h> | 46 | #include <kapplication.h> |
41 | #include <qapplication.h> | 47 | #include <qapplication.h> |
42 | #include <kconfig.h> | 48 | #include <kconfig.h> |
43 | #include <kmessagebox.h> | 49 | #include <kmessagebox.h> |
44 | #include <klineedit.h> | 50 | #include <klineedit.h> |
45 | #include <kcombobox.h> | 51 | #include <kcombobox.h> |
46 | #include <klocale.h> | 52 | #include <klocale.h> |
47 | #include <kdebug.h> | 53 | #include <kdebug.h> |
48 | #include <kglobal.h> | 54 | #include <kglobal.h> |
49 | #include <kiconloader.h> | 55 | #include <kiconloader.h> |
50 | 56 | ||
51 | #include <kabc/phonenumber.h> | 57 | #include <kabc/phonenumber.h> |
52 | 58 | ||
53 | #include "typecombo.h" | 59 | #include "typecombo.h" |
54 | 60 | ||
55 | #include "phoneeditwidget.h" | 61 | #include "phoneeditwidget.h" |
56 | 62 | ||
57 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 63 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
58 | : QWidget(parent,name) | 64 | : QWidget(parent,name) |
59 | { | 65 | { |
60 | QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); | 66 | Q3GridLayout* gridLayout = new Q3GridLayout ( this, 2,2 ); |
61 | 67 | ||
62 | QLabel *temp = new QLabel( "", this ); | 68 | QLabel *temp = new QLabel( "", this ); |
63 | temp->setAlignment( Qt::AlignCenter ); | 69 | temp->setAlignment( Qt::AlignCenter ); |
64 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 70 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
65 | QPushButton *addBut = new QPushButton ( "add", this ); | 71 | QPushButton *addBut = new QPushButton ( "add", this ); |
66 | addBut->setPixmap ( SmallIcon("plus")); | 72 | addBut->setPixmap ( SmallIcon("plus")); |
67 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | 73 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); |
68 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); | 74 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); |
69 | 75 | ||
70 | sv = new QScrollView( this ); | 76 | sv = new Q3ScrollView( this ); |
71 | sv->setFrameStyle ( QFrame::Plain ); | 77 | sv->setFrameStyle ( Q3Frame::Plain ); |
72 | sv->setLineWidth ( 0 ); | 78 | sv->setLineWidth ( 0 ); |
73 | sv->setMidLineWidth ( 0 ); | 79 | sv->setMidLineWidth ( 0 ); |
74 | mw = new QWidget ( sv->viewport() ); | 80 | mw = new QWidget ( sv->viewport() ); |
75 | sv->addChild(mw); | 81 | sv->addChild(mw); |
76 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 82 | sv->setResizePolicy( Q3ScrollView::AutoOneFit ); |
77 | mainLayout = new QVBoxLayout ( mw ); | 83 | mainLayout = new Q3VBoxLayout ( mw ); |
78 | mainLayout->setMargin( 0 ); | 84 | mainLayout->setMargin( 0 ); |
79 | mainLayout->setSpacing( 0 ); | 85 | mainLayout->setSpacing( 0 ); |
80 | gridLayout->setMargin( 2 ); | 86 | gridLayout->setMargin( 2 ); |
81 | gridLayout->setSpacing( 4 ); | 87 | gridLayout->setSpacing( 4 ); |
82 | if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) { | 88 | if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) { |
83 | gridLayout->addWidget( addBut, 0, 0 ); | 89 | gridLayout->addWidget( addBut, 0, 0 ); |
84 | gridLayout->addWidget( temp, 0, 1 ); | 90 | gridLayout->addWidget( temp, 0, 1 ); |
85 | gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 ); | 91 | gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 ); |
86 | } else { | 92 | } else { |
87 | gridLayout->addWidget( temp, 1, 0 ); | 93 | gridLayout->addWidget( temp, 1, 0 ); |
88 | gridLayout->addWidget( addBut, 0, 0 ); | 94 | gridLayout->addWidget( addBut, 0, 0 ); |
89 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); | 95 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); |
90 | } | 96 | } |
91 | setDefaults(); | 97 | setDefaults(); |
92 | mTypeNumberEditList.setAutoDelete( true ); | 98 | mTypeNumberEditList.setAutoDelete( true ); |
93 | mPopup = new QPopupMenu( this ); | 99 | mPopup = new Q3PopupMenu( this ); |
94 | QStringList list = PhoneNumber::supportedTypeListNames(); | 100 | QStringList list = PhoneNumber::supportedTypeListNames(); |
95 | mPopupCount = list.count(); | 101 | mPopupCount = list.count(); |
96 | int i = 0; | 102 | int i = 0; |
97 | while ( i < mPopupCount ) { | 103 | while ( i < mPopupCount ) { |
98 | mPopup->insertItem( list[ i ], i ); | 104 | mPopup->insertItem( list[ i ], i ); |
99 | ++i; | 105 | ++i; |
100 | } | 106 | } |
101 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); | 107 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); |
102 | 108 | ||
103 | } | 109 | } |
104 | 110 | ||
105 | PhoneEditWidget::~PhoneEditWidget() | 111 | PhoneEditWidget::~PhoneEditWidget() |
@@ -217,35 +223,35 @@ KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() | |||
217 | retList.append( edit->phoneNumber()); | 223 | retList.append( edit->phoneNumber()); |
218 | } | 224 | } |
219 | edit = mTypeNumberEditList.next(); | 225 | edit = mTypeNumberEditList.next(); |
220 | 226 | ||
221 | } | 227 | } |
222 | return retList; | 228 | return retList; |
223 | } | 229 | } |
224 | 230 | ||
225 | #if 0 | 231 | #if 0 |
226 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 232 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
227 | : QWidget( parent, name ) | 233 | : QWidget( parent, name ) |
228 | { | 234 | { |
229 | QGridLayout *layout = new QGridLayout( this, 4, 1 ); | 235 | Q3GridLayout *layout = new Q3GridLayout( this, 4, 1 ); |
230 | //US layout->setSpacing( KDialog::spacingHint() ); | 236 | //US layout->setSpacing( KDialog::spacingHint() ); |
231 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 237 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
232 | 238 | ||
233 | 239 | ||
234 | 240 | ||
235 | QLabel* label = new QLabel( this ); | 241 | QLabel* label = new QLabel( this ); |
236 | //US loadIcon call is ambiguous. Add one more parameter | 242 | //US loadIcon call is ambiguous. Add one more parameter |
237 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); | 243 | //US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) ); |
238 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | 244 | label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
239 | label->setAlignment( AlignCenter ); | 245 | label->setAlignment( Qt::AlignCenter ); |
240 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); | 246 | //US layout->addMultiCellWidget( label, 0, 1, 3, 3 ); |
241 | layout->addWidget( label, 0, 0 ); | 247 | layout->addWidget( label, 0, 0 ); |
242 | 248 | ||
243 | QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ), | 249 | QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ), |
244 | this ); | 250 | this ); |
245 | if ( QApplication::desktop()->width() < 640 ) | 251 | if ( QApplication::desktop()->width() < 640 ) |
246 | layout->addWidget( editButton, 0, 1 ); | 252 | layout->addWidget( editButton, 0, 1 ); |
247 | else | 253 | else |
248 | layout->addMultiCellWidget( editButton, 0, 0, 1, 3); | 254 | layout->addMultiCellWidget( editButton, 0, 0, 1, 3); |
249 | 255 | ||
250 | mPrefCombo = new PhoneTypeCombo( mPhoneList, this ); | 256 | mPrefCombo = new PhoneTypeCombo( mPhoneList, this ); |
251 | mPrefEdit = new KLineEdit( this ); | 257 | mPrefEdit = new KLineEdit( this ); |
@@ -318,35 +324,35 @@ PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | |||
318 | 324 | ||
319 | PhoneEditWidget::~PhoneEditWidget() | 325 | PhoneEditWidget::~PhoneEditWidget() |
320 | { | 326 | { |
321 | } | 327 | } |
322 | 328 | ||
323 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list ) | 329 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list ) |
324 | { | 330 | { |
325 | mPhoneList.clear(); | 331 | mPhoneList.clear(); |
326 | 332 | ||
327 | // Insert types for existing numbers. | 333 | // Insert types for existing numbers. |
328 | mPrefCombo->insertTypeList( list ); | 334 | mPrefCombo->insertTypeList( list ); |
329 | 335 | ||
330 | QValueList<int> defaultTypes; | 336 | Q3ValueList<int> defaultTypes; |
331 | defaultTypes << KABC::PhoneNumber::Home; | 337 | defaultTypes << KABC::PhoneNumber::Home; |
332 | defaultTypes << KABC::PhoneNumber::Work; | 338 | defaultTypes << KABC::PhoneNumber::Work; |
333 | defaultTypes << KABC::PhoneNumber::Cell; | 339 | defaultTypes << KABC::PhoneNumber::Cell; |
334 | defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); | 340 | defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); |
335 | defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); | 341 | defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); |
336 | 342 | ||
337 | // Insert default types. | 343 | // Insert default types. |
338 | // Doing this for mPrefCombo is enough because the list is shared by all | 344 | // Doing this for mPrefCombo is enough because the list is shared by all |
339 | // combos. | 345 | // combos. |
340 | QValueList<int>::ConstIterator it; | 346 | Q3ValueList<int>::ConstIterator it; |
341 | for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { | 347 | for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) { |
342 | if ( !mPrefCombo->hasType( *it ) ) | 348 | if ( !mPrefCombo->hasType( *it ) ) |
343 | mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) ); | 349 | mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) ); |
344 | } | 350 | } |
345 | 351 | ||
346 | updateCombos(); | 352 | updateCombos(); |
347 | 353 | ||
348 | mPrefCombo->selectType( defaultTypes[ 0 ] ); | 354 | mPrefCombo->selectType( defaultTypes[ 0 ] ); |
349 | mSecondCombo->selectType( defaultTypes[ 1 ] ); | 355 | mSecondCombo->selectType( defaultTypes[ 1 ] ); |
350 | mThirdCombo->selectType( defaultTypes[ 2 ] ); | 356 | mThirdCombo->selectType( defaultTypes[ 2 ] ); |
351 | mFourthCombo->selectType( defaultTypes[ 3 ] ); | 357 | mFourthCombo->selectType( defaultTypes[ 3 ] ); |
352 | 358 | ||
@@ -478,50 +484,50 @@ void PhoneEditWidget::updatePhoneNumber( PhoneTypeCombo *combo ) | |||
478 | void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ) | 484 | void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ) |
479 | { | 485 | { |
480 | if ( combo == otherCombo ) return; | 486 | if ( combo == otherCombo ) return; |
481 | 487 | ||
482 | if ( combo->currentItem() == otherCombo->currentItem() ) { | 488 | if ( combo->currentItem() == otherCombo->currentItem() ) { |
483 | updateEdit( otherCombo ); | 489 | updateEdit( otherCombo ); |
484 | } | 490 | } |
485 | } | 491 | } |
486 | 492 | ||
487 | /////////////////////////////////////////// | 493 | /////////////////////////////////////////// |
488 | // PhoneEditDialog | 494 | // PhoneEditDialog |
489 | 495 | ||
490 | class PhoneViewItem : public QListViewItem | 496 | class PhoneViewItem : public Q3ListViewItem |
491 | { | 497 | { |
492 | public: | 498 | public: |
493 | PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number ); | 499 | PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number ); |
494 | 500 | ||
495 | void setPhoneNumber( const KABC::PhoneNumber &number ) | 501 | void setPhoneNumber( const KABC::PhoneNumber &number ) |
496 | { | 502 | { |
497 | mPhoneNumber = number; | 503 | mPhoneNumber = number; |
498 | makeText(); | 504 | makeText(); |
499 | } | 505 | } |
500 | 506 | ||
501 | QString key() { return mPhoneNumber.id(); } | 507 | QString key() { return mPhoneNumber.id(); } |
502 | QString country() { return ""; } | 508 | QString country() { return ""; } |
503 | QString region() { return ""; } | 509 | QString region() { return ""; } |
504 | QString number() { return ""; } | 510 | QString number() { return ""; } |
505 | 511 | ||
506 | KABC::PhoneNumber phoneNumber() { return mPhoneNumber; } | 512 | KABC::PhoneNumber phoneNumber() { return mPhoneNumber; } |
507 | 513 | ||
508 | private: | 514 | private: |
509 | void makeText(); | 515 | void makeText(); |
510 | 516 | ||
511 | KABC::PhoneNumber mPhoneNumber; | 517 | KABC::PhoneNumber mPhoneNumber; |
512 | }; | 518 | }; |
513 | 519 | ||
514 | PhoneViewItem::PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number ) | 520 | PhoneViewItem::PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number ) |
515 | : QListViewItem( parent ), mPhoneNumber( number ) | 521 | : Q3ListViewItem( parent ), mPhoneNumber( number ) |
516 | { | 522 | { |
517 | #ifdef DESKTOP_VERSION | 523 | #ifdef DESKTOP_VERSION |
518 | setRenameEnabled ( 0, true ); | 524 | setRenameEnabled ( 0, true ); |
519 | #endif | 525 | #endif |
520 | makeText(); | 526 | makeText(); |
521 | } | 527 | } |
522 | 528 | ||
523 | void PhoneViewItem::makeText() | 529 | void PhoneViewItem::makeText() |
524 | { | 530 | { |
525 | /** | 531 | /** |
526 | * Will be used in future versions of kaddressbook/libkabc | 532 | * Will be used in future versions of kaddressbook/libkabc |
527 | 533 | ||
@@ -535,69 +541,69 @@ void PhoneViewItem::makeText() | |||
535 | setText( 1, mPhoneNumber.typeLabel() ); | 541 | setText( 1, mPhoneNumber.typeLabel() ); |
536 | } | 542 | } |
537 | 543 | ||
538 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) | 544 | PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name ) |
539 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), | 545 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ), |
540 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 546 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
541 | parent, name, true) | 547 | parent, name, true) |
542 | { | 548 | { |
543 | mPhoneNumberList = list; | 549 | mPhoneNumberList = list; |
544 | 550 | ||
545 | QWidget *page = plainPage(); | 551 | QWidget *page = plainPage(); |
546 | 552 | ||
547 | QGridLayout *layout = new QGridLayout( page, 1, 2 ); | 553 | Q3GridLayout *layout = new Q3GridLayout( page, 1, 2 ); |
548 | layout->setSpacing( spacingHint() ); | 554 | layout->setSpacing( spacingHint() ); |
549 | 555 | ||
550 | mListView = new KListView( page ); | 556 | mListView = new KListView( page ); |
551 | mListView->setAllColumnsShowFocus( true ); | 557 | mListView->setAllColumnsShowFocus( true ); |
552 | mListView->addColumn( i18n( "Number" ) ); | 558 | mListView->addColumn( i18n( "Number" ) ); |
553 | mListView->addColumn( i18n( "Type" ) ); | 559 | mListView->addColumn( i18n( "Type" ) ); |
554 | 560 | ||
555 | KButtonBox *buttonBox = new KButtonBox( page, Vertical ); | 561 | KButtonBox *buttonBox = new KButtonBox( page, Qt::Vertical ); |
556 | 562 | ||
557 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); | 563 | buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) ); |
558 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); | 564 | mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) ); |
559 | mEditButton->setEnabled( false ); | 565 | mEditButton->setEnabled( false ); |
560 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); | 566 | mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) ); |
561 | mRemoveButton->setEnabled( false ); | 567 | mRemoveButton->setEnabled( false ); |
562 | buttonBox->layout(); | 568 | buttonBox->layout(); |
563 | 569 | ||
564 | layout->addWidget( mListView, 0, 0 ); | 570 | layout->addWidget( mListView, 0, 0 ); |
565 | layout->addWidget( buttonBox, 0, 1 ); | 571 | layout->addWidget( buttonBox, 0, 1 ); |
566 | 572 | ||
567 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); | 573 | connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); |
568 | connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); | 574 | connect( mListView, SIGNAL(doubleClicked( Q3ListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber())); |
569 | 575 | ||
570 | KABC::PhoneNumber::List::Iterator it; | 576 | KABC::PhoneNumber::List::Iterator it; |
571 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) | 577 | for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it ) |
572 | new PhoneViewItem( mListView, *it ); | 578 | new PhoneViewItem( mListView, *it ); |
573 | if (QApplication::desktop()->width() < 480 ) | 579 | if (QApplication::desktop()->width() < 480 ) |
574 | showMaximized(); | 580 | showMaximized(); |
575 | else | 581 | else |
576 | resize( 400, 400 ); | 582 | resize( 400, 400 ); |
577 | mChanged = false; | 583 | mChanged = false; |
578 | } | 584 | } |
579 | 585 | ||
580 | PhoneEditDialog::~PhoneEditDialog() | 586 | PhoneEditDialog::~PhoneEditDialog() |
581 | { | 587 | { |
582 | qDebug("PhoneEditDialog::~PhoneEditDialog() "); | 588 | qDebug("PhoneEditDialog::~PhoneEditDialog() "); |
583 | } | 589 | } |
584 | 590 | ||
585 | void PhoneEditDialog::slotAddPhoneNumber() | 591 | void PhoneEditDialog::slotAddPhoneNumber() |
586 | { | 592 | { |
587 | KABC::PhoneNumber tmp( "", 0 ); | 593 | KABC::PhoneNumber tmp( "", 0 ); |
588 | PhoneTypeDialog dlg( tmp, this ); | 594 | PhoneTypeDialog dlg( tmp, this ); |
589 | 595 | ||
590 | if ( dlg.exec() ) { | 596 | if ( dlg.exec() ) { |
591 | QListViewItem* i = mListView->firstChild(); | 597 | Q3ListViewItem* i = mListView->firstChild(); |
592 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); | 598 | KABC::PhoneNumber phoneNumber = dlg.phoneNumber(); |
593 | bool insert = true; | 599 | bool insert = true; |
594 | while ( i ) { | 600 | while ( i ) { |
595 | PhoneViewItem* p = ( PhoneViewItem* ) i; | 601 | PhoneViewItem* p = ( PhoneViewItem* ) i; |
596 | KABC::PhoneNumber pn = p->phoneNumber(); | 602 | KABC::PhoneNumber pn = p->phoneNumber(); |
597 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { | 603 | if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) { |
598 | if ( p->text(0).isEmpty()) { | 604 | if ( p->text(0).isEmpty()) { |
599 | p->setPhoneNumber( phoneNumber ); | 605 | p->setPhoneNumber( phoneNumber ); |
600 | mPhoneNumberList.remove( pn ); | 606 | mPhoneNumberList.remove( pn ); |
601 | mPhoneNumberList.append( phoneNumber ); | 607 | mPhoneNumberList.append( phoneNumber ); |
602 | insert = false; | 608 | insert = false; |
603 | break; | 609 | break; |
@@ -611,25 +617,25 @@ void PhoneEditDialog::slotAddPhoneNumber() | |||
611 | } | 617 | } |
612 | mChanged = true; | 618 | mChanged = true; |
613 | } | 619 | } |
614 | } | 620 | } |
615 | 621 | ||
616 | void PhoneEditDialog::slotRemovePhoneNumber() | 622 | void PhoneEditDialog::slotRemovePhoneNumber() |
617 | { | 623 | { |
618 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); | 624 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); |
619 | if ( !item ) | 625 | if ( !item ) |
620 | return; | 626 | return; |
621 | 627 | ||
622 | mPhoneNumberList.remove( item->phoneNumber() ); | 628 | mPhoneNumberList.remove( item->phoneNumber() ); |
623 | QListViewItem *currItem = mListView->currentItem(); | 629 | Q3ListViewItem *currItem = mListView->currentItem(); |
624 | mListView->takeItem( currItem ); | 630 | mListView->takeItem( currItem ); |
625 | delete currItem; | 631 | delete currItem; |
626 | 632 | ||
627 | mChanged = true; | 633 | mChanged = true; |
628 | } | 634 | } |
629 | 635 | ||
630 | void PhoneEditDialog::slotEditPhoneNumber() | 636 | void PhoneEditDialog::slotEditPhoneNumber() |
631 | { | 637 | { |
632 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); | 638 | PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() ); |
633 | if ( !item ) | 639 | if ( !item ) |
634 | return; | 640 | return; |
635 | 641 | ||
@@ -664,35 +670,35 @@ bool PhoneEditDialog::changed() const | |||
664 | } | 670 | } |
665 | 671 | ||
666 | /////////////////////////////////////////// | 672 | /////////////////////////////////////////// |
667 | // PhoneTypeDialog | 673 | // PhoneTypeDialog |
668 | PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, | 674 | PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, |
669 | QWidget *parent, const char *name) | 675 | QWidget *parent, const char *name) |
670 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ), | 676 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ), |
671 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, | 677 | KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, |
672 | parent, name, true), mPhoneNumber( phoneNumber ) | 678 | parent, name, true), mPhoneNumber( phoneNumber ) |
673 | { | 679 | { |
674 | QWidget *page = plainPage(); | 680 | QWidget *page = plainPage(); |
675 | QLabel *label = 0; | 681 | QLabel *label = 0; |
676 | QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() ); | 682 | Q3GridLayout *layout = new Q3GridLayout( page, 3, 2, marginHint(), spacingHint() ); |
677 | 683 | ||
678 | label = new QLabel( i18n( "Number:" ), page ); | 684 | label = new QLabel( i18n( "Number:" ), page ); |
679 | layout->addWidget( label, 0, 0 ); | 685 | layout->addWidget( label, 0, 0 ); |
680 | mNumber = new KLineEdit( page ); | 686 | mNumber = new KLineEdit( page ); |
681 | layout->addWidget( mNumber, 0, 1 ); | 687 | layout->addWidget( mNumber, 0, 1 ); |
682 | 688 | ||
683 | mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page ); | 689 | mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page ); |
684 | layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 ); | 690 | layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 ); |
685 | 691 | ||
686 | mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page ); | 692 | mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Types" ), page ); |
687 | layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 ); | 693 | layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 ); |
688 | 694 | ||
689 | // fill widgets | 695 | // fill widgets |
690 | mNumber->setText( mPhoneNumber.number() ); | 696 | mNumber->setText( mPhoneNumber.number() ); |
691 | 697 | ||
692 | mTypeList = KABC::PhoneNumber::typeList(); | 698 | mTypeList = KABC::PhoneNumber::typeList(); |
693 | mTypeList.remove( KABC::PhoneNumber::Pref ); | 699 | mTypeList.remove( KABC::PhoneNumber::Pref ); |
694 | 700 | ||
695 | KABC::PhoneNumber::TypeList::Iterator it; | 701 | KABC::PhoneNumber::TypeList::Iterator it; |
696 | for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) | 702 | for ( it = mTypeList.begin(); it != mTypeList.end(); ++it ) |
697 | new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup ); | 703 | new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup ); |
698 | 704 | ||
@@ -717,15 +723,15 @@ KABC::PhoneNumber PhoneTypeDialog::phoneNumber() | |||
717 | if ( box->isChecked() ) | 723 | if ( box->isChecked() ) |
718 | type += mTypeList[ i ]; | 724 | type += mTypeList[ i ]; |
719 | } | 725 | } |
720 | 726 | ||
721 | if ( mPreferredBox->isChecked() ) | 727 | if ( mPreferredBox->isChecked() ) |
722 | mPhoneNumber.setType( type | KABC::PhoneNumber::Pref ); | 728 | mPhoneNumber.setType( type | KABC::PhoneNumber::Pref ); |
723 | else | 729 | else |
724 | mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref ); | 730 | mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref ); |
725 | 731 | ||
726 | return mPhoneNumber; | 732 | return mPhoneNumber; |
727 | } | 733 | } |
728 | #endif | 734 | #endif |
729 | #ifndef KAB_EMBEDDED | 735 | #ifndef KAB_EMBEDDED_ |
730 | #include "phoneeditwidget.moc" | 736 | #include "moc_phoneeditwidget.cpp" |
731 | #endif //KAB_EMBEDDED | 737 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index 5bb4226..2be3e2b 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -18,34 +18,38 @@ | |||
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qpopupmenu.h> | 30 | #include <q3popupmenu.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <QDesktopWidget> | ||
32 | 33 | ||
33 | #include <qptrlist.h> | 34 | #include <q3ptrlist.h> |
34 | #include <qscrollview.h> | 35 | #include <q3scrollview.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3HBoxLayout> | ||
38 | #include <Q3VBoxLayout> | ||
35 | 39 | ||
36 | #include "addresseeconfig.h" | 40 | #include "addresseeconfig.h" |
37 | #include "typecombo.h" | 41 | #include "typecombo.h" |
38 | 42 | ||
39 | class QButtonGroup; | 43 | class Q3ButtonGroup; |
40 | class QCheckBox; | 44 | class QCheckBox; |
41 | class PhoneTypeNumberEdit; | 45 | class PhoneTypeNumberEdit; |
42 | 46 | ||
43 | #include <klineedit.h> | 47 | #include <klineedit.h> |
44 | #include <kcombobox.h> | 48 | #include <kcombobox.h> |
45 | #include <kabc/phonenumber.h> | 49 | #include <kabc/phonenumber.h> |
46 | 50 | ||
47 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; | 51 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; |
48 | 52 | ||
49 | /** | 53 | /** |
50 | Widget for editing phone numbers. | 54 | Widget for editing phone numbers. |
51 | */ | 55 | */ |
@@ -67,51 +71,51 @@ class PhoneEditWidget : public QWidget | |||
67 | void modified(); | 71 | void modified(); |
68 | void typeChange( int oldType, int newType ); | 72 | void typeChange( int oldType, int newType ); |
69 | 73 | ||
70 | private slots: | 74 | private slots: |
71 | void bottomVisible(); | 75 | void bottomVisible(); |
72 | void addNumberInt( int ); | 76 | void addNumberInt( int ); |
73 | void deleteEdit( PhoneTypeNumberEdit* ew ); | 77 | void deleteEdit( PhoneTypeNumberEdit* ew ); |
74 | void addNumber(); | 78 | void addNumber(); |
75 | void pendingDelete(); | 79 | void pendingDelete(); |
76 | protected: | 80 | protected: |
77 | 81 | ||
78 | private: | 82 | private: |
79 | QScrollView* sv; | 83 | Q3ScrollView* sv; |
80 | QPopupMenu *mPopup; | 84 | Q3PopupMenu *mPopup; |
81 | int mPopupCount; | 85 | int mPopupCount; |
82 | PhoneTypeNumberEdit* mPendingDelete; | 86 | PhoneTypeNumberEdit* mPendingDelete; |
83 | void setDefaults(); | 87 | void setDefaults(); |
84 | PhoneTypeNumberEdit* appendEditCombo(); | 88 | PhoneTypeNumberEdit* appendEditCombo(); |
85 | QWidget* mw; | 89 | QWidget* mw; |
86 | QVBoxLayout* mainLayout; | 90 | Q3VBoxLayout* mainLayout; |
87 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; | 91 | Q3PtrList <PhoneTypeNumberEdit> mTypeNumberEditList; |
88 | 92 | ||
89 | }; | 93 | }; |
90 | 94 | ||
91 | 95 | ||
92 | class PhoneTypeNumberEdit : public QWidget | 96 | class PhoneTypeNumberEdit : public QWidget |
93 | { | 97 | { |
94 | Q_OBJECT | 98 | Q_OBJECT |
95 | public: | 99 | public: |
96 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) | 100 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) |
97 | { | 101 | { |
98 | QHBoxLayout * lay = new QHBoxLayout( this ); | 102 | Q3HBoxLayout * lay = new Q3HBoxLayout( this ); |
99 | lay->setSpacing( 2 ); | 103 | lay->setSpacing( 2 ); |
100 | lay->setMargin( 0 ); | 104 | lay->setMargin( 0 ); |
101 | mMinusButton = new QPushButton ( this ); | 105 | mMinusButton = new QPushButton ( this ); |
102 | mMinusButton->setPixmap ( SmallIcon("minus")); | 106 | mMinusButton->setPixmap ( SmallIcon("minus")); |
103 | mCombo = new KComboBox( this ); | 107 | mCombo = new KComboBox( this ); |
104 | if ( QApplication::desktop()->width() <= 640 ) | 108 | if ( QApplication::desktop()->width() <= 640 ) |
105 | mCombo->setSizeLimit ( 6 ); | 109 | mCombo->setMaxVisibleItems ( 6 ); |
106 | mNumber = new KLineEdit( this ); | 110 | mNumber = new KLineEdit( this ); |
107 | mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); | 111 | mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); |
108 | lay->addWidget( mMinusButton ); | 112 | lay->addWidget( mMinusButton ); |
109 | lay->addWidget( mCombo ); | 113 | lay->addWidget( mCombo ); |
110 | lay->addWidget( mNumber ); | 114 | lay->addWidget( mNumber ); |
111 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); | 115 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); |
112 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); | 116 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); |
113 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), | 117 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), |
114 | this, SLOT ( textChanged ( const QString & ) ) ); | 118 | this, SLOT ( textChanged ( const QString & ) ) ); |
115 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); | 119 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); |
116 | } | 120 | } |
117 | ~PhoneTypeNumberEdit() { | 121 | ~PhoneTypeNumberEdit() { |
diff --git a/kaddressbook/secrecywidget.cpp b/kaddressbook/secrecywidget.cpp index 4a2acc8..1c237c0 100644 --- a/kaddressbook/secrecywidget.cpp +++ b/kaddressbook/secrecywidget.cpp | |||
@@ -13,35 +13,37 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3VBoxLayout> | ||
25 | 27 | ||
26 | #include <kabc/secrecy.h> | 28 | #include <kabc/secrecy.h> |
27 | #include <kcombobox.h> | 29 | #include <kcombobox.h> |
28 | #include <kdialog.h> | 30 | #include <kdialog.h> |
29 | 31 | ||
30 | #include "secrecywidget.h" | 32 | #include "secrecywidget.h" |
31 | 33 | ||
32 | SecrecyWidget::SecrecyWidget( QWidget *parent, const char *name ) | 34 | SecrecyWidget::SecrecyWidget( QWidget *parent, const char *name ) |
33 | : QWidget( parent, name ) | 35 | : QWidget( parent, name ) |
34 | { | 36 | { |
35 | QVBoxLayout *layout = new QVBoxLayout( this, KDialog::marginHint(), | 37 | Q3VBoxLayout *layout = new Q3VBoxLayout( this, KDialog::marginHint(), |
36 | KDialog::spacingHint() ); | 38 | KDialog::spacingHint() ); |
37 | mSecrecyCombo = new KComboBox( this ); | 39 | mSecrecyCombo = new KComboBox( this ); |
38 | layout->addWidget( mSecrecyCombo ); | 40 | layout->addWidget( mSecrecyCombo ); |
39 | 41 | ||
40 | KABC::Secrecy::TypeList list = KABC::Secrecy::typeList(); | 42 | KABC::Secrecy::TypeList list = KABC::Secrecy::typeList(); |
41 | KABC::Secrecy::TypeList::Iterator it; | 43 | KABC::Secrecy::TypeList::Iterator it; |
42 | for ( it = list.begin(); it != list.end(); ++it ) | 44 | for ( it = list.begin(); it != list.end(); ++it ) |
43 | mSecrecyCombo->insertItem( KABC::Secrecy::typeLabel( *it ), *it ); | 45 | mSecrecyCombo->insertItem( KABC::Secrecy::typeLabel( *it ), *it ); |
44 | 46 | ||
45 | connect( mSecrecyCombo, SIGNAL( activated( const QString& ) ), | 47 | connect( mSecrecyCombo, SIGNAL( activated( const QString& ) ), |
46 | SIGNAL( changed() ) ); | 48 | SIGNAL( changed() ) ); |
47 | } | 49 | } |
@@ -56,15 +58,15 @@ void SecrecyWidget::setSecrecy( const KABC::Secrecy &secrecy ) | |||
56 | if (secrecy.isValid()) | 58 | if (secrecy.isValid()) |
57 | mSecrecyCombo->setCurrentItem( secrecy.type() ); | 59 | mSecrecyCombo->setCurrentItem( secrecy.type() ); |
58 | } | 60 | } |
59 | 61 | ||
60 | KABC::Secrecy SecrecyWidget::secrecy() const | 62 | KABC::Secrecy SecrecyWidget::secrecy() const |
61 | { | 63 | { |
62 | KABC::Secrecy secrecy; | 64 | KABC::Secrecy secrecy; |
63 | secrecy.setType( mSecrecyCombo->currentItem() ); | 65 | secrecy.setType( mSecrecyCombo->currentItem() ); |
64 | 66 | ||
65 | return secrecy; | 67 | return secrecy; |
66 | } | 68 | } |
67 | 69 | ||
68 | #ifndef KAB_EMBEDDED | 70 | #ifndef KAB_EMBEDDED_ |
69 | #include "secrecywidget.moc" | 71 | #include "moc_secrecywidget.cpp" |
70 | #endif //KAB_EMBEDDED | 72 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/undo.cpp b/kaddressbook/undo.cpp index 4442087..a6c1580 100644 --- a/kaddressbook/undo.cpp +++ b/kaddressbook/undo.cpp | |||
@@ -105,15 +105,15 @@ RedoStack* RedoStack::instance() | |||
105 | 105 | ||
106 | void RedoStack::redo() | 106 | void RedoStack::redo() |
107 | { | 107 | { |
108 | Command *command; | 108 | Command *command; |
109 | if (isEmpty()) | 109 | if (isEmpty()) |
110 | return; | 110 | return; |
111 | 111 | ||
112 | command = pop(); | 112 | command = pop(); |
113 | command->redo(); | 113 | command->redo(); |
114 | UndoStack::instance()->push( command ); | 114 | UndoStack::instance()->push( command ); |
115 | } | 115 | } |
116 | 116 | ||
117 | #ifndef KAB_EMBEDDED | 117 | #ifndef KAB_EMBEDDED_ |
118 | #include "undo.moc" | 118 | #include "moc_undo.cpp" |
119 | #endif //KAB_EMBEDDED | 119 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/undo.h b/kaddressbook/undo.h index 843bc26..a8ba2ee 100644 --- a/kaddressbook/undo.h +++ b/kaddressbook/undo.h | |||
@@ -16,25 +16,25 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef UNDO_H | 24 | #ifndef UNDO_H |
25 | #define UNDO_H | 25 | #define UNDO_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qptrstack.h> | 28 | #include <q3ptrstack.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | 30 | ||
31 | class Command | 31 | class Command |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | Command() {} | 34 | Command() {} |
35 | virtual ~Command() {}; | 35 | virtual ~Command() {}; |
36 | virtual QString name() = 0; | 36 | virtual QString name() = 0; |
37 | virtual void redo() = 0; // egcs requires these methods to have | 37 | virtual void redo() = 0; // egcs requires these methods to have |
38 | virtual void undo() = 0; // implementations (Seems like a bug) | 38 | virtual void undo() = 0; // implementations (Seems like a bug) |
39 | // pure virtual may not work | 39 | // pure virtual may not work |
40 | }; | 40 | }; |
@@ -58,25 +58,25 @@ class StackBase : public QObject | |||
58 | Command *top(); | 58 | Command *top(); |
59 | void clear(); | 59 | void clear(); |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | void changed(); | 62 | void changed(); |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | /** Protect the pop method so users must call undo/redo to properly | 65 | /** Protect the pop method so users must call undo/redo to properly |
66 | * use the stack, however the subclasses need it to modify the stack. | 66 | * use the stack, however the subclasses need it to modify the stack. |
67 | */ | 67 | */ |
68 | Command *pop(); | 68 | Command *pop(); |
69 | 69 | ||
70 | QPtrStack<Command> mCommandStack; | 70 | Q3PtrStack<Command> mCommandStack; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class UndoStack : public StackBase | 73 | class UndoStack : public StackBase |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | static UndoStack *instance(); | 76 | static UndoStack *instance(); |
77 | void undo(); | 77 | void undo(); |
78 | 78 | ||
79 | protected: | 79 | protected: |
80 | UndoStack(); | 80 | UndoStack(); |
81 | static UndoStack* instance_; | 81 | static UndoStack* instance_; |
82 | }; | 82 | }; |
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp index 5807dc0..e900b00 100644 --- a/kaddressbook/undocmds.cpp +++ b/kaddressbook/undocmds.cpp | |||
@@ -12,25 +12,25 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtextstream.h> | 24 | #include <q3textstream.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qclipboard.h> | 27 | #include <qclipboard.h> |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kapplication.h> | 31 | #include <kapplication.h> |
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | 33 | ||
34 | #include "addresseeutil.h" | 34 | #include "addresseeutil.h" |
35 | #include "addresseeconfig.h" | 35 | #include "addresseeconfig.h" |
36 | #include "kabcore.h" | 36 | #include "kabcore.h" |
diff --git a/kaddressbook/viewconfigurefieldspage.cpp b/kaddressbook/viewconfigurefieldspage.cpp index 5daae1a..7366a0b 100644 --- a/kaddressbook/viewconfigurefieldspage.cpp +++ b/kaddressbook/viewconfigurefieldspage.cpp | |||
@@ -27,38 +27,42 @@ | |||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | 28 | ||
29 | #else //KAB_EMBEDDED | 29 | #else //KAB_EMBEDDED |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #endif //KAB_EMBEDDED | 31 | #endif //KAB_EMBEDDED |
32 | 32 | ||
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kdialog.h> | 34 | #include <kdialog.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | 36 | ||
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <QDesktopWidget> | ||
39 | #include <qlabel.h> | 40 | #include <qlabel.h> |
40 | #include <qlistbox.h> | 41 | #include <q3listbox.h> |
41 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | //Added by qt3to4: | ||
44 | #include <Q3GridLayout> | ||
45 | #include <Q3BoxLayout> | ||
42 | 46 | ||
43 | #include "viewconfigurefieldspage.h" | 47 | #include "viewconfigurefieldspage.h" |
44 | 48 | ||
45 | class FieldItem : public QListBoxText | 49 | class FieldItem : public Q3ListBoxText |
46 | { | 50 | { |
47 | public: | 51 | public: |
48 | FieldItem( QListBox *parent, KABC::Field *field ) | 52 | FieldItem( Q3ListBox *parent, KABC::Field *field ) |
49 | : QListBoxText( parent, field->label() ), mField( field ) {} | 53 | : Q3ListBoxText( parent, field->label() ), mField( field ) {} |
50 | 54 | ||
51 | FieldItem( QListBox *parent, KABC::Field *field, int index ) | 55 | FieldItem( Q3ListBox *parent, KABC::Field *field, int index ) |
52 | : QListBoxText( parent, field->label(), parent->item( index ) ), | 56 | : Q3ListBoxText( parent, field->label(), parent->item( index ) ), |
53 | mField( field ) {} | 57 | mField( field ) {} |
54 | 58 | ||
55 | KABC::Field *field() { return mField; } | 59 | KABC::Field *field() { return mField; } |
56 | 60 | ||
57 | private: | 61 | private: |
58 | KABC::Field *mField; | 62 | KABC::Field *mField; |
59 | }; | 63 | }; |
60 | 64 | ||
61 | 65 | ||
62 | ViewConfigureFieldsPage::ViewConfigureFieldsPage( KABC::AddressBook *ab, | 66 | ViewConfigureFieldsPage::ViewConfigureFieldsPage( KABC::AddressBook *ab, |
63 | QWidget *parent, | 67 | QWidget *parent, |
64 | const char *name ) | 68 | const char *name ) |
@@ -97,25 +101,25 @@ void ViewConfigureFieldsPage::slotShowFields( int index ) | |||
97 | { | 101 | { |
98 | int currentPos = mUnSelectedBox->currentItem(); | 102 | int currentPos = mUnSelectedBox->currentItem(); |
99 | mUnSelectedBox->clear(); | 103 | mUnSelectedBox->clear(); |
100 | 104 | ||
101 | int category; | 105 | int category; |
102 | if ( index == 0 ) category = KABC::Field::All; | 106 | if ( index == 0 ) category = KABC::Field::All; |
103 | else category = 1 << ( index - 1 ); | 107 | else category = 1 << ( index - 1 ); |
104 | 108 | ||
105 | KABC::Field::List allFields = mAddressBook->fields( category ); | 109 | KABC::Field::List allFields = mAddressBook->fields( category ); |
106 | 110 | ||
107 | KABC::Field::List::ConstIterator it; | 111 | KABC::Field::List::ConstIterator it; |
108 | for ( it = allFields.begin(); it != allFields.end(); ++it ) { | 112 | for ( it = allFields.begin(); it != allFields.end(); ++it ) { |
109 | QListBoxItem *item = mSelectedBox->firstItem(); | 113 | Q3ListBoxItem *item = mSelectedBox->firstItem(); |
110 | while( item ) { | 114 | while( item ) { |
111 | FieldItem *fieldItem = static_cast<FieldItem *>( item ); | 115 | FieldItem *fieldItem = static_cast<FieldItem *>( item ); |
112 | if ( (*it)->equals( fieldItem->field() ) ) | 116 | if ( (*it)->equals( fieldItem->field() ) ) |
113 | break; | 117 | break; |
114 | item = item->next(); | 118 | item = item->next(); |
115 | } | 119 | } |
116 | 120 | ||
117 | if ( !item ) | 121 | if ( !item ) |
118 | new FieldItem( mUnSelectedBox, *it ); | 122 | new FieldItem( mUnSelectedBox, *it ); |
119 | } | 123 | } |
120 | 124 | ||
121 | mUnSelectedBox->sort(); | 125 | mUnSelectedBox->sort(); |
@@ -180,59 +184,59 @@ void ViewConfigureFieldsPage::slotButtonsEnabled() | |||
180 | //US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead. | 184 | //US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead. |
181 | if ( mSelectedBox->item( i )->selected() ) { | 185 | if ( mSelectedBox->item( i )->selected() ) { |
182 | state = true; | 186 | state = true; |
183 | break; | 187 | break; |
184 | } | 188 | } |
185 | mRemoveButton->setEnabled( state ); | 189 | mRemoveButton->setEnabled( state ); |
186 | } | 190 | } |
187 | 191 | ||
188 | void ViewConfigureFieldsPage::slotMoveUp() | 192 | void ViewConfigureFieldsPage::slotMoveUp() |
189 | { | 193 | { |
190 | int i = mSelectedBox->currentItem(); | 194 | int i = mSelectedBox->currentItem(); |
191 | if ( i > 0 ) { | 195 | if ( i > 0 ) { |
192 | QListBoxItem *item = mSelectedBox->item( i ); | 196 | Q3ListBoxItem *item = mSelectedBox->item( i ); |
193 | mSelectedBox->takeItem( item ); | 197 | mSelectedBox->takeItem( item ); |
194 | mSelectedBox->insertItem( item, i - 1 ); | 198 | mSelectedBox->insertItem( item, i - 1 ); |
195 | mSelectedBox->setCurrentItem( item ); | 199 | mSelectedBox->setCurrentItem( item ); |
196 | mSelectedBox->setSelected( i - 1, true ); | 200 | mSelectedBox->setSelected( i - 1, true ); |
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
200 | void ViewConfigureFieldsPage::slotMoveDown() | 204 | void ViewConfigureFieldsPage::slotMoveDown() |
201 | { | 205 | { |
202 | int i = mSelectedBox->currentItem(); | 206 | int i = mSelectedBox->currentItem(); |
203 | if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) { | 207 | if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) { |
204 | QListBoxItem *item = mSelectedBox->item( i ); | 208 | Q3ListBoxItem *item = mSelectedBox->item( i ); |
205 | mSelectedBox->takeItem( item ); | 209 | mSelectedBox->takeItem( item ); |
206 | mSelectedBox->insertItem( item, i + 1 ); | 210 | mSelectedBox->insertItem( item, i + 1 ); |
207 | mSelectedBox->setCurrentItem( item ); | 211 | mSelectedBox->setCurrentItem( item ); |
208 | mSelectedBox->setSelected( i + 1, true ); | 212 | mSelectedBox->setSelected( i + 1, true ); |
209 | } | 213 | } |
210 | } | 214 | } |
211 | 215 | ||
212 | void ViewConfigureFieldsPage::initGUI() | 216 | void ViewConfigureFieldsPage::initGUI() |
213 | { | 217 | { |
214 | //US change the orientation dependent on the following flag | 218 | //US change the orientation dependent on the following flag |
215 | // right the flag is set only staticly. | 219 | // right the flag is set only staticly. |
216 | // 0 = 640x480 ; 1 = 240x320 | 220 | // 0 = 640x480 ; 1 = 240x320 |
217 | bool orientation = 1; | 221 | bool orientation = 1; |
218 | 222 | ||
219 | 223 | ||
220 | setCaption( i18n("Select Fields to Display") ); | 224 | setCaption( i18n("Select Fields to Display") ); |
221 | 225 | ||
222 | QGridLayout *gl = 0; | 226 | Q3GridLayout *gl = 0; |
223 | if (orientation == 0) | 227 | if (orientation == 0) |
224 | gl = new QGridLayout( this , 6, 4, 0, KDialog::spacingHint() ); | 228 | gl = new Q3GridLayout( this , 6, 4, 0, KDialog::spacingHint() ); |
225 | else | 229 | else |
226 | gl = new QGridLayout( this , 4, 6, 0, KDialog::spacingHint() ); | 230 | gl = new Q3GridLayout( this , 4, 6, 0, KDialog::spacingHint() ); |
227 | 231 | ||
228 | #ifndef KAB_EMBEDDED | 232 | #ifndef KAB_EMBEDDED |
229 | mCategoryCombo = new KComboBox( false, this ); | 233 | mCategoryCombo = new KComboBox( false, this ); |
230 | #else //KAB_EMBEDDED | 234 | #else //KAB_EMBEDDED |
231 | mCategoryCombo = new QComboBox( false, this ); | 235 | mCategoryCombo = new QComboBox( false, this ); |
232 | #endif //KAB_EMBEDDED | 236 | #endif //KAB_EMBEDDED |
233 | if ( QApplication::desktop()->width() < 320 ) | 237 | if ( QApplication::desktop()->width() < 320 ) |
234 | mCategoryCombo->setMaximumWidth( 70 ); | 238 | mCategoryCombo->setMaximumWidth( 70 ); |
235 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::All ) ); | 239 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::All ) ); |
236 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Frequent ) ); | 240 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Frequent ) ); |
237 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Address ) ); | 241 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Address ) ); |
238 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Email ) ); | 242 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Email ) ); |
@@ -240,50 +244,50 @@ void ViewConfigureFieldsPage::initGUI() | |||
240 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Organization ) ); | 244 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Organization ) ); |
241 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::CustomCategory ) ); | 245 | mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::CustomCategory ) ); |
242 | connect( mCategoryCombo, SIGNAL( activated(int) ), SLOT( slotShowFields(int) ) ); | 246 | connect( mCategoryCombo, SIGNAL( activated(int) ), SLOT( slotShowFields(int) ) ); |
243 | gl->addWidget( mCategoryCombo, 0, 0 ); | 247 | gl->addWidget( mCategoryCombo, 0, 0 ); |
244 | 248 | ||
245 | QLabel *label = new QLabel( i18n( "&Selected\nfields:" ), this ); | 249 | QLabel *label = new QLabel( i18n( "&Selected\nfields:" ), this ); |
246 | if (orientation == 0) | 250 | if (orientation == 0) |
247 | gl->addWidget( label, 0, 2 ); | 251 | gl->addWidget( label, 0, 2 ); |
248 | else | 252 | else |
249 | gl->addWidget( label, 2, 0 ); | 253 | gl->addWidget( label, 2, 0 ); |
250 | 254 | ||
251 | 255 | ||
252 | mUnSelectedBox = new QListBox( this ); | 256 | mUnSelectedBox = new Q3ListBox( this ); |
253 | mUnSelectedBox->setSelectionMode( QListBox::Extended ); | 257 | mUnSelectedBox->setSelectionMode( Q3ListBox::Extended ); |
254 | mUnSelectedBox->setMinimumHeight( 80 ); | 258 | mUnSelectedBox->setMinimumHeight( 80 ); |
255 | if (orientation == 0) | 259 | if (orientation == 0) |
256 | gl->addWidget( mUnSelectedBox, 1, 0 ); | 260 | gl->addWidget( mUnSelectedBox, 1, 0 ); |
257 | else | 261 | else |
258 | gl->addWidget( mUnSelectedBox, 0, 1 ); | 262 | gl->addWidget( mUnSelectedBox, 0, 1 ); |
259 | 263 | ||
260 | mSelectedBox = new QListBox( this ); | 264 | mSelectedBox = new Q3ListBox( this ); |
261 | //if ( QApplication::desktop()->width() < 320 ) { | 265 | //if ( QApplication::desktop()->width() < 320 ) { |
262 | // mUnSelectedBox->setMaximumWidth( 134 ); | 266 | // mUnSelectedBox->setMaximumWidth( 134 ); |
263 | // mSelectedBox->setMaximumWidth( 134 ); | 267 | // mSelectedBox->setMaximumWidth( 134 ); |
264 | //} | 268 | //} |
265 | mSelectedBox->setSelectionMode( QListBox::Extended ); | 269 | mSelectedBox->setSelectionMode( Q3ListBox::Extended ); |
266 | mSelectedBox->setMinimumHeight( 80 ); | 270 | mSelectedBox->setMinimumHeight( 80 ); |
267 | label->setBuddy( mSelectedBox ); | 271 | label->setBuddy( mSelectedBox ); |
268 | if (orientation == 0) | 272 | if (orientation == 0) |
269 | gl->addWidget( mSelectedBox, 1, 2 ); | 273 | gl->addWidget( mSelectedBox, 1, 2 ); |
270 | else | 274 | else |
271 | gl->addWidget( mSelectedBox, 2, 1 ); | 275 | gl->addWidget( mSelectedBox, 2, 1 ); |
272 | 276 | ||
273 | QBoxLayout *vb1 = 0; | 277 | Q3BoxLayout *vb1 = 0; |
274 | if (orientation == 0) | 278 | if (orientation == 0) |
275 | vb1 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); | 279 | vb1 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() ); |
276 | else | 280 | else |
277 | vb1 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); | 281 | vb1 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() ); |
278 | 282 | ||
279 | vb1->addStretch(); | 283 | vb1->addStretch(); |
280 | 284 | ||
281 | mAddButton = new QToolButton( this ); | 285 | mAddButton = new QToolButton( this ); |
282 | if (orientation == 0) | 286 | if (orientation == 0) |
283 | mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) ); | 287 | mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) ); |
284 | else | 288 | else |
285 | mAddButton->setIconSet( SmallIconSet( "1downarrow" ) ); | 289 | mAddButton->setIconSet( SmallIconSet( "1downarrow" ) ); |
286 | connect( mAddButton, SIGNAL( clicked() ), SLOT( slotSelect() ) ); | 290 | connect( mAddButton, SIGNAL( clicked() ), SLOT( slotSelect() ) ); |
287 | vb1->addWidget( mAddButton ); | 291 | vb1->addWidget( mAddButton ); |
288 | 292 | ||
289 | mRemoveButton = new QToolButton( this ); | 293 | mRemoveButton = new QToolButton( this ); |
@@ -292,29 +296,29 @@ void ViewConfigureFieldsPage::initGUI() | |||
292 | else | 296 | else |
293 | mRemoveButton->setIconSet( SmallIconSet( "1uparrow" ) ); | 297 | mRemoveButton->setIconSet( SmallIconSet( "1uparrow" ) ); |
294 | 298 | ||
295 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotUnSelect() ) ); | 299 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotUnSelect() ) ); |
296 | vb1->addWidget( mRemoveButton ); | 300 | vb1->addWidget( mRemoveButton ); |
297 | 301 | ||
298 | vb1->addStretch(); | 302 | vb1->addStretch(); |
299 | if (orientation == 0) | 303 | if (orientation == 0) |
300 | gl->addLayout( vb1, 1, 1 ); | 304 | gl->addLayout( vb1, 1, 1 ); |
301 | else | 305 | else |
302 | gl->addLayout( vb1, 1, 1 ); | 306 | gl->addLayout( vb1, 1, 1 ); |
303 | 307 | ||
304 | QBoxLayout *vb2 = 0; | 308 | Q3BoxLayout *vb2 = 0; |
305 | if (orientation == 0) | 309 | if (orientation == 0) |
306 | vb2 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() ); | 310 | vb2 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() ); |
307 | else | 311 | else |
308 | vb2 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() ); | 312 | vb2 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() ); |
309 | 313 | ||
310 | vb2->addStretch(); | 314 | vb2->addStretch(); |
311 | 315 | ||
312 | mUpButton = new QToolButton( this ); | 316 | mUpButton = new QToolButton( this ); |
313 | mUpButton->setIconSet( SmallIconSet( "1uparrow" ) ); | 317 | mUpButton->setIconSet( SmallIconSet( "1uparrow" ) ); |
314 | connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) ); | 318 | connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) ); |
315 | vb2->addWidget( mUpButton ); | 319 | vb2->addWidget( mUpButton ); |
316 | 320 | ||
317 | mDownButton = new QToolButton( this ); | 321 | mDownButton = new QToolButton( this ); |
318 | mDownButton->setIconSet( SmallIconSet( "1downarrow" ) ); | 322 | mDownButton->setIconSet( SmallIconSet( "1downarrow" ) ); |
319 | connect( mDownButton, SIGNAL( clicked() ), SLOT( slotMoveDown() ) ); | 323 | connect( mDownButton, SIGNAL( clicked() ), SLOT( slotMoveDown() ) ); |
320 | vb2->addWidget( mDownButton ); | 324 | vb2->addWidget( mDownButton ); |
@@ -331,21 +335,21 @@ void ViewConfigureFieldsPage::initGUI() | |||
331 | // get the maxItemWidth we need to not truncate the view | 335 | // get the maxItemWidth we need to not truncate the view |
332 | slotShowFields( 0 ); | 336 | slotShowFields( 0 ); |
333 | 337 | ||
334 | //sizeHint = sizeHint.expandedTo( mSelectedBox->sizeHint() ); | 338 | //sizeHint = sizeHint.expandedTo( mSelectedBox->sizeHint() ); |
335 | //sizeHint.setWidth( mUnSelectedBox->maxItemWidth() ); | 339 | //sizeHint.setWidth( mUnSelectedBox->maxItemWidth() ); |
336 | // mUnSelectedBox->setMinimumSize( sizeHint ); | 340 | // mUnSelectedBox->setMinimumSize( sizeHint ); |
337 | //mSelectedBox->setMinimumSize( sizeHint ); | 341 | //mSelectedBox->setMinimumSize( sizeHint ); |
338 | 342 | ||
339 | gl->activate(); | 343 | gl->activate(); |
340 | 344 | ||
341 | connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); | 345 | connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); |
342 | connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); | 346 | connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) ); |
343 | connect( mSelectedBox, SIGNAL( currentChanged( QListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); | 347 | connect( mSelectedBox, SIGNAL( currentChanged( Q3ListBoxItem * ) ), SLOT( slotButtonsEnabled() ) ); |
344 | 348 | ||
345 | slotButtonsEnabled(); | 349 | slotButtonsEnabled(); |
346 | } | 350 | } |
347 | 351 | ||
348 | 352 | ||
349 | #ifndef KAB_EMBEDDED | 353 | #ifndef KAB_EMBEDDED_ |
350 | #include "viewconfigurefieldspage.moc" | 354 | #include "moc_viewconfigurefieldspage.cpp" |
351 | #endif //KAB_EMBEDDED | 355 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/viewconfigurefieldspage.h b/kaddressbook/viewconfigurefieldspage.h index b27668c..42d132f 100644 --- a/kaddressbook/viewconfigurefieldspage.h +++ b/kaddressbook/viewconfigurefieldspage.h | |||
@@ -26,26 +26,26 @@ | |||
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | #include <kabc/field.h> | 29 | #include <kabc/field.h> |
30 | #include <kabc/addressbook.h> | 30 | #include <kabc/addressbook.h> |
31 | 31 | ||
32 | #ifndef KAB_EMBEDDED | 32 | #ifndef KAB_EMBEDDED |
33 | class KComboBox; | 33 | class KComboBox; |
34 | #else //KAB_EMBEDDED | 34 | #else //KAB_EMBEDDED |
35 | class QComboBox; | 35 | class QComboBox; |
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | class QListBox; | 38 | class Q3ListBox; |
39 | class QListBoxItem; | 39 | class Q3ListBoxItem; |
40 | class QPushButton; | 40 | class QPushButton; |
41 | class QToolButton; | 41 | class QToolButton; |
42 | 42 | ||
43 | class ViewConfigureFieldsPage : public QWidget | 43 | class ViewConfigureFieldsPage : public QWidget |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | 46 | ||
47 | public: | 47 | public: |
48 | ViewConfigureFieldsPage( KABC::AddressBook *ab, QWidget *parent = 0, | 48 | ViewConfigureFieldsPage( KABC::AddressBook *ab, QWidget *parent = 0, |
49 | const char *name = 0 ); | 49 | const char *name = 0 ); |
50 | 50 | ||
51 | void restoreSettings( KConfig* ); | 51 | void restoreSettings( KConfig* ); |
@@ -59,23 +59,23 @@ class ViewConfigureFieldsPage : public QWidget | |||
59 | 59 | ||
60 | void slotShowFields( int ); | 60 | void slotShowFields( int ); |
61 | void slotButtonsEnabled(); | 61 | void slotButtonsEnabled(); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | void initGUI(); | 64 | void initGUI(); |
65 | 65 | ||
66 | #ifndef KAB_EMBEDDED | 66 | #ifndef KAB_EMBEDDED |
67 | KComboBox *mCategoryCombo; | 67 | KComboBox *mCategoryCombo; |
68 | #else //KAB_EMBEDDED | 68 | #else //KAB_EMBEDDED |
69 | QComboBox *mCategoryCombo; | 69 | QComboBox *mCategoryCombo; |
70 | #endif //KAB_EMBEDDED | 70 | #endif //KAB_EMBEDDED |
71 | QListBox *mSelectedBox; | 71 | Q3ListBox *mSelectedBox; |
72 | QListBox *mUnSelectedBox; | 72 | Q3ListBox *mUnSelectedBox; |
73 | QToolButton *mAddButton; | 73 | QToolButton *mAddButton; |
74 | QToolButton *mRemoveButton; | 74 | QToolButton *mRemoveButton; |
75 | QToolButton *mUpButton; | 75 | QToolButton *mUpButton; |
76 | QToolButton *mDownButton; | 76 | QToolButton *mDownButton; |
77 | 77 | ||
78 | KABC::AddressBook *mAddressBook; | 78 | KABC::AddressBook *mAddressBook; |
79 | }; | 79 | }; |
80 | 80 | ||
81 | #endif | 81 | #endif |
diff --git a/kaddressbook/viewconfigurefilterpage.cpp b/kaddressbook/viewconfigurefilterpage.cpp index b085a5e..cdb778b 100644 --- a/kaddressbook/viewconfigurefilterpage.cpp +++ b/kaddressbook/viewconfigurefilterpage.cpp | |||
@@ -18,66 +18,69 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <kcombobox.h> | 25 | #include <kcombobox.h> |
26 | #else //KAB_EMBEDDED | 26 | #else //KAB_EMBEDDED |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | #endif //KAB_EMBEDDED | 28 | #endif //KAB_EMBEDDED |
29 | 29 | ||
30 | #include <qbuttongroup.h> | 30 | #include <q3buttongroup.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qradiobutton.h> | 33 | #include <qradiobutton.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
36 | #include <Q3VBoxLayout> | ||
34 | 37 | ||
35 | #include <kconfig.h> | 38 | #include <kconfig.h> |
36 | #include <kdialog.h> | 39 | #include <kdialog.h> |
37 | #include <klocale.h> | 40 | #include <klocale.h> |
38 | 41 | ||
39 | #include "filter.h" | 42 | #include "filter.h" |
40 | 43 | ||
41 | #include "viewconfigurefilterpage.h" | 44 | #include "viewconfigurefilterpage.h" |
42 | 45 | ||
43 | ViewConfigureFilterPage::ViewConfigureFilterPage( QWidget *parent, | 46 | ViewConfigureFilterPage::ViewConfigureFilterPage( QWidget *parent, |
44 | const char *name ) | 47 | const char *name ) |
45 | : QWidget( parent, name ) | 48 | : QWidget( parent, name ) |
46 | { | 49 | { |
47 | QBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); | 50 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this, 0, KDialog::spacingHint() ); |
48 | 51 | ||
49 | mFilterGroup = new QButtonGroup(); | 52 | mFilterGroup = new Q3ButtonGroup(); |
50 | connect( mFilterGroup, SIGNAL( clicked( int ) ), SLOT( buttonClicked( int ) ) ); | 53 | connect( mFilterGroup, SIGNAL( clicked( int ) ), SLOT( buttonClicked( int ) ) ); |
51 | 54 | ||
52 | QLabel *label = new QLabel( i18n( "The default filter will be activated whenever" | 55 | QLabel *label = new QLabel( i18n( "The default filter will be activated whenever" |
53 | " this view is displayed. This feature allows you to configure views that only" | 56 | " this view is displayed. This feature allows you to configure views that only" |
54 | " interact with certain types of information based on the filter. Once the view" | 57 | " interact with certain types of information based on the filter. Once the view" |
55 | " is activated, the filter can be changed at anytime." ), this ); | 58 | " is activated, the filter can be changed at anytime." ), this ); |
56 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); | 59 | label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak ); |
57 | topLayout->addWidget( label ); | 60 | topLayout->addWidget( label ); |
58 | 61 | ||
59 | QWidget *spacer = new QWidget( this ); | 62 | QWidget *spacer = new QWidget( this ); |
60 | spacer->setMinimumHeight( 5 ); | 63 | spacer->setMinimumHeight( 5 ); |
61 | topLayout->addWidget( spacer ); | 64 | topLayout->addWidget( spacer ); |
62 | 65 | ||
63 | QRadioButton *button = new QRadioButton( i18n( "No default filter" ), this ); | 66 | QRadioButton *button = new QRadioButton( i18n( "No default filter" ), this ); |
64 | mFilterGroup->insert( button ); | 67 | mFilterGroup->insert( button ); |
65 | topLayout->addWidget( button ); | 68 | topLayout->addWidget( button ); |
66 | 69 | ||
67 | button = new QRadioButton( i18n( "Use last active filter" ), this ); | 70 | button = new QRadioButton( i18n( "Use last active filter" ), this ); |
68 | mFilterGroup->insert( button ); | 71 | mFilterGroup->insert( button ); |
69 | topLayout->addWidget( button ); | 72 | topLayout->addWidget( button ); |
70 | 73 | ||
71 | QBoxLayout *comboLayout = new QHBoxLayout(); | 74 | Q3BoxLayout *comboLayout = new Q3HBoxLayout(); |
72 | topLayout->addLayout( comboLayout ); | 75 | topLayout->addLayout( comboLayout ); |
73 | button = new QRadioButton( i18n( "Use filter:" ), this ); | 76 | button = new QRadioButton( i18n( "Use filter:" ), this ); |
74 | mFilterGroup->insert( button ); | 77 | mFilterGroup->insert( button ); |
75 | comboLayout->addWidget( button ); | 78 | comboLayout->addWidget( button ); |
76 | 79 | ||
77 | #ifndef KAB_EMBEDDED | 80 | #ifndef KAB_EMBEDDED |
78 | mFilterCombo = new KComboBox( this ); | 81 | mFilterCombo = new KComboBox( this ); |
79 | #else //KAB_EMBEDDED | 82 | #else //KAB_EMBEDDED |
80 | mFilterCombo = new QComboBox( this ); | 83 | mFilterCombo = new QComboBox( this ); |
81 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
82 | 85 | ||
83 | comboLayout->addWidget( mFilterCombo ); | 86 | comboLayout->addWidget( mFilterCombo ); |
@@ -123,15 +126,15 @@ void ViewConfigureFilterPage::restoreSettings( KConfig *config ) | |||
123 | 126 | ||
124 | void ViewConfigureFilterPage::saveSettings( KConfig *config ) | 127 | void ViewConfigureFilterPage::saveSettings( KConfig *config ) |
125 | { | 128 | { |
126 | config->writeEntry( "DefaultFilterName", mFilterCombo->currentText() ); | 129 | config->writeEntry( "DefaultFilterName", mFilterCombo->currentText() ); |
127 | config->writeEntry( "DefaultFilterType", mFilterGroup->id( mFilterGroup->selected() ) ); | 130 | config->writeEntry( "DefaultFilterType", mFilterGroup->id( mFilterGroup->selected() ) ); |
128 | } | 131 | } |
129 | 132 | ||
130 | void ViewConfigureFilterPage::buttonClicked( int id ) | 133 | void ViewConfigureFilterPage::buttonClicked( int id ) |
131 | { | 134 | { |
132 | mFilterCombo->setEnabled( id == 2 ); | 135 | mFilterCombo->setEnabled( id == 2 ); |
133 | } | 136 | } |
134 | 137 | ||
135 | #ifndef KAB_EMBEDDED | 138 | #ifndef KAB_EMBEDDED_ |
136 | #include "viewconfigurefilterpage.moc" | 139 | #include "moc_viewconfigurefilterpage.cpp" |
137 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/viewconfigurefilterpage.h b/kaddressbook/viewconfigurefilterpage.h index 3be9564..fb39a61 100644 --- a/kaddressbook/viewconfigurefilterpage.h +++ b/kaddressbook/viewconfigurefilterpage.h | |||
@@ -17,25 +17,25 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VIEWCONFIGUREFILTERPAGE | 24 | #ifndef VIEWCONFIGUREFILTERPAGE |
25 | #define VIEWCONFIGUREFILTERPAGE | 25 | #define VIEWCONFIGUREFILTERPAGE |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | class QButtonGroup; | 29 | class Q3ButtonGroup; |
30 | 30 | ||
31 | #ifndef KAB_EMBEDDED | 31 | #ifndef KAB_EMBEDDED |
32 | class KComboBox; | 32 | class KComboBox; |
33 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
34 | class QComboBox; | 34 | class QComboBox; |
35 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
36 | 36 | ||
37 | class KConfig; | 37 | class KConfig; |
38 | 38 | ||
39 | class ViewConfigureFilterPage : public QWidget | 39 | class ViewConfigureFilterPage : public QWidget |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
@@ -48,16 +48,16 @@ class ViewConfigureFilterPage : public QWidget | |||
48 | void saveSettings( KConfig* ); | 48 | void saveSettings( KConfig* ); |
49 | 49 | ||
50 | protected slots: | 50 | protected slots: |
51 | void buttonClicked( int id ); | 51 | void buttonClicked( int id ); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | #ifndef KAB_EMBEDDED | 54 | #ifndef KAB_EMBEDDED |
55 | KComboBox *mFilterCombo; | 55 | KComboBox *mFilterCombo; |
56 | #else //KAB_EMBEDDED | 56 | #else //KAB_EMBEDDED |
57 | QComboBox *mFilterCombo; | 57 | QComboBox *mFilterCombo; |
58 | #endif //KAB_EMBEDDED | 58 | #endif //KAB_EMBEDDED |
59 | 59 | ||
60 | QButtonGroup *mFilterGroup; | 60 | Q3ButtonGroup *mFilterGroup; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |
diff --git a/kaddressbook/viewconfigurewidget.cpp b/kaddressbook/viewconfigurewidget.cpp index 666e188..047df8c 100644 --- a/kaddressbook/viewconfigurewidget.cpp +++ b/kaddressbook/viewconfigurewidget.cpp | |||
@@ -15,58 +15,61 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | 24 | ||
25 | #ifndef KAB_EMBEDDED | 25 | #ifndef KAB_EMBEDDED |
26 | 26 | ||
27 | #include <qvbox.h> | 27 | #include <q3vbox.h> |
28 | 28 | ||
29 | #include <kapplication.h> | 29 | #include <kapplication.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | 33 | ||
34 | #include "viewmanager.h" | 34 | #include "viewmanager.h" |
35 | 35 | ||
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | 38 | ||
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3VBoxLayout> | ||
42 | #include <QPixmap> | ||
40 | 43 | ||
41 | #include <kjanuswidget.h> | 44 | #include <kjanuswidget.h> |
42 | #include <kglobal.h> | 45 | #include <kglobal.h> |
43 | #include <klocale.h> | 46 | #include <klocale.h> |
44 | 47 | ||
45 | #include "viewconfigurewidget.h" | 48 | #include "viewconfigurewidget.h" |
46 | #include "viewconfigurefieldspage.h" | 49 | #include "viewconfigurefieldspage.h" |
47 | #include "viewconfigurefilterpage.h" | 50 | #include "viewconfigurefilterpage.h" |
48 | 51 | ||
49 | ViewConfigureWidget::ViewConfigureWidget( KABC::AddressBook *ab, QWidget *parent, | 52 | ViewConfigureWidget::ViewConfigureWidget( KABC::AddressBook *ab, QWidget *parent, |
50 | const char *name ) | 53 | const char *name ) |
51 | : ConfigureWidget( ab, parent, name ) | 54 | : ConfigureWidget( ab, parent, name ) |
52 | { | 55 | { |
53 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 56 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this ); |
54 | 57 | ||
55 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | 58 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); |
56 | 59 | ||
57 | topLayout->addWidget( mMainWidget ); | 60 | topLayout->addWidget( mMainWidget ); |
58 | 61 | ||
59 | // Add the first page, the attributes | 62 | // Add the first page, the attributes |
60 | QVBox *page = addPage( i18n( "Fields" ), QString::null, | 63 | Q3VBox *page = addPage( i18n( "Fields" ), QString::null, |
61 | KGlobal::iconLoader()->loadIcon( "view_detailed", | 64 | KGlobal::iconLoader()->loadIcon( "view_detailed", |
62 | KIcon::Panel, 16 ) ); | 65 | KIcon::Panel, 16 ) ); |
63 | 66 | ||
64 | 67 | ||
65 | // Add the select fields page | 68 | // Add the select fields page |
66 | mFieldsPage = new ViewConfigureFieldsPage( addressBook(), (QWidget*)page ); | 69 | mFieldsPage = new ViewConfigureFieldsPage( addressBook(), (QWidget*)page ); |
67 | 70 | ||
68 | //US mFieldsPage->setMinimumSize(300,300); | 71 | //US mFieldsPage->setMinimumSize(300,300); |
69 | 72 | ||
70 | // Add the second page, the filter selection | 73 | // Add the second page, the filter selection |
71 | page = addPage( i18n( "Default Filter" ), QString::null, | 74 | page = addPage( i18n( "Default Filter" ), QString::null, |
72 | KGlobal::iconLoader()->loadIcon( "filter", | 75 | KGlobal::iconLoader()->loadIcon( "filter", |
@@ -84,31 +87,31 @@ ViewConfigureWidget::~ViewConfigureWidget() | |||
84 | void ViewConfigureWidget::restoreSettings( KConfig *config ) | 87 | void ViewConfigureWidget::restoreSettings( KConfig *config ) |
85 | { | 88 | { |
86 | mFieldsPage->restoreSettings( config ); | 89 | mFieldsPage->restoreSettings( config ); |
87 | mFilterPage->restoreSettings( config ); | 90 | mFilterPage->restoreSettings( config ); |
88 | } | 91 | } |
89 | 92 | ||
90 | void ViewConfigureWidget::saveSettings( KConfig *config ) | 93 | void ViewConfigureWidget::saveSettings( KConfig *config ) |
91 | { | 94 | { |
92 | mFieldsPage->saveSettings( config ); | 95 | mFieldsPage->saveSettings( config ); |
93 | mFilterPage->saveSettings( config ); | 96 | mFilterPage->saveSettings( config ); |
94 | } | 97 | } |
95 | 98 | ||
96 | QVBox *ViewConfigureWidget::addPage( const QString &item, const QString &header, | 99 | Q3VBox *ViewConfigureWidget::addPage( const QString &item, const QString &header, |
97 | const QPixmap &pixmap ) | 100 | const QPixmap &pixmap ) |
98 | { | 101 | { |
99 | return mMainWidget->addVBoxPage( item, header, pixmap ); | 102 | return mMainWidget->addVBoxPage( item, header, pixmap ); |
100 | } | 103 | } |
101 | 104 | ||
102 | #include <qframe.h> | 105 | #include <q3frame.h> |
103 | #include <qlabel.h> | 106 | #include <qlabel.h> |
104 | #include <qlayout.h> | 107 | #include <qlayout.h> |
105 | #include <stdlib.h> | 108 | #include <stdlib.h> |
106 | 109 | ||
107 | ViewConfigureDialog::ViewConfigureDialog( ViewConfigureWidget *wdg, const QString &viewName, | 110 | ViewConfigureDialog::ViewConfigureDialog( ViewConfigureWidget *wdg, const QString &viewName, |
108 | QWidget *parent, const char *name ) | 111 | QWidget *parent, const char *name ) |
109 | : KDialogBase( Swallow, i18n( "Modify View: " ) + viewName, Help | Ok | Cancel, | 112 | : KDialogBase( Swallow, i18n( "Modify View: " ) + viewName, Help | Ok | Cancel, |
110 | Ok, parent, name, true, true ), mConfigWidget( wdg ) | 113 | Ok, parent, name, true, true ), mConfigWidget( wdg ) |
111 | { | 114 | { |
112 | //US, I have to change the way, how to connect the ViewConfigureWidget. It looks | 115 | //US, I have to change the way, how to connect the ViewConfigureWidget. It looks |
113 | // like it has changed. | 116 | // like it has changed. |
114 | //QFrame *topFrame = plainPage(); | 117 | //QFrame *topFrame = plainPage(); |
@@ -143,17 +146,15 @@ void ViewConfigureDialog::saveSettings( KConfig *config ) | |||
143 | mConfigWidget->saveSettings( config ); | 146 | mConfigWidget->saveSettings( config ); |
144 | } | 147 | } |
145 | 148 | ||
146 | void ViewConfigureDialog::slotHelp() | 149 | void ViewConfigureDialog::slotHelp() |
147 | { | 150 | { |
148 | #ifndef KAB_EMBEDDED | 151 | #ifndef KAB_EMBEDDED |
149 | kapp->invokeHelp( "using-views" ); | 152 | kapp->invokeHelp( "using-views" ); |
150 | #else //KAB_EMBEDDED | 153 | #else //KAB_EMBEDDED |
151 | qDebug("ViewConfigureDialog::slotHelp not yet implemented"); | 154 | qDebug("ViewConfigureDialog::slotHelp not yet implemented"); |
152 | #endif //KAB_EMBEDDED | 155 | #endif //KAB_EMBEDDED |
153 | } | 156 | } |
154 | 157 | ||
155 | #ifndef KAB_EMBEDDED | 158 | #ifndef KAB_EMBEDDED_ |
156 | #include "viewconfigurewidget.moc" | 159 | #include "moc_viewconfigurewidget.cpp" |
157 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
158 | |||
159 | |||
diff --git a/kaddressbook/viewconfigurewidget.h b/kaddressbook/viewconfigurewidget.h index 0c2b77c..e3b9b12 100644 --- a/kaddressbook/viewconfigurewidget.h +++ b/kaddressbook/viewconfigurewidget.h | |||
@@ -19,25 +19,25 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VIEWCONFIGUREWIDGET_H | 24 | #ifndef VIEWCONFIGUREWIDGET_H |
25 | #define VIEWCONFIGUREWIDGET_H | 25 | #define VIEWCONFIGUREWIDGET_H |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | #include "configurewidget.h" | 29 | #include "configurewidget.h" |
30 | 30 | ||
31 | class QVBox; | 31 | class Q3VBox; |
32 | 32 | ||
33 | #include <kdialogbase.h> | 33 | #include <kdialogbase.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | 35 | ||
36 | class KJanusWidget; | 36 | class KJanusWidget; |
37 | class QString; | 37 | class QString; |
38 | class ViewConfigureFieldsPage; | 38 | class ViewConfigureFieldsPage; |
39 | class ViewConfigureFilterPage; | 39 | class ViewConfigureFilterPage; |
40 | class ViewConfigureDialog; | 40 | class ViewConfigureDialog; |
41 | /** | 41 | /** |
42 | This widget is the base class for all view configuration widgets. The | 42 | This widget is the base class for all view configuration widgets. The |
43 | author of a view may wish to inherit from this widget and add config pages | 43 | author of a view may wish to inherit from this widget and add config pages |
@@ -65,25 +65,25 @@ class ViewConfigureWidget : public ConfigureWidget | |||
65 | /** | 65 | /** |
66 | Writes the configuration from the GUI to the config object. If this | 66 | Writes the configuration from the GUI to the config object. If this |
67 | method is overloaded, be sure to call the base class's method. | 67 | method is overloaded, be sure to call the base class's method. |
68 | 68 | ||
69 | Do not change the group of the config object in this method. | 69 | Do not change the group of the config object in this method. |
70 | */ | 70 | */ |
71 | virtual void saveSettings( KConfig *config ); | 71 | virtual void saveSettings( KConfig *config ); |
72 | 72 | ||
73 | 73 | ||
74 | /** | 74 | /** |
75 | Use this method to add new pages to the widget. | 75 | Use this method to add new pages to the widget. |
76 | */ | 76 | */ |
77 | QVBox *addPage( const QString &item, const QString &header = QString::null, | 77 | Q3VBox *addPage( const QString &item, const QString &header = QString::null, |
78 | const QPixmap &pixmap = QPixmap() ); | 78 | const QPixmap &pixmap = QPixmap() ); |
79 | 79 | ||
80 | private: | 80 | private: |
81 | KJanusWidget *mMainWidget; | 81 | KJanusWidget *mMainWidget; |
82 | 82 | ||
83 | ViewConfigureFieldsPage *mFieldsPage; | 83 | ViewConfigureFieldsPage *mFieldsPage; |
84 | ViewConfigureFilterPage *mFilterPage; | 84 | ViewConfigureFilterPage *mFilterPage; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | class ViewConfigureDialog : public KDialogBase | 87 | class ViewConfigureDialog : public KDialogBase |
88 | { | 88 | { |
89 | Q_OBJECT | 89 | Q_OBJECT |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index b5d9419..5cfe3ad 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -41,36 +41,40 @@ $Id$ | |||
41 | #include <ktrader.h> | 41 | #include <ktrader.h> |
42 | #include <kurldrag.h> | 42 | #include <kurldrag.h> |
43 | 43 | ||
44 | #include "addresseeutil.h" | 44 | #include "addresseeutil.h" |
45 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
46 | #include "views/kaddressbookiconview.h" | 46 | #include "views/kaddressbookiconview.h" |
47 | #include "views/kaddressbooktableview.h" | 47 | #include "views/kaddressbooktableview.h" |
48 | #include "views/kaddressbookcardview.h" | 48 | #include "views/kaddressbookcardview.h" |
49 | #include "kaddressbookview.h" | 49 | #include "kaddressbookview.h" |
50 | 50 | ||
51 | #include <qaction.h> | 51 | #include <qaction.h> |
52 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
53 | #include <qpopupmenu.h> | 53 | #include <q3popupmenu.h> |
54 | //Added by qt3to4: | ||
55 | #include <Q3HBoxLayout> | ||
56 | #include <QDropEvent> | ||
54 | #include <kconfigbase.h> | 57 | #include <kconfigbase.h> |
55 | 58 | ||
56 | #endif //KAB_EMBEDDED | 59 | #endif //KAB_EMBEDDED |
57 | 60 | ||
58 | 61 | ||
59 | #include <kdebug.h> | 62 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 63 | #include <kactionclasses.h> |
61 | 64 | ||
62 | #include <qlayout.h> | 65 | #include <qlayout.h> |
63 | #include <qapplication.h> | 66 | #include <qapplication.h> |
64 | #include <qwidgetstack.h> | 67 | #include <QDesktopWidget> |
68 | #include <q3widgetstack.h> | ||
65 | 69 | ||
66 | #include <kabc/addressbook.h> | 70 | #include <kabc/addressbook.h> |
67 | #include "filtereditdialog.h" | 71 | #include "filtereditdialog.h" |
68 | #include "addviewdialog.h" | 72 | #include "addviewdialog.h" |
69 | #include "kabcore.h" | 73 | #include "kabcore.h" |
70 | #include "kabprefs.h" | 74 | #include "kabprefs.h" |
71 | #include "viewmanager.h" | 75 | #include "viewmanager.h" |
72 | 76 | ||
73 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) | 77 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) |
74 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) | 78 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) |
75 | { | 79 | { |
76 | initGUI(); | 80 | initGUI(); |
@@ -108,39 +112,39 @@ void ViewManager::restoreSettings() | |||
108 | mActionSelectFilter->setItems( filterNames() ); | 112 | mActionSelectFilter->setItems( filterNames() ); |
109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 113 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
110 | int cw = 150; | 114 | int cw = 150; |
111 | if ( QApplication::desktop()->width() >= 800 ) | 115 | if ( QApplication::desktop()->width() >= 800 ) |
112 | cw = 200; | 116 | cw = 200; |
113 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) | 117 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
114 | cw = 0; | 118 | cw = 0; |
115 | mActionSelectFilter->setComboWidth( cw ); | 119 | mActionSelectFilter->setComboWidth( cw ); |
116 | // Tell the views to reread their config, since they may have | 120 | // Tell the views to reread their config, since they may have |
117 | // been modified by global settings | 121 | // been modified by global settings |
118 | QString _oldgroup = mCore->config()->group(); | 122 | QString _oldgroup = mCore->config()->group(); |
119 | 123 | ||
120 | QDictIterator<KAddressBookView> it( mViewDict ); | 124 | Q3DictIterator<KAddressBookView> it( mViewDict ); |
121 | for ( it.toFirst(); it.current(); ++it ) { | 125 | for ( it.toFirst(); it.current(); ++it ) { |
122 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 126 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
123 | it.current()->readConfig( mCore->config() ); | 127 | it.current()->readConfig( mCore->config() ); |
124 | } | 128 | } |
125 | setActiveView( activeViewName ); | 129 | setActiveView( activeViewName ); |
126 | 130 | ||
127 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 131 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
128 | } | 132 | } |
129 | 133 | ||
130 | void ViewManager::saveSettings() | 134 | void ViewManager::saveSettings() |
131 | { | 135 | { |
132 | QString _oldgroup = mCore->config()->group(); | 136 | QString _oldgroup = mCore->config()->group(); |
133 | 137 | ||
134 | QDictIterator<KAddressBookView> it( mViewDict ); | 138 | Q3DictIterator<KAddressBookView> it( mViewDict ); |
135 | for ( it.toFirst(); it.current(); ++it ) { | 139 | for ( it.toFirst(); it.current(); ++it ) { |
136 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 140 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
137 | #ifdef DESKTOP_VERSION | 141 | #ifdef DESKTOP_VERSION |
138 | (*it)->writeConfig( mCore->config() ); | 142 | (*it)->writeConfig( mCore->config() ); |
139 | #else | 143 | #else |
140 | (*it).writeConfig( mCore->config() ); | 144 | (*it).writeConfig( mCore->config() ); |
141 | #endif | 145 | #endif |
142 | } | 146 | } |
143 | 147 | ||
144 | Filter::save( mCore->config(), "Filter", mFilterList ); | 148 | Filter::save( mCore->config(), "Filter", mFilterList ); |
145 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); | 149 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); |
146 | 150 | ||
@@ -152,25 +156,25 @@ void ViewManager::saveSettings() | |||
152 | 156 | ||
153 | QStringList ViewManager::selectedUids() const | 157 | QStringList ViewManager::selectedUids() const |
154 | { | 158 | { |
155 | if ( mActiveView ) | 159 | if ( mActiveView ) |
156 | return mActiveView->selectedUids(); | 160 | return mActiveView->selectedUids(); |
157 | else | 161 | else |
158 | return QStringList(); | 162 | return QStringList(); |
159 | } | 163 | } |
160 | 164 | ||
161 | QStringList ViewManager::selectedEmails() const | 165 | QStringList ViewManager::selectedEmails() const |
162 | { | 166 | { |
163 | if ( mActiveView ) | 167 | if ( mActiveView ) |
164 | return mActiveView->selectedEmails(); | 168 | return QStringList(mActiveView->selectedEmails()); |
165 | else | 169 | else |
166 | return QStringList(); | 170 | return QStringList(); |
167 | } | 171 | } |
168 | 172 | ||
169 | KABC::Addressee::List ViewManager::selectedAddressees() const | 173 | KABC::Addressee::List ViewManager::selectedAddressees() const |
170 | { | 174 | { |
171 | KABC::Addressee::List list; | 175 | KABC::Addressee::List list; |
172 | if ( mActiveView ) { | 176 | if ( mActiveView ) { |
173 | QStringList uids = mActiveView->selectedUids(); | 177 | QStringList uids = mActiveView->selectedUids(); |
174 | QStringList::Iterator it; | 178 | QStringList::Iterator it; |
175 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 179 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
176 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 180 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
@@ -547,25 +551,25 @@ void ViewManager::startDrag() | |||
547 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 551 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
548 | 552 | ||
549 | #ifndef KAB_EMBEDDED | 553 | #ifndef KAB_EMBEDDED |
550 | 554 | ||
551 | // Get the list of all the selected addressees | 555 | // Get the list of all the selected addressees |
552 | KABC::Addressee::List addrList; | 556 | KABC::Addressee::List addrList; |
553 | QStringList uidList = selectedUids(); | 557 | QStringList uidList = selectedUids(); |
554 | QStringList::Iterator iter; | 558 | QStringList::Iterator iter; |
555 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 559 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
556 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 560 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
557 | 561 | ||
558 | KMultipleDrag *drag = new KMultipleDrag( this ); | 562 | KMultipleDrag *drag = new KMultipleDrag( this ); |
559 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 563 | drag->addDragObject( new Q3TextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
560 | KABC::Addressee::List::Iterator it; | 564 | KABC::Addressee::List::Iterator it; |
561 | QStringList vcards; | 565 | QStringList vcards; |
562 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 566 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
563 | QString vcard = QString::null; | 567 | QString vcard = QString::null; |
564 | KABC::VCardConverter converter; | 568 | KABC::VCardConverter converter; |
565 | if ( converter.addresseeToVCard( *it, vcard ) ) | 569 | if ( converter.addresseeToVCard( *it, vcard ) ) |
566 | vcards.append( vcard ); | 570 | vcards.append( vcard ); |
567 | } | 571 | } |
568 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 572 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
569 | 573 | ||
570 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 574 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
571 | drag->dragCopy(); | 575 | drag->dragCopy(); |
@@ -650,27 +654,27 @@ int ViewManager::filterPosition( const QString &name ) const | |||
650 | if ( name == (*it).name() ) | 654 | if ( name == (*it).name() ) |
651 | return pos + 1; | 655 | return pos + 1; |
652 | 656 | ||
653 | return 0; | 657 | return 0; |
654 | } | 658 | } |
655 | 659 | ||
656 | void ViewManager::initActions() | 660 | void ViewManager::initActions() |
657 | { | 661 | { |
658 | //US <ActionList name="view_loadedviews"/> | 662 | //US <ActionList name="view_loadedviews"/> |
659 | //US <Separator/> | 663 | //US <Separator/> |
660 | 664 | ||
661 | #ifdef KAB_EMBEDDED | 665 | #ifdef KAB_EMBEDDED |
662 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 666 | Q3PopupMenu *viewmenu = (Q3PopupMenu*)mCore->getViewMenu(); |
663 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 667 | Q3PopupMenu *settingsmenu = (Q3PopupMenu*)mCore->getSettingsMenu(); |
664 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 668 | Q3PopupMenu *filtermenu = (Q3PopupMenu*)mCore->getFilterMenu(); |
665 | #endif //KAB_EMBEDDED | 669 | #endif //KAB_EMBEDDED |
666 | 670 | ||
667 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 671 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
668 | #if KDE_VERSION >= 309 | 672 | #if KDE_VERSION >= 309 |
669 | mActionSelectView->setMenuAccelsEnabled( false ); | 673 | mActionSelectView->setMenuAccelsEnabled( false ); |
670 | #endif | 674 | #endif |
671 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 675 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
672 | SLOT( selectView( const QString& ) ) ); | 676 | SLOT( selectView( const QString& ) ) ); |
673 | 677 | ||
674 | 678 | ||
675 | #ifdef KAB_EMBEDDED | 679 | #ifdef KAB_EMBEDDED |
676 | mActionSelectView->plug(viewmenu); | 680 | mActionSelectView->plug(viewmenu); |
@@ -729,20 +733,20 @@ void ViewManager::initActions() | |||
729 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), | 733 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), |
730 | SLOT( setActiveFilter( int ) ) ); | 734 | SLOT( setActiveFilter( int ) ) ); |
731 | 735 | ||
732 | #ifdef KAB_EMBEDDED | 736 | #ifdef KAB_EMBEDDED |
733 | action->plug(settingsmenu); | 737 | action->plug(settingsmenu); |
734 | mActionSelectFilter->plug(viewmenu,0); | 738 | mActionSelectFilter->plug(viewmenu,0); |
735 | #endif //KAB_EMBEDDED | 739 | #endif //KAB_EMBEDDED |
736 | 740 | ||
737 | } | 741 | } |
738 | 742 | ||
739 | void ViewManager::initGUI() | 743 | void ViewManager::initGUI() |
740 | { | 744 | { |
741 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 745 | Q3HBoxLayout *layout = new Q3HBoxLayout( this, 0, 0 ); |
742 | mViewWidgetStack = new QWidgetStack( this ); | 746 | mViewWidgetStack = new Q3WidgetStack( this ); |
743 | layout->addWidget( mViewWidgetStack ); | 747 | layout->addWidget( mViewWidgetStack ); |
744 | } | 748 | } |
745 | 749 | ||
746 | #ifndef KAB_EMBEDDED | 750 | #ifndef KAB_EMBEDDED_ |
747 | #include "viewmanager.moc" | 751 | #include "moc_viewmanager.cpp" |
748 | #endif //KAB_EMBEDDED | 752 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index ab5d372..4bbdbc7 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -17,33 +17,35 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VIEWMANAGER_H | 24 | #ifndef VIEWMANAGER_H |
25 | #define VIEWMANAGER_H | 25 | #define VIEWMANAGER_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | //Added by qt3to4: | ||
30 | #include <QDropEvent> | ||
29 | #include <kaddressbookview.h> | 31 | #include <kaddressbookview.h> |
30 | #include <qdict.h> | 32 | #include <q3dict.h> |
31 | #include "filter.h" | 33 | #include "filter.h" |
32 | 34 | ||
33 | class KAction; | 35 | class KAction; |
34 | class KSelectAction; | 36 | class KSelectAction; |
35 | 37 | ||
36 | class KABCore; | 38 | class KABCore; |
37 | class QWidgetStack; | 39 | class Q3WidgetStack; |
38 | class QDropEvent; | 40 | class QDropEvent; |
39 | 41 | ||
40 | namespace KABC { class AddressBook; } | 42 | namespace KABC { class AddressBook; } |
41 | 43 | ||
42 | /** | 44 | /** |
43 | The view manager manages the views and everything related to them. The | 45 | The view manager manages the views and everything related to them. The |
44 | manager will load the views at startup and display a view when told to | 46 | manager will load the views at startup and display a view when told to |
45 | make one active. | 47 | make one active. |
46 | 48 | ||
47 | The view manager will also create and manage all dialogs directly related to | 49 | The view manager will also create and manage all dialogs directly related to |
48 | views (ie: AddView, ConfigureView, DeleteView, etc). | 50 | views (ie: AddView, ConfigureView, DeleteView, etc). |
49 | */ | 51 | */ |
@@ -136,26 +138,26 @@ class ViewManager : public QWidget | |||
136 | QStringList filterNames() const; | 138 | QStringList filterNames() const; |
137 | int filterPosition( const QString &name ) const; | 139 | int filterPosition( const QString &name ) const; |
138 | QStringList viewNames() const; | 140 | QStringList viewNames() const; |
139 | int viewPosition( const QString &name ) const; | 141 | int viewPosition( const QString &name ) const; |
140 | void initActions(); | 142 | void initActions(); |
141 | void initGUI(); | 143 | void initGUI(); |
142 | 144 | ||
143 | KABCore *mCore; | 145 | KABCore *mCore; |
144 | 146 | ||
145 | Filter mCurrentFilter; | 147 | Filter mCurrentFilter; |
146 | Filter::List mFilterList; | 148 | Filter::List mFilterList; |
147 | 149 | ||
148 | QDict<KAddressBookView> mViewDict; | 150 | Q3Dict<KAddressBookView> mViewDict; |
149 | QDict<ViewFactory> mViewFactoryDict; | 151 | Q3Dict<ViewFactory> mViewFactoryDict; |
150 | QStringList mViewNameList; | 152 | QStringList mViewNameList; |
151 | 153 | ||
152 | QWidgetStack *mViewWidgetStack; | 154 | Q3WidgetStack *mViewWidgetStack; |
153 | KAddressBookView *mActiveView; | 155 | KAddressBookView *mActiveView; |
154 | 156 | ||
155 | KAction *mActionDeleteView; | 157 | KAction *mActionDeleteView; |
156 | KSelectAction *mActionSelectFilter; | 158 | KSelectAction *mActionSelectFilter; |
157 | KSelectAction *mActionSelectView; | 159 | KSelectAction *mActionSelectView; |
158 | 160 | ||
159 | }; | 161 | }; |
160 | 162 | ||
161 | #endif | 163 | #endif |
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp index b6e053f..1a29f41 100644 --- a/kaddressbook/views/cardview.cpp +++ b/kaddressbook/views/cardview.cpp | |||
@@ -25,24 +25,32 @@ | |||
25 | #include "cardview.h" | 25 | #include "cardview.h" |
26 | 26 | ||
27 | #include <limits.h> | 27 | #include <limits.h> |
28 | 28 | ||
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qstyle.h> | 33 | #include <qstyle.h> |
34 | #include <qcursor.h> | 34 | #include <qcursor.h> |
35 | #include <qtooltip.h> | 35 | #include <qtooltip.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | //Added by qt3to4: | ||
38 | #include <QKeyEvent> | ||
39 | #include <Q3PtrList> | ||
40 | #include <QResizeEvent> | ||
41 | #include <QFocusEvent> | ||
42 | #include <QMouseEvent> | ||
43 | #include <QEvent> | ||
44 | #include <QWheelEvent> | ||
37 | 45 | ||
38 | #include "kabprefs.h" | 46 | #include "kabprefs.h" |
39 | #include <kdebug.h> | 47 | #include <kdebug.h> |
40 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
41 | //END includes | 49 | //END includes |
42 | 50 | ||
43 | #define MIN_ITEM_WIDTH 80 | 51 | #define MIN_ITEM_WIDTH 80 |
44 | 52 | ||
45 | //BEGIN Helpers | 53 | //BEGIN Helpers |
46 | ////////////////////////////////////// | 54 | ////////////////////////////////////// |
47 | // CardViewTip | 55 | // CardViewTip |
48 | class CardViewTip : public QLabel { | 56 | class CardViewTip : public QLabel { |
@@ -62,29 +70,29 @@ class CardViewTip : public QLabel { | |||
62 | hide(); | 70 | hide(); |
63 | } | 71 | } |
64 | }; | 72 | }; |
65 | 73 | ||
66 | ////////////////////////////////////// | 74 | ////////////////////////////////////// |
67 | // CardViewItemList | 75 | // CardViewItemList |
68 | 76 | ||
69 | 77 | ||
70 | // | 78 | // |
71 | // Warning: make sure you use findRef() instead of find() to find an | 79 | // Warning: make sure you use findRef() instead of find() to find an |
72 | // item! Only the pointer value is unique in the list. | 80 | // item! Only the pointer value is unique in the list. |
73 | // | 81 | // |
74 | class CardViewItemList : public QPtrList<CardViewItem> | 82 | class CardViewItemList : public Q3PtrList<CardViewItem> |
75 | { | 83 | { |
76 | protected: | 84 | protected: |
77 | virtual int compareItems(QPtrCollection::Item item1, | 85 | virtual int compareItems(Q3PtrCollection::Item item1, |
78 | QPtrCollection::Item item2) | 86 | Q3PtrCollection::Item item2) |
79 | { | 87 | { |
80 | CardViewItem *cItem1 = (CardViewItem*)item1; | 88 | CardViewItem *cItem1 = (CardViewItem*)item1; |
81 | CardViewItem *cItem2 = (CardViewItem*)item2; | 89 | CardViewItem *cItem2 = (CardViewItem*)item2; |
82 | 90 | ||
83 | if ( cItem1 == cItem2 ) | 91 | if ( cItem1 == cItem2 ) |
84 | return 0; | 92 | return 0; |
85 | 93 | ||
86 | if ((cItem1 == 0) || (cItem2 == 0)) | 94 | if ((cItem1 == 0) || (cItem2 == 0)) |
87 | return cItem1 ? -1 : 1; | 95 | return cItem1 ? -1 : 1; |
88 | 96 | ||
89 | if (cItem1->caption() < cItem2->caption()) | 97 | if (cItem1->caption() < cItem2->caption()) |
90 | return -1; | 98 | return -1; |
@@ -152,25 +160,25 @@ class CardViewPrivate | |||
152 | mItemMargin( 0 ), | 160 | mItemMargin( 0 ), |
153 | mItemSpacing( 10 ), | 161 | mItemSpacing( 10 ), |
154 | mItemWidth( 200 ), | 162 | mItemWidth( 200 ), |
155 | mMaxFieldLines( INT_MAX ), | 163 | mMaxFieldLines( INT_MAX ), |
156 | mCurrentItem( 0L ), | 164 | mCurrentItem( 0L ), |
157 | mLastClickPos( QPoint(0, 0) ), | 165 | mLastClickPos( QPoint(0, 0) ), |
158 | mResizeAnchor(0), | 166 | mResizeAnchor(0), |
159 | mRubberBandAnchor( 0 ), | 167 | mRubberBandAnchor( 0 ), |
160 | mCompText( QString::null ) | 168 | mCompText( QString::null ) |
161 | {}; | 169 | {}; |
162 | 170 | ||
163 | CardViewItemList mItemList; | 171 | CardViewItemList mItemList; |
164 | QPtrList<CardViewSeparator> mSeparatorList; | 172 | Q3PtrList<CardViewSeparator> mSeparatorList; |
165 | QFontMetrics *mFm; | 173 | QFontMetrics *mFm; |
166 | QFontMetrics *mBFm; // bold font | 174 | QFontMetrics *mBFm; // bold font |
167 | QFont mHeaderFont; // custom header font | 175 | QFont mHeaderFont; // custom header font |
168 | CardView::SelectionMode mSelectionMode; | 176 | CardView::SelectionMode mSelectionMode; |
169 | bool mDrawCardBorder; | 177 | bool mDrawCardBorder; |
170 | bool mDrawFieldLabels; | 178 | bool mDrawFieldLabels; |
171 | bool mDrawSeparators; | 179 | bool mDrawSeparators; |
172 | int mSepWidth; | 180 | int mSepWidth; |
173 | bool mShowEmptyFields; | 181 | bool mShowEmptyFields; |
174 | bool mLayoutDirty; | 182 | bool mLayoutDirty; |
175 | bool mLastClickOnItem; | 183 | bool mLastClickOnItem; |
176 | uint mItemMargin; // internal margin in items | 184 | uint mItemMargin; // internal margin in items |
@@ -199,25 +207,25 @@ class CardViewPrivate | |||
199 | }; | 207 | }; |
200 | 208 | ||
201 | class CardViewItemPrivate | 209 | class CardViewItemPrivate |
202 | { | 210 | { |
203 | public: | 211 | public: |
204 | CardViewItemPrivate() : | 212 | CardViewItemPrivate() : |
205 | mSelected( false ), | 213 | mSelected( false ), |
206 | x( 0 ), | 214 | x( 0 ), |
207 | y( 0 ){}; | 215 | y( 0 ){}; |
208 | 216 | ||
209 | 217 | ||
210 | QString mCaption; | 218 | QString mCaption; |
211 | QPtrList< CardViewItem::Field > mFieldList; | 219 | Q3PtrList< CardViewItem::Field > mFieldList; |
212 | bool mSelected; | 220 | bool mSelected; |
213 | int x; // horizontal position, set by the view | 221 | int x; // horizontal position, set by the view |
214 | int y; // vertical position, set by the view | 222 | int y; // vertical position, set by the view |
215 | int maxLabelWidth; // the width of the widest label, according to the view font. | 223 | int maxLabelWidth; // the width of the widest label, according to the view font. |
216 | int hcache; // height cache | 224 | int hcache; // height cache |
217 | }; | 225 | }; |
218 | //END Private Data | 226 | //END Private Data |
219 | 227 | ||
220 | //BEGIN CardViewItem | 228 | //BEGIN CardViewItem |
221 | 229 | ||
222 | CardViewItem::CardViewItem(CardView *parent, QString caption) | 230 | CardViewItem::CardViewItem(CardView *parent, QString caption) |
223 | : d(new CardViewItemPrivate()), mView(parent) | 231 | : d(new CardViewItemPrivate()), mView(parent) |
@@ -304,25 +312,25 @@ void CardViewItem::paintCard(QPainter *p, QColorGroup &cg) | |||
304 | p->save(); | 312 | p->save(); |
305 | QFont bFont = mView->headerFont(); | 313 | QFont bFont = mView->headerFont(); |
306 | //bFont.setBold(true); | 314 | //bFont.setBold(true); |
307 | p->setFont(bFont); | 315 | p->setFont(bFont); |
308 | if (isSelected()) | 316 | if (isSelected()) |
309 | p->setPen(cg.highlightedText()); | 317 | p->setPen(cg.highlightedText()); |
310 | else | 318 | else |
311 | p->setPen(cg.buttonText()); | 319 | p->setPen(cg.buttonText()); |
312 | p->drawText(2+mg, 2+mg + bFm.ascent()/*bFm.height()*//*-bFm.descent()*//*-bFm.leading()*/, trimString(d->mCaption, w-4, bFm)); | 320 | p->drawText(2+mg, 2+mg + bFm.ascent()/*bFm.height()*//*-bFm.descent()*//*-bFm.leading()*/, trimString(d->mCaption, w-4, bFm)); |
313 | p->restore(); | 321 | p->restore(); |
314 | 322 | ||
315 | // Go through the fields and draw them | 323 | // Go through the fields and draw them |
316 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 324 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
317 | QString label, value; | 325 | QString label, value; |
318 | int yPos = mg + 4 + bFm.height()/* + 1*/ + fm.height(); // why the + 1 ??? (anders) | 326 | int yPos = mg + 4 + bFm.height()/* + 1*/ + fm.height(); // why the + 1 ??? (anders) |
319 | p->setPen(cg.text()); | 327 | p->setPen(cg.text()); |
320 | 328 | ||
321 | int fh = fm.height(); | 329 | int fh = fm.height(); |
322 | int cln( 0 ); | 330 | int cln( 0 ); |
323 | QString tmp; | 331 | QString tmp; |
324 | int maxLines = mView->maxFieldLines(); | 332 | int maxLines = mView->maxFieldLines(); |
325 | for (iter.toFirst(); iter.current(); ++iter) | 333 | for (iter.toFirst(); iter.current(); ++iter) |
326 | { | 334 | { |
327 | value = (*iter)->second; | 335 | value = (*iter)->second; |
328 | if ( value.isEmpty() && ! mView->d->mShowEmptyFields ) | 336 | if ( value.isEmpty() && ! mView->d->mShowEmptyFields ) |
@@ -399,30 +407,30 @@ int CardViewItem::height( bool allowCache ) const | |||
399 | int baseHeight = 8 + ( 2 * mView->itemMargin() ); | 407 | int baseHeight = 8 + ( 2 * mView->itemMargin() ); |
400 | 408 | ||
401 | // size of font for each field | 409 | // size of font for each field |
402 | // 2 pad for each field | 410 | // 2 pad for each field |
403 | 411 | ||
404 | // anders: if the view does not show empty fields, check for value | 412 | // anders: if the view does not show empty fields, check for value |
405 | bool sef = mView->showEmptyFields(); | 413 | bool sef = mView->showEmptyFields(); |
406 | int fh = mView->d->mFm->height();//lineSpacing(); // font height | 414 | int fh = mView->d->mFm->height();//lineSpacing(); // font height |
407 | //int sp = QMAX( 0, 2- mView->d->mFm->leading() ); // field spacing NOTE make a property | 415 | //int sp = QMAX( 0, 2- mView->d->mFm->leading() ); // field spacing NOTE make a property |
408 | int fieldHeight = 0; | 416 | int fieldHeight = 0; |
409 | int lines; | 417 | int lines; |
410 | int maxLines( mView->maxFieldLines() ); | 418 | int maxLines( mView->maxFieldLines() ); |
411 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 419 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
412 | for (iter.toFirst(); iter.current(); ++iter) | 420 | for (iter.toFirst(); iter.current(); ++iter) |
413 | { | 421 | { |
414 | if ( !sef && (*iter)->second.isEmpty() ) | 422 | if ( !sef && (*iter)->second.isEmpty() ) |
415 | continue; | 423 | continue; |
416 | lines = QMIN( (*iter)->second.contains('\n') + 1, maxLines ); | 424 | lines = QMIN( (*iter)->second.count('\n') + 1, maxLines ); |
417 | fieldHeight += ( lines * fh ) + 2;//sp; | 425 | fieldHeight += ( lines * fh ) + 2;//sp; |
418 | } | 426 | } |
419 | 427 | ||
420 | // height of caption font (bold) | 428 | // height of caption font (bold) |
421 | fieldHeight += mView->d->mBFm->height(); | 429 | fieldHeight += mView->d->mBFm->height(); |
422 | d->hcache = baseHeight + fieldHeight; | 430 | d->hcache = baseHeight + fieldHeight; |
423 | return d->hcache; | 431 | return d->hcache; |
424 | } | 432 | } |
425 | 433 | ||
426 | bool CardViewItem::isSelected() const | 434 | bool CardViewItem::isSelected() const |
427 | { | 435 | { |
428 | return d->mSelected; | 436 | return d->mSelected; |
@@ -441,25 +449,25 @@ void CardViewItem::insertField(const QString &label, const QString &value) | |||
441 | 449 | ||
442 | if (mView) | 450 | if (mView) |
443 | { | 451 | { |
444 | mView->setLayoutDirty(true); | 452 | mView->setLayoutDirty(true); |
445 | d->maxLabelWidth = QMAX( mView->d->mFm->width( label ), d->maxLabelWidth ); | 453 | d->maxLabelWidth = QMAX( mView->d->mFm->width( label ), d->maxLabelWidth ); |
446 | } | 454 | } |
447 | } | 455 | } |
448 | 456 | ||
449 | void CardViewItem::removeField(const QString &label) | 457 | void CardViewItem::removeField(const QString &label) |
450 | { | 458 | { |
451 | CardViewItem::Field *f; | 459 | CardViewItem::Field *f; |
452 | 460 | ||
453 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 461 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
454 | for (iter.toFirst(); iter.current(); ++iter) | 462 | for (iter.toFirst(); iter.current(); ++iter) |
455 | { | 463 | { |
456 | f = *iter; | 464 | f = *iter; |
457 | if (f->first == label) | 465 | if (f->first == label) |
458 | break; | 466 | break; |
459 | } | 467 | } |
460 | 468 | ||
461 | if (*iter) | 469 | if (*iter) |
462 | d->mFieldList.remove(*iter); | 470 | d->mFieldList.remove(*iter); |
463 | d->hcache = 0; | 471 | d->hcache = 0; |
464 | 472 | ||
465 | if (mView) | 473 | if (mView) |
@@ -514,25 +522,25 @@ void CardViewItem::repaintCard() | |||
514 | if (mView) | 522 | if (mView) |
515 | mView->repaintItem(this); | 523 | mView->repaintItem(this); |
516 | } | 524 | } |
517 | 525 | ||
518 | void CardViewItem::setCaption(const QString &caption) | 526 | void CardViewItem::setCaption(const QString &caption) |
519 | { | 527 | { |
520 | d->mCaption = caption; | 528 | d->mCaption = caption; |
521 | repaintCard(); | 529 | repaintCard(); |
522 | } | 530 | } |
523 | 531 | ||
524 | QString CardViewItem::fieldValue(const QString &label) | 532 | QString CardViewItem::fieldValue(const QString &label) |
525 | { | 533 | { |
526 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 534 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
527 | for (iter.toFirst(); iter.current(); ++iter) | 535 | for (iter.toFirst(); iter.current(); ++iter) |
528 | if ((*iter)->first == label) | 536 | if ((*iter)->first == label) |
529 | return (*iter)->second; | 537 | return (*iter)->second; |
530 | 538 | ||
531 | return QString(); | 539 | return QString(); |
532 | } | 540 | } |
533 | 541 | ||
534 | 542 | ||
535 | void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip ) | 543 | void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip ) |
536 | { | 544 | { |
537 | bool trimmed( false ); | 545 | bool trimmed( false ); |
538 | QString s; | 546 | QString s; |
@@ -560,42 +568,42 @@ void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip ) | |||
560 | return; | 568 | return; |
561 | 569 | ||
562 | // y position: | 570 | // y position: |
563 | // header font height + 4px hader margin + 2px leading + item margin | 571 | // header font height + 4px hader margin + 2px leading + item margin |
564 | // + actual field index * (fontheight + 2px leading) | 572 | // + actual field index * (fontheight + 2px leading) |
565 | int maxLines = mView->maxFieldLines(); | 573 | int maxLines = mView->maxFieldLines(); |
566 | bool se = mView->showEmptyFields(); | 574 | bool se = mView->showEmptyFields(); |
567 | int fh = mView->d->mFm->height(); | 575 | int fh = mView->d->mFm->height(); |
568 | // { | 576 | // { |
569 | Field *_f; | 577 | Field *_f; |
570 | for (_f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next()) | 578 | for (_f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next()) |
571 | if ( se || ! _f->second.isEmpty() ) | 579 | if ( se || ! _f->second.isEmpty() ) |
572 | y += ( QMIN(_f->second.contains('\n')+1, maxLines) * fh ) + 2; | 580 | y += ( QMIN(_f->second.count('\n')+1, maxLines) * fh ) + 2; |
573 | // } | 581 | // } |
574 | if ( isLabel && itempos.y() > y + fh ) | 582 | if ( isLabel && itempos.y() > y + fh ) |
575 | return; | 583 | return; |
576 | // label or data? | 584 | // label or data? |
577 | s = isLabel ? f->first : f->second; | 585 | s = isLabel ? f->first : f->second; |
578 | // trimmed? | 586 | // trimmed? |
579 | int colonWidth = mView->d->mFm->width(":"); | 587 | int colonWidth = mView->d->mFm->width(":"); |
580 | lw = drawLabels ? // label width | 588 | lw = drawLabels ? // label width |
581 | QMIN( w/2 - 4 - mrg, d->maxLabelWidth + colonWidth + 4 ) : | 589 | QMIN( w/2 - 4 - mrg, d->maxLabelWidth + colonWidth + 4 ) : |
582 | 0; | 590 | 0; |
583 | int mw = isLabel ? lw - colonWidth : w - lw - (mrg*2); // max width for string | 591 | int mw = isLabel ? lw - colonWidth : w - lw - (mrg*2); // max width for string |
584 | if ( isLabel ) | 592 | if ( isLabel ) |
585 | { | 593 | { |
586 | trimmed = mView->d->mFm->width( s ) > mw - colonWidth; | 594 | trimmed = mView->d->mFm->width( s ) > mw - colonWidth; |
587 | } else { | 595 | } else { |
588 | QRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) ); | 596 | QRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) ); |
589 | trimmed = r.width() > mw || r.height()/fh > QMIN(s.contains('\n') + 1, maxLines); | 597 | trimmed = r.width() > mw || r.height()/fh > QMIN(s.count('\n') + 1, maxLines); |
590 | } | 598 | } |
591 | } | 599 | } |
592 | if ( trimmed ) | 600 | if ( trimmed ) |
593 | { | 601 | { |
594 | tip->setFont( (isLabel && !lw) ? mView->headerFont() : mView->font() ); // if condition is true, a header | 602 | tip->setFont( (isLabel && !lw) ? mView->headerFont() : mView->font() ); // if condition is true, a header |
595 | tip->setText( s ); | 603 | tip->setText( s ); |
596 | tip->adjustSize(); | 604 | tip->adjustSize(); |
597 | // find a proper position | 605 | // find a proper position |
598 | int lx; | 606 | int lx; |
599 | lx = isLabel || !drawLabels ? mrg : lw + mrg + 2 /*-1*/; | 607 | lx = isLabel || !drawLabels ? mrg : lw + mrg + 2 /*-1*/; |
600 | QPoint pnt(mView->contentsToViewport( QPoint(d->x, d->y) )); | 608 | QPoint pnt(mView->contentsToViewport( QPoint(d->x, d->y) )); |
601 | pnt += QPoint(lx, y); | 609 | pnt += QPoint(lx, y); |
@@ -617,61 +625,61 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const | |||
617 | int iy = itempos.y(); | 625 | int iy = itempos.y(); |
618 | // skip below caption | 626 | // skip below caption |
619 | if ( iy <= ypos ) | 627 | if ( iy <= ypos ) |
620 | return 0; | 628 | return 0; |
621 | // try find a field | 629 | // try find a field |
622 | bool showEmpty = mView->showEmptyFields(); | 630 | bool showEmpty = mView->showEmptyFields(); |
623 | int fh = mView->d->mFm->height(); | 631 | int fh = mView->d->mFm->height(); |
624 | int maxLines = mView->maxFieldLines(); | 632 | int maxLines = mView->maxFieldLines(); |
625 | Field *f; | 633 | Field *f; |
626 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) | 634 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) |
627 | { | 635 | { |
628 | if ( showEmpty || !f->second.isEmpty() ) | 636 | if ( showEmpty || !f->second.isEmpty() ) |
629 | ypos += ( QMIN( f->second.contains('\n')+1, maxLines ) *fh)+2; | 637 | ypos += ( QMIN( f->second.count('\n')+1, maxLines ) *fh)+2; |
630 | if ( iy <= ypos ) | 638 | if ( iy <= ypos ) |
631 | break; | 639 | break; |
632 | } | 640 | } |
633 | return f ? f : 0; | 641 | return f ? f : 0; |
634 | } | 642 | } |
635 | //END CardViewItem | 643 | //END CardViewItem |
636 | 644 | ||
637 | //BEGIN CardView | 645 | //BEGIN CardView |
638 | 646 | ||
639 | CardView::CardView(QWidget *parent, const char *name) | 647 | CardView::CardView(QWidget *parent, const char *name) |
640 | : QScrollView(parent, name), | 648 | : Q3ScrollView(parent, name), |
641 | d(new CardViewPrivate()) | 649 | d(new CardViewPrivate()) |
642 | { | 650 | { |
643 | mFlagKeyPressed = false; | 651 | mFlagKeyPressed = false; |
644 | mFlagBlockKeyPressed = false; | 652 | mFlagBlockKeyPressed = false; |
645 | d->mItemList.setAutoDelete(true); | 653 | d->mItemList.setAutoDelete(true); |
646 | d->mSeparatorList.setAutoDelete(true); | 654 | d->mSeparatorList.setAutoDelete(true); |
647 | 655 | ||
648 | QFont f = font(); | 656 | QFont f = font(); |
649 | d->mFm = new QFontMetrics(f); | 657 | d->mFm = new QFontMetrics(f); |
650 | f.setBold(true); | 658 | f.setBold(true); |
651 | d->mHeaderFont = f; | 659 | d->mHeaderFont = f; |
652 | d->mBFm = new QFontMetrics(f); | 660 | d->mBFm = new QFontMetrics(f); |
653 | d->mTip = ( new CardViewTip( viewport() ) ), | 661 | d->mTip = ( new CardViewTip( viewport() ) ), |
654 | d->mTip->hide(); | 662 | d->mTip->hide(); |
655 | d->mTimer = ( new QTimer(this, "mouseTimer") ), | 663 | d->mTimer = ( new QTimer(this, "mouseTimer") ), |
656 | 664 | ||
657 | viewport()->setMouseTracking( true ); | 665 | viewport()->setMouseTracking( true ); |
658 | viewport()->setFocusProxy(this); | 666 | viewport()->setFocusProxy(this); |
659 | viewport()->setFocusPolicy(WheelFocus); | 667 | viewport()->setFocusPolicy(Qt::WheelFocus); |
660 | viewport()->setBackgroundMode(PaletteBase); | 668 | viewport()->setBackgroundMode(Qt::PaletteBase); |
661 | 669 | ||
662 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); | 670 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); |
663 | 671 | ||
664 | //US setBackgroundMode(PaletteBackground, PaletteBase); | 672 | //US setBackgroundMode(PaletteBackground, PaletteBase); |
665 | setBackgroundMode(PaletteBackground); | 673 | setBackgroundMode(Qt::PaletteBackground); |
666 | 674 | ||
667 | // no reason for a vertical scrollbar | 675 | // no reason for a vertical scrollbar |
668 | setVScrollBarMode(AlwaysOff); | 676 | setVScrollBarMode(AlwaysOff); |
669 | } | 677 | } |
670 | 678 | ||
671 | CardView::~CardView() | 679 | CardView::~CardView() |
672 | { | 680 | { |
673 | delete d->mFm; | 681 | delete d->mFm; |
674 | delete d->mBFm; | 682 | delete d->mBFm; |
675 | delete d; | 683 | delete d; |
676 | d = 0; | 684 | d = 0; |
677 | } | 685 | } |
@@ -730,25 +738,25 @@ void CardView::setCurrentItem( CardViewItem *item ) | |||
730 | if ( it ) | 738 | if ( it ) |
731 | it->repaintCard(); | 739 | it->repaintCard(); |
732 | item->repaintCard(); | 740 | item->repaintCard(); |
733 | } | 741 | } |
734 | if ( ! d->mOnSeparator ) | 742 | if ( ! d->mOnSeparator ) |
735 | ensureItemVisible( item ); | 743 | ensureItemVisible( item ); |
736 | emit currentChanged( item ); | 744 | emit currentChanged( item ); |
737 | } | 745 | } |
738 | 746 | ||
739 | CardViewItem *CardView::itemAt(const QPoint &viewPos) | 747 | CardViewItem *CardView::itemAt(const QPoint &viewPos) |
740 | { | 748 | { |
741 | CardViewItem *item = 0; | 749 | CardViewItem *item = 0; |
742 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 750 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
743 | bool found = false; | 751 | bool found = false; |
744 | for (iter.toFirst(); iter.current() && !found; ++iter) | 752 | for (iter.toFirst(); iter.current() && !found; ++iter) |
745 | { | 753 | { |
746 | item = *iter; | 754 | item = *iter; |
747 | //if (item->d->mRect.contains(viewPos)) | 755 | //if (item->d->mRect.contains(viewPos)) |
748 | if (QRect(item->d->x, item->d->y, d->mItemWidth, item->height()).contains(viewPos)) | 756 | if (QRect(item->d->x, item->d->y, d->mItemWidth, item->height()).contains(viewPos)) |
749 | found = true; | 757 | found = true; |
750 | } | 758 | } |
751 | 759 | ||
752 | if (found) | 760 | if (found) |
753 | return item; | 761 | return item; |
754 | 762 | ||
@@ -778,25 +786,25 @@ void CardView::setSelectionMode(CardView::SelectionMode mode) | |||
778 | selectAll(false); | 786 | selectAll(false); |
779 | 787 | ||
780 | d->mSelectionMode = mode; | 788 | d->mSelectionMode = mode; |
781 | } | 789 | } |
782 | 790 | ||
783 | CardView::SelectionMode CardView::selectionMode() const | 791 | CardView::SelectionMode CardView::selectionMode() const |
784 | { | 792 | { |
785 | return d->mSelectionMode; | 793 | return d->mSelectionMode; |
786 | } | 794 | } |
787 | 795 | ||
788 | void CardView::selectAll(bool state) | 796 | void CardView::selectAll(bool state) |
789 | { | 797 | { |
790 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 798 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
791 | if (!state) | 799 | if (!state) |
792 | { | 800 | { |
793 | for (iter.toFirst(); iter.current(); ++iter) | 801 | for (iter.toFirst(); iter.current(); ++iter) |
794 | { | 802 | { |
795 | if ((*iter)->isSelected()) | 803 | if ((*iter)->isSelected()) |
796 | { | 804 | { |
797 | (*iter)->setSelected(false); | 805 | (*iter)->setSelected(false); |
798 | (*iter)->repaintCard(); | 806 | (*iter)->repaintCard(); |
799 | } | 807 | } |
800 | } | 808 | } |
801 | //emit selectionChanged(); // WARNING FIXME | 809 | //emit selectionChanged(); // WARNING FIXME |
802 | emit selectionChanged(0); | 810 | emit selectionChanged(0); |
@@ -869,25 +877,25 @@ void CardView::setSelected(CardViewItem *item, bool selected) | |||
869 | emit selectionChanged(); | 877 | emit selectionChanged(); |
870 | } | 878 | } |
871 | } | 879 | } |
872 | 880 | ||
873 | bool CardView::isSelected(CardViewItem *item) const | 881 | bool CardView::isSelected(CardViewItem *item) const |
874 | { | 882 | { |
875 | return (item && item->isSelected()); | 883 | return (item && item->isSelected()); |
876 | } | 884 | } |
877 | 885 | ||
878 | CardViewItem *CardView::selectedItem() const | 886 | CardViewItem *CardView::selectedItem() const |
879 | { | 887 | { |
880 | // find the first selected item | 888 | // find the first selected item |
881 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 889 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
882 | for (iter.toFirst(); iter.current(); ++iter) | 890 | for (iter.toFirst(); iter.current(); ++iter) |
883 | { | 891 | { |
884 | if ((*iter)->isSelected()) | 892 | if ((*iter)->isSelected()) |
885 | return *iter; | 893 | return *iter; |
886 | } | 894 | } |
887 | 895 | ||
888 | return 0; | 896 | return 0; |
889 | } | 897 | } |
890 | 898 | ||
891 | CardViewItem *CardView::firstItem() const | 899 | CardViewItem *CardView::firstItem() const |
892 | { | 900 | { |
893 | return d->mItemList.first(); | 901 | return d->mItemList.first(); |
@@ -946,83 +954,83 @@ void CardView::drawContents(QPainter *p, int clipx, int clipy, | |||
946 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale | 954 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale |
947 | int cX, cY; | 955 | int cX, cY; |
948 | contentsToViewport ( clipx, clipy, cX, cY ); | 956 | contentsToViewport ( clipx, clipy, cX, cY ); |
949 | QRect clipRect(clipx, clipy, clipw, cliph); | 957 | QRect clipRect(clipx, clipy, clipw, cliph); |
950 | QRect cardRect; | 958 | QRect cardRect; |
951 | QRect sepRect; | 959 | QRect sepRect; |
952 | CardViewItem *item; | 960 | CardViewItem *item; |
953 | CardViewSeparator *sep; | 961 | CardViewSeparator *sep; |
954 | // make sure the viewport is a pure background | 962 | // make sure the viewport is a pure background |
955 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); | 963 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); |
956 | 964 | ||
957 | // Now tell the cards to draw, if they are in the clip region | 965 | // Now tell the cards to draw, if they are in the clip region |
958 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 966 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
959 | for (iter.toFirst(); iter.current(); ++iter) | 967 | for (iter.toFirst(); iter.current(); ++iter) |
960 | { | 968 | { |
961 | item = *iter; | 969 | item = *iter; |
962 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); | 970 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); |
963 | 971 | ||
964 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) | 972 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) |
965 | { | 973 | { |
966 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " | 974 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " |
967 | // << cardRect.y() << endl; | 975 | // << cardRect.y() << endl; |
968 | 976 | ||
969 | // Tell the card to paint | 977 | // Tell the card to paint |
970 | p->save(); | 978 | p->save(); |
971 | p->translate(cardRect.x(), cardRect.y()); | 979 | p->translate(cardRect.x(), cardRect.y()); |
972 | item->paintCard(p, cg); | 980 | item->paintCard(p, cg); |
973 | p->restore(); | 981 | p->restore(); |
974 | } | 982 | } |
975 | } | 983 | } |
976 | 984 | ||
977 | // Followed by the separators if they are in the clip region | 985 | // Followed by the separators if they are in the clip region |
978 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); | 986 | Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); |
979 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) | 987 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) |
980 | { | 988 | { |
981 | sep = *sepIter; | 989 | sep = *sepIter; |
982 | sepRect = sep->mRect; | 990 | sepRect = sep->mRect; |
983 | 991 | ||
984 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) | 992 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) |
985 | { | 993 | { |
986 | p->save(); | 994 | p->save(); |
987 | p->translate(sepRect.x(), sepRect.y()); | 995 | p->translate(sepRect.x(), sepRect.y()); |
988 | sep->paintSeparator(p, cg); | 996 | sep->paintSeparator(p, cg); |
989 | p->restore(); | 997 | p->restore(); |
990 | } | 998 | } |
991 | } | 999 | } |
992 | } | 1000 | } |
993 | 1001 | ||
994 | void CardView::resizeEvent(QResizeEvent *e) | 1002 | void CardView::resizeEvent(QResizeEvent *e) |
995 | { | 1003 | { |
996 | QScrollView::resizeEvent(e); | 1004 | Q3ScrollView::resizeEvent(e); |
997 | 1005 | ||
998 | setLayoutDirty(true); | 1006 | setLayoutDirty(true); |
999 | } | 1007 | } |
1000 | 1008 | ||
1001 | void CardView::calcLayout() | 1009 | void CardView::calcLayout() |
1002 | { | 1010 | { |
1003 | //kdDebug() << "CardView::calcLayout:" << endl; | 1011 | //kdDebug() << "CardView::calcLayout:" << endl; |
1004 | 1012 | ||
1005 | // Start in the upper left corner and layout all the | 1013 | // Start in the upper left corner and layout all the |
1006 | // cars using their height and width | 1014 | // cars using their height and width |
1007 | int maxWidth = 0; | 1015 | int maxWidth = 0; |
1008 | int maxHeight = 0; | 1016 | int maxHeight = 0; |
1009 | int xPos = 0; | 1017 | int xPos = 0; |
1010 | int yPos = 0; | 1018 | int yPos = 0; |
1011 | int cardSpacing = d->mItemSpacing; | 1019 | int cardSpacing = d->mItemSpacing; |
1012 | 1020 | ||
1013 | // delete the old separators | 1021 | // delete the old separators |
1014 | d->mSeparatorList.clear(); | 1022 | d->mSeparatorList.clear(); |
1015 | 1023 | ||
1016 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 1024 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
1017 | CardViewItem *item = 0; | 1025 | CardViewItem *item = 0; |
1018 | CardViewSeparator *sep = 0; | 1026 | CardViewSeparator *sep = 0; |
1019 | xPos += cardSpacing; | 1027 | xPos += cardSpacing; |
1020 | 1028 | ||
1021 | for (iter.toFirst(); iter.current(); ++iter) | 1029 | for (iter.toFirst(); iter.current(); ++iter) |
1022 | { | 1030 | { |
1023 | item = *iter; | 1031 | item = *iter; |
1024 | 1032 | ||
1025 | yPos += cardSpacing; | 1033 | yPos += cardSpacing; |
1026 | 1034 | ||
1027 | if (yPos + item->height() + cardSpacing >= height() - horizontalScrollBar()->height()) | 1035 | if (yPos + item->height() + cardSpacing >= height() - horizontalScrollBar()->height()) |
1028 | { | 1036 | { |
@@ -1047,25 +1055,25 @@ void CardView::calcLayout() | |||
1047 | item->d->x = xPos; | 1055 | item->d->x = xPos; |
1048 | item->d->y = yPos; | 1056 | item->d->y = yPos; |
1049 | 1057 | ||
1050 | yPos += item->height(); | 1058 | yPos += item->height(); |
1051 | maxWidth = QMAX(maxWidth, d->mItemWidth); | 1059 | maxWidth = QMAX(maxWidth, d->mItemWidth); |
1052 | } | 1060 | } |
1053 | 1061 | ||
1054 | xPos += maxWidth; | 1062 | xPos += maxWidth; |
1055 | resizeContents( xPos + cardSpacing, maxHeight ); | 1063 | resizeContents( xPos + cardSpacing, maxHeight ); |
1056 | 1064 | ||
1057 | // Update the height of all the separators now that we know the | 1065 | // Update the height of all the separators now that we know the |
1058 | // max height of a column | 1066 | // max height of a column |
1059 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); | 1067 | Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); |
1060 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) | 1068 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) |
1061 | { | 1069 | { |
1062 | (*sepIter)->mRect.setHeight(maxHeight - 2*cardSpacing - 2*d->mItemMargin); | 1070 | (*sepIter)->mRect.setHeight(maxHeight - 2*cardSpacing - 2*d->mItemMargin); |
1063 | } | 1071 | } |
1064 | 1072 | ||
1065 | d->mLayoutDirty = false; | 1073 | d->mLayoutDirty = false; |
1066 | } | 1074 | } |
1067 | 1075 | ||
1068 | CardViewItem *CardView::itemAfter(CardViewItem *item) | 1076 | CardViewItem *CardView::itemAfter(CardViewItem *item) |
1069 | { | 1077 | { |
1070 | /*int pos = */d->mItemList.findRef(item); | 1078 | /*int pos = */d->mItemList.findRef(item); |
1071 | return d->mItemList.next();//at(pos+1); | 1079 | return d->mItemList.next();//at(pos+1); |
@@ -1092,25 +1100,25 @@ uint CardView::itemSpacing() | |||
1092 | 1100 | ||
1093 | void CardView::setItemSpacing( uint spacing ) | 1101 | void CardView::setItemSpacing( uint spacing ) |
1094 | { | 1102 | { |
1095 | if ( spacing == d->mItemSpacing ) | 1103 | if ( spacing == d->mItemSpacing ) |
1096 | return; | 1104 | return; |
1097 | 1105 | ||
1098 | d->mItemSpacing = spacing; | 1106 | d->mItemSpacing = spacing; |
1099 | setLayoutDirty( true ); | 1107 | setLayoutDirty( true ); |
1100 | } | 1108 | } |
1101 | 1109 | ||
1102 | void CardView::contentsMousePressEvent(QMouseEvent *e) | 1110 | void CardView::contentsMousePressEvent(QMouseEvent *e) |
1103 | { | 1111 | { |
1104 | QScrollView::contentsMousePressEvent(e); | 1112 | Q3ScrollView::contentsMousePressEvent(e); |
1105 | 1113 | ||
1106 | QPoint pos = e->pos(); | 1114 | QPoint pos = e->pos(); |
1107 | d->mLastClickPos = pos; | 1115 | d->mLastClickPos = pos; |
1108 | 1116 | ||
1109 | CardViewItem *item = itemAt(pos); | 1117 | CardViewItem *item = itemAt(pos); |
1110 | 1118 | ||
1111 | if (item == 0) | 1119 | if (item == 0) |
1112 | { | 1120 | { |
1113 | d->mLastClickOnItem = false; | 1121 | d->mLastClickOnItem = false; |
1114 | if ( d->mOnSeparator) | 1122 | if ( d->mOnSeparator) |
1115 | { | 1123 | { |
1116 | d->mResizeAnchor = e->x()+contentsX(); | 1124 | d->mResizeAnchor = e->x()+contentsX(); |
@@ -1162,25 +1170,25 @@ void CardView::contentsMousePressEvent(QMouseEvent *e) | |||
1162 | emit selectionChanged(); | 1170 | emit selectionChanged(); |
1163 | } | 1171 | } |
1164 | 1172 | ||
1165 | else if (d->mSelectionMode == CardView::Extended) | 1173 | else if (d->mSelectionMode == CardView::Extended) |
1166 | { | 1174 | { |
1167 | if ((e->button() & Qt::LeftButton) && | 1175 | if ((e->button() & Qt::LeftButton) && |
1168 | (e->state() & Qt::ShiftButton)) | 1176 | (e->state() & Qt::ShiftButton)) |
1169 | { | 1177 | { |
1170 | if ( item == other ) return; | 1178 | if ( item == other ) return; |
1171 | 1179 | ||
1172 | bool s = ! item->isSelected(); | 1180 | bool s = ! item->isSelected(); |
1173 | 1181 | ||
1174 | if ( s && ! (e->state() & ControlButton) ) | 1182 | if ( s && ! (e->state() & Qt::ControlButton) ) |
1175 | { | 1183 | { |
1176 | bool b = signalsBlocked(); | 1184 | bool b = signalsBlocked(); |
1177 | blockSignals(true); | 1185 | blockSignals(true); |
1178 | selectAll(false); | 1186 | selectAll(false); |
1179 | blockSignals(b); | 1187 | blockSignals(b); |
1180 | } | 1188 | } |
1181 | 1189 | ||
1182 | int from, to, a, b; | 1190 | int from, to, a, b; |
1183 | a = d->mItemList.findRef( item ); | 1191 | a = d->mItemList.findRef( item ); |
1184 | b = d->mItemList.findRef( other ); | 1192 | b = d->mItemList.findRef( other ); |
1185 | from = a < b ? a : b; | 1193 | from = a < b ? a : b; |
1186 | to = a > b ? a : b; | 1194 | to = a > b ? a : b; |
@@ -1210,25 +1218,25 @@ void CardView::contentsMousePressEvent(QMouseEvent *e) | |||
1210 | blockSignals(b); | 1218 | blockSignals(b); |
1211 | 1219 | ||
1212 | item->setSelected(true); | 1220 | item->setSelected(true); |
1213 | item->repaintCard(); | 1221 | item->repaintCard(); |
1214 | emit selectionChanged(); | 1222 | emit selectionChanged(); |
1215 | } | 1223 | } |
1216 | } | 1224 | } |
1217 | 1225 | ||
1218 | } | 1226 | } |
1219 | 1227 | ||
1220 | void CardView::contentsMouseReleaseEvent(QMouseEvent *e) | 1228 | void CardView::contentsMouseReleaseEvent(QMouseEvent *e) |
1221 | { | 1229 | { |
1222 | QScrollView::contentsMouseReleaseEvent(e); | 1230 | Q3ScrollView::contentsMouseReleaseEvent(e); |
1223 | 1231 | ||
1224 | if ( d->mResizeAnchor ) | 1232 | if ( d->mResizeAnchor ) |
1225 | { | 1233 | { |
1226 | // finish the resizing: | 1234 | // finish the resizing: |
1227 | unsetCursor(); | 1235 | unsetCursor(); |
1228 | // hide rubber bands | 1236 | // hide rubber bands |
1229 | int newiw = d->mItemWidth - ((d->mResizeAnchor - d->mRubberBandAnchor)/d->span); | 1237 | int newiw = d->mItemWidth - ((d->mResizeAnchor - d->mRubberBandAnchor)/d->span); |
1230 | drawRubberBands( 0 ); | 1238 | drawRubberBands( 0 ); |
1231 | // we should move to reflect the new position if we are scrolled. | 1239 | // we should move to reflect the new position if we are scrolled. |
1232 | if ( contentsX() ) | 1240 | if ( contentsX() ) |
1233 | { | 1241 | { |
1234 | int newX = QMAX( 0, ( d->pressed * ( newiw + d->colspace + d->mSepWidth ) ) - e->x() ); | 1242 | int newX = QMAX( 0, ( d->pressed * ( newiw + d->colspace + d->mSepWidth ) ) - e->x() ); |
@@ -1248,25 +1256,25 @@ void CardView::contentsMouseReleaseEvent(QMouseEvent *e) | |||
1248 | 1256 | ||
1249 | // Get the item at this position | 1257 | // Get the item at this position |
1250 | CardViewItem *item = itemAt(e->pos()); | 1258 | CardViewItem *item = itemAt(e->pos()); |
1251 | 1259 | ||
1252 | if (item && KABPrefs::instance()->mHonorSingleClick) | 1260 | if (item && KABPrefs::instance()->mHonorSingleClick) |
1253 | { | 1261 | { |
1254 | emit executed(item); | 1262 | emit executed(item); |
1255 | } | 1263 | } |
1256 | } | 1264 | } |
1257 | 1265 | ||
1258 | void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1266 | void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1259 | { | 1267 | { |
1260 | QScrollView::contentsMouseDoubleClickEvent(e); | 1268 | Q3ScrollView::contentsMouseDoubleClickEvent(e); |
1261 | 1269 | ||
1262 | CardViewItem *item = itemAt(e->pos()); | 1270 | CardViewItem *item = itemAt(e->pos()); |
1263 | 1271 | ||
1264 | if (item) | 1272 | if (item) |
1265 | { | 1273 | { |
1266 | d->mCurrentItem = item; | 1274 | d->mCurrentItem = item; |
1267 | } | 1275 | } |
1268 | 1276 | ||
1269 | if (item && !KABPrefs::instance()->mHonorSingleClick) | 1277 | if (item && !KABPrefs::instance()->mHonorSingleClick) |
1270 | { | 1278 | { |
1271 | emit executed(item); | 1279 | emit executed(item); |
1272 | } else | 1280 | } else |
@@ -1293,47 +1301,47 @@ void CardView::contentsMouseMoveEvent( QMouseEvent *e ) | |||
1293 | 1301 | ||
1294 | d->mTimer->start( 500 ); | 1302 | d->mTimer->start( 500 ); |
1295 | 1303 | ||
1296 | // see if we are over a separator | 1304 | // see if we are over a separator |
1297 | // only if we actually have them painted? | 1305 | // only if we actually have them painted? |
1298 | if ( d->mDrawSeparators ) | 1306 | if ( d->mDrawSeparators ) |
1299 | { | 1307 | { |
1300 | int colcontentw = d->mItemWidth + (2*d->mItemSpacing); | 1308 | int colcontentw = d->mItemWidth + (2*d->mItemSpacing); |
1301 | int colw = colcontentw + d->mSepWidth; | 1309 | int colw = colcontentw + d->mSepWidth; |
1302 | int m = e->x()%colw; | 1310 | int m = e->x()%colw; |
1303 | if ( m >= colcontentw && m > 0 ) | 1311 | if ( m >= colcontentw && m > 0 ) |
1304 | { | 1312 | { |
1305 | setCursor( SplitVCursor ); // Why does this fail sometimes? | 1313 | setCursor( Qt::SplitVCursor ); // Why does this fail sometimes? |
1306 | d->mOnSeparator = true; | 1314 | d->mOnSeparator = true; |
1307 | } | 1315 | } |
1308 | else | 1316 | else |
1309 | { | 1317 | { |
1310 | setCursor( ArrowCursor ); | 1318 | setCursor( Qt::ArrowCursor ); |
1311 | d->mOnSeparator = false; | 1319 | d->mOnSeparator = false; |
1312 | } | 1320 | } |
1313 | } | 1321 | } |
1314 | } | 1322 | } |
1315 | 1323 | ||
1316 | void CardView::enterEvent( QEvent * ) | 1324 | void CardView::enterEvent( QEvent * ) |
1317 | { | 1325 | { |
1318 | d->mTimer->start( 500 ); | 1326 | d->mTimer->start( 500 ); |
1319 | } | 1327 | } |
1320 | 1328 | ||
1321 | void CardView::leaveEvent( QEvent * ) | 1329 | void CardView::leaveEvent( QEvent * ) |
1322 | { | 1330 | { |
1323 | d->mTimer->stop(); | 1331 | d->mTimer->stop(); |
1324 | if (d->mOnSeparator) | 1332 | if (d->mOnSeparator) |
1325 | { | 1333 | { |
1326 | d->mOnSeparator = false; | 1334 | d->mOnSeparator = false; |
1327 | setCursor( ArrowCursor ); | 1335 | setCursor( Qt::ArrowCursor ); |
1328 | } | 1336 | } |
1329 | } | 1337 | } |
1330 | 1338 | ||
1331 | void CardView::focusInEvent( QFocusEvent * ) | 1339 | void CardView::focusInEvent( QFocusEvent * ) |
1332 | { | 1340 | { |
1333 | if (!d->mCurrentItem && d->mItemList.count() ) | 1341 | if (!d->mCurrentItem && d->mItemList.count() ) |
1334 | { | 1342 | { |
1335 | setCurrentItem( d->mItemList.first() ); | 1343 | setCurrentItem( d->mItemList.first() ); |
1336 | } | 1344 | } |
1337 | else if ( d->mCurrentItem ) | 1345 | else if ( d->mCurrentItem ) |
1338 | { | 1346 | { |
1339 | d->mCurrentItem->repaintCard(); | 1347 | d->mCurrentItem->repaintCard(); |
@@ -1359,145 +1367,145 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1359 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1367 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1360 | e->accept(); | 1368 | e->accept(); |
1361 | return; | 1369 | return; |
1362 | } | 1370 | } |
1363 | if (! e->isAutoRepeat() ) | 1371 | if (! e->isAutoRepeat() ) |
1364 | mFlagKeyPressed = true; | 1372 | mFlagKeyPressed = true; |
1365 | uint pos = d->mItemList.findRef( d->mCurrentItem ); | 1373 | uint pos = d->mItemList.findRef( d->mCurrentItem ); |
1366 | CardViewItem *aItem = 0L; // item that gets the focus | 1374 | CardViewItem *aItem = 0L; // item that gets the focus |
1367 | CardViewItem *old = d->mCurrentItem; | 1375 | CardViewItem *old = d->mCurrentItem; |
1368 | 1376 | ||
1369 | switch ( e->key() ) | 1377 | switch ( e->key() ) |
1370 | { | 1378 | { |
1371 | case Key_Up: | 1379 | case Qt::Key_Up: |
1372 | if ( pos > 0 ) | 1380 | if ( pos > 0 ) |
1373 | { | 1381 | { |
1374 | aItem = d->mItemList.at( pos - 1 ); | 1382 | aItem = d->mItemList.at( pos - 1 ); |
1375 | setCurrentItem( aItem ); | 1383 | setCurrentItem( aItem ); |
1376 | } | 1384 | } |
1377 | break; | 1385 | break; |
1378 | case Key_Down: | 1386 | case Qt::Key_Down: |
1379 | if ( pos < d->mItemList.count() - 1 ) | 1387 | if ( pos < d->mItemList.count() - 1 ) |
1380 | { | 1388 | { |
1381 | aItem = d->mItemList.at( pos + 1 ); | 1389 | aItem = d->mItemList.at( pos + 1 ); |
1382 | setCurrentItem( aItem ); | 1390 | setCurrentItem( aItem ); |
1383 | } | 1391 | } |
1384 | break; | 1392 | break; |
1385 | case Key_Left: | 1393 | case Qt::Key_Left: |
1386 | { | 1394 | { |
1387 | // look for an item in the previous/next column, starting from | 1395 | // look for an item in the previous/next column, starting from |
1388 | // the vertical middle of the current item. | 1396 | // the vertical middle of the current item. |
1389 | // FIXME use nice calculatd measures!!! | 1397 | // FIXME use nice calculatd measures!!! |
1390 | QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y ); | 1398 | QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y ); |
1391 | aPoint -= QPoint( 30,-(d->mCurrentItem->height()/2) ); | 1399 | aPoint -= QPoint( 30,-(d->mCurrentItem->height()/2) ); |
1392 | aItem = itemAt( aPoint ); | 1400 | aItem = itemAt( aPoint ); |
1393 | // maybe we hit some space below an item | 1401 | // maybe we hit some space below an item |
1394 | while ( !aItem && aPoint.y() > 27 ) | 1402 | while ( !aItem && aPoint.y() > 27 ) |
1395 | { | 1403 | { |
1396 | aPoint -= QPoint( 0, 16 ); | 1404 | aPoint -= QPoint( 0, 16 ); |
1397 | aItem = itemAt( aPoint ); | 1405 | aItem = itemAt( aPoint ); |
1398 | } | 1406 | } |
1399 | if ( aItem ) | 1407 | if ( aItem ) |
1400 | setCurrentItem( aItem ); | 1408 | setCurrentItem( aItem ); |
1401 | } | 1409 | } |
1402 | break; | 1410 | break; |
1403 | case Key_Right: | 1411 | case Qt::Key_Right: |
1404 | { | 1412 | { |
1405 | // FIXME use nice calculated measures!!! | 1413 | // FIXME use nice calculated measures!!! |
1406 | QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y ); | 1414 | QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y ); |
1407 | aPoint += QPoint( 30,(d->mCurrentItem->height()/2) ); | 1415 | aPoint += QPoint( 30,(d->mCurrentItem->height()/2) ); |
1408 | aItem = itemAt( aPoint ); | 1416 | aItem = itemAt( aPoint ); |
1409 | while ( !aItem && aPoint.y() > 27 ) | 1417 | while ( !aItem && aPoint.y() > 27 ) |
1410 | { | 1418 | { |
1411 | aPoint -= QPoint( 0, 16 ); | 1419 | aPoint -= QPoint( 0, 16 ); |
1412 | aItem = itemAt( aPoint ); | 1420 | aItem = itemAt( aPoint ); |
1413 | } | 1421 | } |
1414 | if ( aItem ) | 1422 | if ( aItem ) |
1415 | setCurrentItem( aItem ); | 1423 | setCurrentItem( aItem ); |
1416 | } | 1424 | } |
1417 | break; | 1425 | break; |
1418 | case Key_Home: | 1426 | case Qt::Key_Home: |
1419 | aItem = d->mItemList.first(); | 1427 | aItem = d->mItemList.first(); |
1420 | setCurrentItem( aItem ); | 1428 | setCurrentItem( aItem ); |
1421 | break; | 1429 | break; |
1422 | case Key_End: | 1430 | case Qt::Key_End: |
1423 | aItem = d->mItemList.last(); | 1431 | aItem = d->mItemList.last(); |
1424 | setCurrentItem( aItem ); | 1432 | setCurrentItem( aItem ); |
1425 | break; | 1433 | break; |
1426 | case Key_Prior: // PageUp | 1434 | case Qt::Key_Prior: // PageUp |
1427 | { | 1435 | { |
1428 | // QListView: "Make the item above the top visible and current" | 1436 | // QListView: "Make the item above the top visible and current" |
1429 | // TODO if contentsY(), pick the top item of the leftmost visible column | 1437 | // TODO if contentsY(), pick the top item of the leftmost visible column |
1430 | if ( contentsX() <= 0 ) | 1438 | if ( contentsX() <= 0 ) |
1431 | return; | 1439 | return; |
1432 | int cw = columnWidth(); | 1440 | int cw = columnWidth(); |
1433 | int theCol = ( QMAX( 0, ( contentsX()/cw) * cw ) ) + d->mItemSpacing; | 1441 | int theCol = ( QMAX( 0, ( contentsX()/cw) * cw ) ) + d->mItemSpacing; |
1434 | aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) ); | 1442 | aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) ); |
1435 | if ( aItem ) | 1443 | if ( aItem ) |
1436 | setCurrentItem( aItem ); | 1444 | setCurrentItem( aItem ); |
1437 | } | 1445 | } |
1438 | break; | 1446 | break; |
1439 | case Key_Next: // PageDown | 1447 | case Qt::Key_Next: // PageDown |
1440 | { | 1448 | { |
1441 | // QListView: "Make the item below the bottom visible and current" | 1449 | // QListView: "Make the item below the bottom visible and current" |
1442 | // find the first not fully visible column. | 1450 | // find the first not fully visible column. |
1443 | // TODO: consider if a partly visible (or even hidden) item at the | 1451 | // TODO: consider if a partly visible (or even hidden) item at the |
1444 | // bottom of the rightmost column exists | 1452 | // bottom of the rightmost column exists |
1445 | int cw = columnWidth(); | 1453 | int cw = columnWidth(); |
1446 | int theCol = ( (( contentsX() + visibleWidth() )/cw) * cw ) + d->mItemSpacing + 1; | 1454 | int theCol = ( (( contentsX() + visibleWidth() )/cw) * cw ) + d->mItemSpacing + 1; |
1447 | // if separators are on, we may need to we may be one column further right if only the spacing/sep is hidden | 1455 | // if separators are on, we may need to we may be one column further right if only the spacing/sep is hidden |
1448 | if ( d->mDrawSeparators && cw - (( contentsX() + visibleWidth() )%cw) <= int( d->mItemSpacing + d->mSepWidth ) ) | 1456 | if ( d->mDrawSeparators && cw - (( contentsX() + visibleWidth() )%cw) <= int( d->mItemSpacing + d->mSepWidth ) ) |
1449 | theCol += cw; | 1457 | theCol += cw; |
1450 | 1458 | ||
1451 | // make sure this is not too far right | 1459 | // make sure this is not too far right |
1452 | while ( theCol > contentsWidth() ) | 1460 | while ( theCol > contentsWidth() ) |
1453 | theCol -= columnWidth(); | 1461 | theCol -= columnWidth(); |
1454 | 1462 | ||
1455 | aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) ); | 1463 | aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) ); |
1456 | 1464 | ||
1457 | if ( aItem ) | 1465 | if ( aItem ) |
1458 | setCurrentItem( aItem ); | 1466 | setCurrentItem( aItem ); |
1459 | } | 1467 | } |
1460 | break; | 1468 | break; |
1461 | case Key_Space: | 1469 | case Qt::Key_Space: |
1462 | setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() ); | 1470 | setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() ); |
1463 | emit selectionChanged(); | 1471 | emit selectionChanged(); |
1464 | break; | 1472 | break; |
1465 | case Key_Return: | 1473 | case Qt::Key_Return: |
1466 | case Key_Enter: | 1474 | case Qt::Key_Enter: |
1467 | { | 1475 | { |
1468 | emit returnPressed( d->mCurrentItem ); | 1476 | emit returnPressed( d->mCurrentItem ); |
1469 | emit executed( d->mCurrentItem ); | 1477 | emit executed( d->mCurrentItem ); |
1470 | } | 1478 | } |
1471 | break; | 1479 | break; |
1472 | default: | 1480 | default: |
1473 | if ( (e->state() & ControlButton) && e->key() == Key_A ) | 1481 | if ( (e->state() & Qt::ControlButton) && e->key() == Qt::Key_A ) |
1474 | { | 1482 | { |
1475 | // select all | 1483 | // select all |
1476 | selectAll( true ); | 1484 | selectAll( true ); |
1477 | break; | 1485 | break; |
1478 | } | 1486 | } |
1479 | // if we have a string, do autosearch | 1487 | // if we have a string, do autosearch |
1480 | else if ( ! e->text().isEmpty() && e->text()[0].isPrint() ) | 1488 | else if ( ! e->text().isEmpty() && e->text()[0].isPrint() ) |
1481 | { | 1489 | { |
1482 | 1490 | ||
1483 | } | 1491 | } |
1484 | break; | 1492 | break; |
1485 | } | 1493 | } |
1486 | // handle selection | 1494 | // handle selection |
1487 | if ( aItem ) | 1495 | if ( aItem ) |
1488 | { | 1496 | { |
1489 | if ( d->mSelectionMode == CardView::Extended ) | 1497 | if ( d->mSelectionMode == CardView::Extended ) |
1490 | { | 1498 | { |
1491 | if ( (e->state() & ShiftButton) ) | 1499 | if ( (e->state() & Qt::ShiftButton) ) |
1492 | { | 1500 | { |
1493 | // shift button: toggle range | 1501 | // shift button: toggle range |
1494 | // if control button is pressed, leave all items | 1502 | // if control button is pressed, leave all items |
1495 | // and toggle selection current->old current | 1503 | // and toggle selection current->old current |
1496 | // otherwise, ?????? | 1504 | // otherwise, ?????? |
1497 | bool s = ! aItem->isSelected(); | 1505 | bool s = ! aItem->isSelected(); |
1498 | int from, to, a, b; | 1506 | int from, to, a, b; |
1499 | a = d->mItemList.findRef( aItem ); | 1507 | a = d->mItemList.findRef( aItem ); |
1500 | b = d->mItemList.findRef( old ); | 1508 | b = d->mItemList.findRef( old ); |
1501 | from = a < b ? a : b; | 1509 | from = a < b ? a : b; |
1502 | to = a > b ? a : b; | 1510 | to = a > b ? a : b; |
1503 | 1511 | ||
@@ -1510,25 +1518,25 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1510 | } | 1518 | } |
1511 | 1519 | ||
1512 | //kdDebug()<<"selecting items "<<from<<" - "<<to<<" ( "<<s<<" )"<<endl; | 1520 | //kdDebug()<<"selecting items "<<from<<" - "<<to<<" ( "<<s<<" )"<<endl; |
1513 | CardViewItem *item; | 1521 | CardViewItem *item; |
1514 | for ( ; from <= to; from++ ) | 1522 | for ( ; from <= to; from++ ) |
1515 | { | 1523 | { |
1516 | item = d->mItemList.at( from ); | 1524 | item = d->mItemList.at( from ); |
1517 | item->setSelected( s ); | 1525 | item->setSelected( s ); |
1518 | repaintItem( item ); | 1526 | repaintItem( item ); |
1519 | } | 1527 | } |
1520 | emit selectionChanged(); | 1528 | emit selectionChanged(); |
1521 | } | 1529 | } |
1522 | else if ( (e->state() & ControlButton) ) | 1530 | else if ( (e->state() & Qt::ControlButton) ) |
1523 | { | 1531 | { |
1524 | // control button: do nothing | 1532 | // control button: do nothing |
1525 | } | 1533 | } |
1526 | else | 1534 | else |
1527 | { | 1535 | { |
1528 | // no button: move selection to this item | 1536 | // no button: move selection to this item |
1529 | bool b = signalsBlocked(); | 1537 | bool b = signalsBlocked(); |
1530 | blockSignals(true); | 1538 | blockSignals(true); |
1531 | selectAll(false); | 1539 | selectAll(false); |
1532 | blockSignals(b); | 1540 | blockSignals(b); |
1533 | 1541 | ||
1534 | setSelected( aItem, true ); | 1542 | setSelected( aItem, true ); |
@@ -1629,27 +1637,27 @@ void CardView::tryShowFullText() | |||
1629 | } | 1637 | } |
1630 | } | 1638 | } |
1631 | 1639 | ||
1632 | void CardView::drawRubberBands( int pos ) | 1640 | void CardView::drawRubberBands( int pos ) |
1633 | { | 1641 | { |
1634 | if ( pos && ((pos-d->firstX)/d->span) - d->colspace - d->mSepWidth < MIN_ITEM_WIDTH ) return; | 1642 | if ( pos && ((pos-d->firstX)/d->span) - d->colspace - d->mSepWidth < MIN_ITEM_WIDTH ) return; |
1635 | 1643 | ||
1636 | int tmpcw = (d->mRubberBandAnchor-d->firstX)/d->span; | 1644 | int tmpcw = (d->mRubberBandAnchor-d->firstX)/d->span; |
1637 | int x = d->firstX + tmpcw - d->mSepWidth - contentsX(); | 1645 | int x = d->firstX + tmpcw - d->mSepWidth - contentsX(); |
1638 | int h = visibleHeight(); | 1646 | int h = visibleHeight(); |
1639 | 1647 | ||
1640 | QPainter p( viewport() ); | 1648 | QPainter p( viewport() ); |
1641 | p.setRasterOp( XorROP ); | 1649 | p.setCompositionMode( QPainter::CompositionMode_Xor ); |
1642 | p.setPen( gray ); | 1650 | p.setPen( Qt::gray ); |
1643 | p.setBrush( gray ); | 1651 | p.setBrush( Qt::gray ); |
1644 | uint n = d->first; | 1652 | uint n = d->first; |
1645 | // erase | 1653 | // erase |
1646 | if ( d->mRubberBandAnchor ) | 1654 | if ( d->mRubberBandAnchor ) |
1647 | do { | 1655 | do { |
1648 | p.drawRect( x, 0, 2, h ); | 1656 | p.drawRect( x, 0, 2, h ); |
1649 | x += tmpcw; | 1657 | x += tmpcw; |
1650 | n++; | 1658 | n++; |
1651 | } while ( x < visibleWidth() && n < d->mSeparatorList.count() ); | 1659 | } while ( x < visibleWidth() && n < d->mSeparatorList.count() ); |
1652 | // paint new | 1660 | // paint new |
1653 | if ( ! pos ) return; | 1661 | if ( ! pos ) return; |
1654 | tmpcw = (pos - d->firstX)/d->span; | 1662 | tmpcw = (pos - d->firstX)/d->span; |
1655 | n = d->first; | 1663 | n = d->first; |
@@ -1690,25 +1698,25 @@ void CardView::setHeaderFont( const QFont &fnt ) | |||
1690 | d->mHeaderFont = fnt; | 1698 | d->mHeaderFont = fnt; |
1691 | delete d->mBFm; | 1699 | delete d->mBFm; |
1692 | d->mBFm = new QFontMetrics( fnt ); | 1700 | d->mBFm = new QFontMetrics( fnt ); |
1693 | } | 1701 | } |
1694 | 1702 | ||
1695 | QFont CardView::headerFont() const | 1703 | QFont CardView::headerFont() const |
1696 | { | 1704 | { |
1697 | return d->mHeaderFont; | 1705 | return d->mHeaderFont; |
1698 | } | 1706 | } |
1699 | 1707 | ||
1700 | void CardView::setFont( const QFont &fnt ) | 1708 | void CardView::setFont( const QFont &fnt ) |
1701 | { | 1709 | { |
1702 | QScrollView::setFont( fnt ); | 1710 | Q3ScrollView::setFont( fnt ); |
1703 | delete d->mFm; | 1711 | delete d->mFm; |
1704 | d->mFm = new QFontMetrics( fnt ); | 1712 | d->mFm = new QFontMetrics( fnt ); |
1705 | } | 1713 | } |
1706 | 1714 | ||
1707 | int CardView::separatorWidth() | 1715 | int CardView::separatorWidth() |
1708 | { | 1716 | { |
1709 | return d->mSepWidth; | 1717 | return d->mSepWidth; |
1710 | } | 1718 | } |
1711 | 1719 | ||
1712 | void CardView::setSeparatorWidth( int width ) | 1720 | void CardView::setSeparatorWidth( int width ) |
1713 | { | 1721 | { |
1714 | d->mSepWidth = width; | 1722 | d->mSepWidth = width; |
@@ -1727,24 +1735,24 @@ void CardView::setMaxFieldLines( int howmany ) | |||
1727 | } | 1735 | } |
1728 | 1736 | ||
1729 | void CardView::keyReleaseEvent ( QKeyEvent * e ) | 1737 | void CardView::keyReleaseEvent ( QKeyEvent * e ) |
1730 | { | 1738 | { |
1731 | if ( mFlagBlockKeyPressed ) | 1739 | if ( mFlagBlockKeyPressed ) |
1732 | return; | 1740 | return; |
1733 | if ( !e->isAutoRepeat() ) { | 1741 | if ( !e->isAutoRepeat() ) { |
1734 | mFlagBlockKeyPressed = true; | 1742 | mFlagBlockKeyPressed = true; |
1735 | qApp->processEvents(); | 1743 | qApp->processEvents(); |
1736 | mFlagBlockKeyPressed = false; | 1744 | mFlagBlockKeyPressed = false; |
1737 | mFlagKeyPressed = false; | 1745 | mFlagKeyPressed = false; |
1738 | } | 1746 | } |
1739 | QScrollView::keyReleaseEvent ( e ); | 1747 | Q3ScrollView::keyReleaseEvent ( e ); |
1740 | } | 1748 | } |
1741 | 1749 | ||
1742 | 1750 | ||
1743 | 1751 | ||
1744 | 1752 | ||
1745 | 1753 | ||
1746 | //END Cardview | 1754 | //END Cardview |
1747 | 1755 | ||
1748 | #ifndef KAB_EMBEDDED | 1756 | #ifndef KAB_EMBEDDED_ |
1749 | #include "cardview.moc" | 1757 | #include "moc_cardview.cpp" |
1750 | #endif //KAB_EMBEDDED | 1758 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/cardview.h b/kaddressbook/views/cardview.h index 2ea3771..9c245ea 100644 --- a/kaddressbook/views/cardview.h +++ b/kaddressbook/views/cardview.h | |||
@@ -1,21 +1,29 @@ | |||
1 | #ifndef CARDVIEW_H | 1 | #ifndef CARDVIEW_H |
2 | #define CARDVIEW_H | 2 | #define CARDVIEW_H |
3 | 3 | ||
4 | #include <qscrollview.h> | 4 | #include <q3scrollview.h> |
5 | #include <qptrlist.h> | 5 | #include <q3ptrlist.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qrect.h> | 7 | #include <qrect.h> |
8 | #include <qpair.h> | 8 | #include <qpair.h> |
9 | #include <qpoint.h> | 9 | #include <qpoint.h> |
10 | //Added by qt3to4: | ||
11 | #include <QWheelEvent> | ||
12 | #include <QResizeEvent> | ||
13 | #include <QFocusEvent> | ||
14 | #include <QLabel> | ||
15 | #include <QMouseEvent> | ||
16 | #include <QKeyEvent> | ||
17 | #include <QEvent> | ||
10 | 18 | ||
11 | class QLabel; | 19 | class QLabel; |
12 | class QPainter; | 20 | class QPainter; |
13 | class QResizeEvent; | 21 | class QResizeEvent; |
14 | class QMouseEvent; | 22 | class QMouseEvent; |
15 | class CardView; | 23 | class CardView; |
16 | class CardViewPrivate; | 24 | class CardViewPrivate; |
17 | class CardViewItemPrivate; | 25 | class CardViewItemPrivate; |
18 | class CardViewTip; | 26 | class CardViewTip; |
19 | 27 | ||
20 | /** Represents a single card (item) in the card view. A card has a caption | 28 | /** Represents a single card (item) in the card view. A card has a caption |
21 | * and a list of fields. A Field is a label<->value pair. The labels in a | 29 | * and a list of fields. A Field is a label<->value pair. The labels in a |
@@ -139,25 +147,25 @@ class CardViewItem | |||
139 | 147 | ||
140 | /** The CardView is a method of displaying data in cards. This idea is | 148 | /** The CardView is a method of displaying data in cards. This idea is |
141 | * similar to the idea of a rolodex or business cards. Each card has a | 149 | * similar to the idea of a rolodex or business cards. Each card has a |
142 | * caption and a list of fields, which are label<->value pairs. The CardView | 150 | * caption and a list of fields, which are label<->value pairs. The CardView |
143 | * displays multiple cards in a grid. The Cards are sorted based on their | 151 | * displays multiple cards in a grid. The Cards are sorted based on their |
144 | * caption. | 152 | * caption. |
145 | * | 153 | * |
146 | * The CardView class is designed to mirror the API of the QListView or | 154 | * The CardView class is designed to mirror the API of the QListView or |
147 | * QIconView. The CardView is also completely independant of KAddressBook and | 155 | * QIconView. The CardView is also completely independant of KAddressBook and |
148 | * can be used elsewhere. With the exception of a few simple config checks, | 156 | * can be used elsewhere. With the exception of a few simple config checks, |
149 | * the CardView is also 100% independant of KDE. | 157 | * the CardView is also 100% independant of KDE. |
150 | */ | 158 | */ |
151 | class CardView : public QScrollView | 159 | class CardView : public Q3ScrollView |
152 | { | 160 | { |
153 | friend class CardViewItem; | 161 | friend class CardViewItem; |
154 | 162 | ||
155 | Q_OBJECT | 163 | Q_OBJECT |
156 | 164 | ||
157 | public: | 165 | public: |
158 | /** Constructor. | 166 | /** Constructor. |
159 | */ | 167 | */ |
160 | CardView(QWidget *parent, const char *name); | 168 | CardView(QWidget *parent, const char *name); |
161 | virtual ~CardView(); | 169 | virtual ~CardView(); |
162 | 170 | ||
163 | /** Inserts the item into the card view. This method does not have | 171 | /** Inserts the item into the card view. This method does not have |
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp index 2bddca6..46a59a1 100644 --- a/kaddressbook/views/colorlistbox.cpp +++ b/kaddressbook/views/colorlistbox.cpp | |||
@@ -10,53 +10,58 @@ | |||
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | //Added by qt3to4: | ||
23 | #include <QDragEnterEvent> | ||
24 | #include <QDropEvent> | ||
25 | #include <QDragMoveEvent> | ||
26 | #include <QDragLeaveEvent> | ||
22 | 27 | ||
23 | #include <kcolordialog.h> | 28 | #include <kcolordialog.h> |
24 | 29 | ||
25 | #ifndef KAB_EMBEDDED | 30 | #ifndef KAB_EMBEDDED |
26 | #include <kcolordrag.h> | 31 | #include <kcolordrag.h> |
27 | #endif //KAB_EMBEDDED | 32 | #endif //KAB_EMBEDDED |
28 | 33 | ||
29 | #include "colorlistbox.h" | 34 | #include "colorlistbox.h" |
30 | #ifdef DESKTOP_VERSION | 35 | #ifdef DESKTOP_VERSION |
31 | #include <qcolordialog.h> | 36 | #include <qcolordialog.h> |
32 | #endif | 37 | #endif |
33 | 38 | ||
34 | ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f ) | 39 | ColorListBox::ColorListBox( QWidget *parent, const char *name, Qt::WFlags f ) |
35 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) | 40 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) |
36 | { | 41 | { |
37 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); | 42 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); |
38 | connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) ); | 43 | connect( this, SIGNAL(clicked(Q3ListBoxItem *)), this, SLOT(slotNewColor(Q3ListBoxItem *)) ); |
39 | setAcceptDrops( true); | 44 | setAcceptDrops( true); |
40 | } | 45 | } |
41 | 46 | ||
42 | 47 | ||
43 | void ColorListBox::setEnabled( bool state ) | 48 | void ColorListBox::setEnabled( bool state ) |
44 | { | 49 | { |
45 | if( state == isEnabled() ) | 50 | if( state == isEnabled() ) |
46 | { | 51 | { |
47 | return; | 52 | return; |
48 | } | 53 | } |
49 | 54 | ||
50 | QListBox::setEnabled( state ); | 55 | Q3ListBox::setEnabled( state ); |
51 | for( uint i=0; i<count(); i++ ) | 56 | for( uint i=0; i<count(); i++ ) |
52 | { | 57 | { |
53 | updateItem( i ); | 58 | updateItem( i ); |
54 | } | 59 | } |
55 | } | 60 | } |
56 | 61 | ||
57 | 62 | ||
58 | void ColorListBox::setColor( uint index, const QColor &color ) | 63 | void ColorListBox::setColor( uint index, const QColor &color ) |
59 | { | 64 | { |
60 | if( index < count() ) | 65 | if( index < count() ) |
61 | { | 66 | { |
62 | ColorListItem *colorItem = (ColorListItem*)item(index); | 67 | ColorListItem *colorItem = (ColorListItem*)item(index); |
@@ -66,28 +71,28 @@ void ColorListBox::setColor( uint index, const QColor &color ) | |||
66 | } | 71 | } |
67 | 72 | ||
68 | 73 | ||
69 | QColor ColorListBox::color( uint index ) const | 74 | QColor ColorListBox::color( uint index ) const |
70 | { | 75 | { |
71 | if( index < count() ) | 76 | if( index < count() ) |
72 | { | 77 | { |
73 | ColorListItem *colorItem = (ColorListItem*)item(index); | 78 | ColorListItem *colorItem = (ColorListItem*)item(index); |
74 | return( colorItem->color() ); | 79 | return( colorItem->color() ); |
75 | } | 80 | } |
76 | else | 81 | else |
77 | { | 82 | { |
78 | return( black ); | 83 | return( Qt::black ); |
79 | } | 84 | } |
80 | } | 85 | } |
81 | void ColorListBox::slotNewColor(QListBoxItem * i) | 86 | void ColorListBox::slotNewColor(Q3ListBoxItem * i) |
82 | { | 87 | { |
83 | if ( i ) | 88 | if ( i ) |
84 | newColor( index( i ) ); | 89 | newColor( index( i ) ); |
85 | } | 90 | } |
86 | 91 | ||
87 | void ColorListBox::newColor( int index ) | 92 | void ColorListBox::newColor( int index ) |
88 | { | 93 | { |
89 | if( isEnabled() == false ) | 94 | if( isEnabled() == false ) |
90 | { | 95 | { |
91 | return; | 96 | return; |
92 | } | 97 | } |
93 | 98 | ||
@@ -189,25 +194,25 @@ void ColorListBox::dropEvent( QDropEvent *e ) | |||
189 | mCurrentOnDragEnter = -1; | 194 | mCurrentOnDragEnter = -1; |
190 | } | 195 | } |
191 | 196 | ||
192 | #else //KAB_EMBEDDED | 197 | #else //KAB_EMBEDDED |
193 | qDebug("ColorListBox::dropEvent drag&drop currently not supported"); | 198 | qDebug("ColorListBox::dropEvent drag&drop currently not supported"); |
194 | #endif //KAB_EMBEDDED | 199 | #endif //KAB_EMBEDDED |
195 | 200 | ||
196 | } | 201 | } |
197 | 202 | ||
198 | 203 | ||
199 | 204 | ||
200 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) | 205 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) |
201 | : QListBoxItem(), mColor( color ), mBoxWidth( 30 ) | 206 | : Q3ListBoxItem(), mColor( color ), mBoxWidth( 30 ) |
202 | { | 207 | { |
203 | setText( text ); | 208 | setText( text ); |
204 | } | 209 | } |
205 | 210 | ||
206 | 211 | ||
207 | const QColor &ColorListItem::color( void ) | 212 | const QColor &ColorListItem::color( void ) |
208 | { | 213 | { |
209 | return( mColor ); | 214 | return( mColor ); |
210 | } | 215 | } |
211 | 216 | ||
212 | 217 | ||
213 | void ColorListItem::setColor( const QColor &color ) | 218 | void ColorListItem::setColor( const QColor &color ) |
@@ -220,26 +225,26 @@ void ColorListItem::paint( QPainter *p ) | |||
220 | { | 225 | { |
221 | QFontMetrics fm = p->fontMetrics(); | 226 | QFontMetrics fm = p->fontMetrics(); |
222 | int h = fm.height(); | 227 | int h = fm.height(); |
223 | 228 | ||
224 | p->drawText( mBoxWidth+3*2, fm.ascent() + fm.leading()/2, text() ); | 229 | p->drawText( mBoxWidth+3*2, fm.ascent() + fm.leading()/2, text() ); |
225 | 230 | ||
226 | p->setPen( Qt::black ); | 231 | p->setPen( Qt::black ); |
227 | p->drawRect( 3, 1, mBoxWidth, h-1 ); | 232 | p->drawRect( 3, 1, mBoxWidth, h-1 ); |
228 | p->fillRect( 4, 2, mBoxWidth-2, h-3, mColor ); | 233 | p->fillRect( 4, 2, mBoxWidth-2, h-3, mColor ); |
229 | } | 234 | } |
230 | 235 | ||
231 | 236 | ||
232 | int ColorListItem::height(const QListBox *lb ) const | 237 | int ColorListItem::height(const Q3ListBox *lb ) const |
233 | { | 238 | { |
234 | return( lb->fontMetrics().lineSpacing()+1 ); | 239 | return( lb->fontMetrics().lineSpacing()+1 ); |
235 | } | 240 | } |
236 | 241 | ||
237 | 242 | ||
238 | int ColorListItem::width(const QListBox *lb ) const | 243 | int ColorListItem::width(const Q3ListBox *lb ) const |
239 | { | 244 | { |
240 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); | 245 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); |
241 | } | 246 | } |
242 | 247 | ||
243 | #ifndef KAB_EMBEDDED | 248 | #ifndef KAB_EMBEDDED_ |
244 | #include "colorlistbox.moc" | 249 | #include "moc_colorlistbox.cpp" |
245 | #endif //KAB_EMBEDDED | 250 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/colorlistbox.h b/kaddressbook/views/colorlistbox.h index bb91484..31a8085 100644 --- a/kaddressbook/views/colorlistbox.h +++ b/kaddressbook/views/colorlistbox.h | |||
@@ -13,65 +13,70 @@ | |||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _COLOR_LISTBOX_H_ | 21 | #ifndef _COLOR_LISTBOX_H_ |
22 | #define _COLOR_LISTBOX_H_ | 22 | #define _COLOR_LISTBOX_H_ |
23 | 23 | ||
24 | #include <klistbox.h> | 24 | #include <klistbox.h> |
25 | //Added by qt3to4: | ||
26 | #include <QDragMoveEvent> | ||
27 | #include <QDragLeaveEvent> | ||
28 | #include <QDropEvent> | ||
29 | #include <QDragEnterEvent> | ||
25 | 30 | ||
26 | class QDragEnterEvent; | 31 | class QDragEnterEvent; |
27 | class QDragLeaveEvent; | 32 | class QDragLeaveEvent; |
28 | class QDragMoveEvent; | 33 | class QDragMoveEvent; |
29 | class QDropEvent; | 34 | class QDropEvent; |
30 | 35 | ||
31 | class ColorListBox : public KListBox | 36 | class ColorListBox : public KListBox |
32 | { | 37 | { |
33 | Q_OBJECT | 38 | Q_OBJECT |
34 | 39 | ||
35 | public: | 40 | public: |
36 | ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 ); | 41 | ColorListBox( QWidget *parent=0, const char * name=0, Qt::WFlags f=0 ); |
37 | void setColor( uint index, const QColor &color ); | 42 | void setColor( uint index, const QColor &color ); |
38 | QColor color( uint index ) const; | 43 | QColor color( uint index ) const; |
39 | 44 | ||
40 | public slots: | 45 | public slots: |
41 | virtual void setEnabled( bool state ); | 46 | virtual void setEnabled( bool state ); |
42 | 47 | ||
43 | protected: | 48 | protected: |
44 | void dragEnterEvent( QDragEnterEvent *e ); | 49 | void dragEnterEvent( QDragEnterEvent *e ); |
45 | void dragLeaveEvent( QDragLeaveEvent *e ); | 50 | void dragLeaveEvent( QDragLeaveEvent *e ); |
46 | void dragMoveEvent( QDragMoveEvent *e ); | 51 | void dragMoveEvent( QDragMoveEvent *e ); |
47 | void dropEvent( QDropEvent *e ); | 52 | void dropEvent( QDropEvent *e ); |
48 | 53 | ||
49 | private slots: | 54 | private slots: |
50 | void newColor( int index ); | 55 | void newColor( int index ); |
51 | void slotNewColor(QListBoxItem * i); | 56 | void slotNewColor(Q3ListBoxItem * i); |
52 | 57 | ||
53 | private: | 58 | private: |
54 | int mCurrentOnDragEnter; | 59 | int mCurrentOnDragEnter; |
55 | 60 | ||
56 | }; | 61 | }; |
57 | 62 | ||
58 | 63 | ||
59 | class ColorListItem : public QListBoxItem | 64 | class ColorListItem : public Q3ListBoxItem |
60 | { | 65 | { |
61 | public: | 66 | public: |
62 | ColorListItem( const QString &text, const QColor &color=Qt::black ); | 67 | ColorListItem( const QString &text, const QColor &color=Qt::black ); |
63 | const QColor &color( void ); | 68 | const QColor &color( void ); |
64 | void setColor( const QColor &color ); | 69 | void setColor( const QColor &color ); |
65 | 70 | ||
66 | protected: | 71 | protected: |
67 | virtual void paint( QPainter * ); | 72 | virtual void paint( QPainter * ); |
68 | virtual int height( const QListBox * ) const; | 73 | virtual int height( const Q3ListBox * ) const; |
69 | virtual int width( const QListBox * ) const; | 74 | virtual int width( const Q3ListBox * ) const; |
70 | 75 | ||
71 | private: | 76 | private: |
72 | QColor mColor; | 77 | QColor mColor; |
73 | int mBoxWidth; | 78 | int mBoxWidth; |
74 | }; | 79 | }; |
75 | 80 | ||
76 | #endif | 81 | #endif |
77 | 82 | ||
diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp index e0fbd21..b6327fe 100644 --- a/kaddressbook/views/configurecardviewdialog.cpp +++ b/kaddressbook/views/configurecardviewdialog.cpp | |||
@@ -16,29 +16,32 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qvbox.h> | 28 | #include <q3vbox.h> |
29 | #include <qgroupbox.h> | 29 | #include <q3groupbox.h> |
30 | #include <qspinbox.h> | 30 | #include <qspinbox.h> |
31 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
32 | #include <qwhatsthis.h> | 32 | #include <q3whatsthis.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3GridLayout> | ||
35 | #include <Q3Frame> | ||
33 | 36 | ||
34 | #include <kdebug.h> | 37 | #include <kdebug.h> |
35 | #include <kglobal.h> | 38 | #include <kglobal.h> |
36 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
37 | #include <klocale.h> | 40 | #include <klocale.h> |
38 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
39 | #include <kconfig.h> | 42 | #include <kconfig.h> |
40 | #include <kfontdialog.h> | 43 | #include <kfontdialog.h> |
41 | 44 | ||
42 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
43 | #include <kpushbutton.h> | 46 | #include <kpushbutton.h> |
44 | #else //KAB_EMBEDDED | 47 | #else //KAB_EMBEDDED |
@@ -80,25 +83,25 @@ void ConfigureCardViewWidget::restoreSettings( KConfig *config ) | |||
80 | } | 83 | } |
81 | 84 | ||
82 | void ConfigureCardViewWidget::saveSettings( KConfig *config ) | 85 | void ConfigureCardViewWidget::saveSettings( KConfig *config ) |
83 | { | 86 | { |
84 | ViewConfigureWidget::saveSettings( config ); | 87 | ViewConfigureWidget::saveSettings( config ); |
85 | 88 | ||
86 | mAdvancedPage->saveSettings( config ); | 89 | mAdvancedPage->saveSettings( config ); |
87 | } | 90 | } |
88 | 91 | ||
89 | //////////////////////// | 92 | //////////////////////// |
90 | // CardViewLookNFeelPage | 93 | // CardViewLookNFeelPage |
91 | CardViewLookNFeelPage::CardViewLookNFeelPage( QWidget *parent, const char *name ) | 94 | CardViewLookNFeelPage::CardViewLookNFeelPage( QWidget *parent, const char *name ) |
92 | : QVBox( parent, name ) | 95 | : Q3VBox( parent, name ) |
93 | { | 96 | { |
94 | initGUI(); | 97 | initGUI(); |
95 | } | 98 | } |
96 | 99 | ||
97 | CardViewLookNFeelPage::~CardViewLookNFeelPage() | 100 | CardViewLookNFeelPage::~CardViewLookNFeelPage() |
98 | { | 101 | { |
99 | } | 102 | } |
100 | 103 | ||
101 | void CardViewLookNFeelPage::restoreSettings( KConfig *config ) | 104 | void CardViewLookNFeelPage::restoreSettings( KConfig *config ) |
102 | { | 105 | { |
103 | // colors | 106 | // colors |
104 | cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) ); | 107 | cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) ); |
@@ -225,145 +228,145 @@ void CardViewLookNFeelPage::enableColors() | |||
225 | if ( cbEnableCustomColors->isChecked() ) | 228 | if ( cbEnableCustomColors->isChecked() ) |
226 | lbColors->setFocus(); | 229 | lbColors->setFocus(); |
227 | } | 230 | } |
228 | 231 | ||
229 | void CardViewLookNFeelPage::initGUI() | 232 | void CardViewLookNFeelPage::initGUI() |
230 | { | 233 | { |
231 | int spacing = KDialog::spacingHint(); | 234 | int spacing = KDialog::spacingHint(); |
232 | int margin = KDialog::marginHint(); | 235 | int margin = KDialog::marginHint(); |
233 | 236 | ||
234 | QTabWidget *tabs = new QTabWidget( this ); | 237 | QTabWidget *tabs = new QTabWidget( this ); |
235 | 238 | ||
236 | // Layout | 239 | // Layout |
237 | QVBox *loTab = new QVBox( this, "layouttab" ); | 240 | Q3VBox *loTab = new Q3VBox( this, "layouttab" ); |
238 | 241 | ||
239 | loTab->setSpacing( spacing ); | 242 | loTab->setSpacing( spacing ); |
240 | loTab->setMargin( margin ); | 243 | loTab->setMargin( margin ); |
241 | 244 | ||
242 | QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); | 245 | Q3GroupBox *gbGeneral = new Q3GroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); |
243 | 246 | ||
244 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); | 247 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); |
245 | 248 | ||
246 | QHBox *hbSW = new QHBox( gbGeneral ); | 249 | Q3HBox *hbSW = new Q3HBox( gbGeneral ); |
247 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); | 250 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); |
248 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); | 251 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); |
249 | lSW->setBuddy( sbSepWidth); | 252 | lSW->setBuddy( sbSepWidth); |
250 | 253 | ||
251 | QHBox *hbPadding = new QHBox( gbGeneral ); | 254 | Q3HBox *hbPadding = new Q3HBox( gbGeneral ); |
252 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); | 255 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); |
253 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); | 256 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); |
254 | lSpacing->setBuddy( sbSpacing ); | 257 | lSpacing->setBuddy( sbSpacing ); |
255 | 258 | ||
256 | QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); | 259 | Q3GroupBox *gbCards = new Q3GroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); |
257 | 260 | ||
258 | QHBox *hbMargin = new QHBox( gbCards ); | 261 | Q3HBox *hbMargin = new Q3HBox( gbCards ); |
259 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); | 262 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); |
260 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); | 263 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); |
261 | lMargin->setBuddy( sbMargin ); | 264 | lMargin->setBuddy( sbMargin ); |
262 | 265 | ||
263 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); | 266 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); |
264 | 267 | ||
265 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); | 268 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); |
266 | 269 | ||
267 | QWhatsThis::add( sbMargin, i18n( | 270 | Q3WhatsThis::add( sbMargin, i18n( |
268 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " | 271 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " |
269 | "incrementing the item margin will add space between the focus rectangle and the item data." | 272 | "incrementing the item margin will add space between the focus rectangle and the item data." |
270 | ) ); | 273 | ) ); |
271 | QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) ); | 274 | /* TODO:hacker: Q3WhatsThis::add( lMargin, Q3WhatsThis::textFor( sbMargin ) ); */ |
272 | QWhatsThis::add( sbSpacing, i18n( | 275 | Q3WhatsThis::add( sbSpacing, i18n( |
273 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " | 276 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " |
274 | "borders, other items or column separators." | 277 | "borders, other items or column separators." |
275 | ) ); | 278 | ) ); |
276 | QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) ); | 279 | /* TODO:hacker: Q3WhatsThis::add( lSpacing, Q3WhatsThis::textFor( sbSpacing ) ); */ |
277 | QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); | 280 | Q3WhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); |
278 | QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) ); | 281 | /* TODO:hacker: Q3WhatsThis::add( lSW, Q3WhatsThis::textFor( sbSepWidth ) ); */ |
279 | 282 | ||
280 | tabs->addTab( loTab, i18n("&Layout") ); | 283 | tabs->addTab( loTab, i18n("&Layout") ); |
281 | 284 | ||
282 | // Colors | 285 | // Colors |
283 | QVBox *colorTab = new QVBox( this, "colortab" ); | 286 | Q3VBox *colorTab = new Q3VBox( this, "colortab" ); |
284 | colorTab->setSpacing( spacing ); | 287 | colorTab->setSpacing( spacing ); |
285 | colorTab->setMargin( spacing ); | 288 | colorTab->setMargin( spacing ); |
286 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | 289 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); |
287 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | 290 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); |
288 | lbColors = new ColorListBox( colorTab ); | 291 | lbColors = new ColorListBox( colorTab ); |
289 | tabs->addTab( colorTab, i18n("&Colors") ); | 292 | tabs->addTab( colorTab, i18n("&Colors") ); |
290 | 293 | ||
291 | QWhatsThis::add( cbEnableCustomColors, i18n( | 294 | Q3WhatsThis::add( cbEnableCustomColors, i18n( |
292 | "If custom colors are enabled, you may choose the colors for the view below. " | 295 | "If custom colors are enabled, you may choose the colors for the view below. " |
293 | "Otherwise colors from your current KDE color scheme are used." | 296 | "Otherwise colors from your current KDE color scheme are used." |
294 | ) ); | 297 | ) ); |
295 | QWhatsThis::add( lbColors, i18n( | 298 | Q3WhatsThis::add( lbColors, i18n( |
296 | "Double click or press RETURN on a item to select a color for the related strings in the view." | 299 | "Double click or press RETURN on a item to select a color for the related strings in the view." |
297 | ) ); | 300 | ) ); |
298 | 301 | ||
299 | // Fonts | 302 | // Fonts |
300 | QVBox *fntTab = new QVBox( this, "fonttab" ); | 303 | Q3VBox *fntTab = new Q3VBox( this, "fonttab" ); |
301 | 304 | ||
302 | fntTab->setSpacing( spacing ); | 305 | fntTab->setSpacing( spacing ); |
303 | fntTab->setMargin( spacing ); | 306 | fntTab->setMargin( spacing ); |
304 | 307 | ||
305 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | 308 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); |
306 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | 309 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); |
307 | 310 | ||
308 | vbFonts = new QWidget( fntTab ); | 311 | vbFonts = new QWidget( fntTab ); |
309 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | 312 | Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 ); |
310 | gFnts->setSpacing( spacing ); | 313 | gFnts->setSpacing( spacing ); |
311 | gFnts->setAutoAdd( true ); | 314 | gFnts->setAutoAdd( true ); |
312 | gFnts->setColStretch( 1, 1 ); | 315 | gFnts->setColStretch( 1, 1 ); |
313 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | 316 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); |
314 | lTextFont = new QLabel( vbFonts ); | 317 | lTextFont = new QLabel( vbFonts ); |
315 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 318 | lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
316 | #ifndef KAB_EMBEDDED | 319 | #ifndef KAB_EMBEDDED |
317 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | 320 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); |
318 | #else //KAB_EMBEDDED | 321 | #else //KAB_EMBEDDED |
319 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | 322 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); |
320 | #endif //KAB_EMBEDDED | 323 | #endif //KAB_EMBEDDED |
321 | 324 | ||
322 | lTFnt->setBuddy( btnFont ); | 325 | lTFnt->setBuddy( btnFont ); |
323 | 326 | ||
324 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); | 327 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); |
325 | 328 | ||
326 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); | 329 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); |
327 | lHeaderFont = new QLabel( vbFonts ); | 330 | lHeaderFont = new QLabel( vbFonts ); |
328 | lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 331 | lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
329 | #ifndef KAB_EMBEDDED | 332 | #ifndef KAB_EMBEDDED |
330 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); | 333 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); |
331 | #else //KAB_EMBEDDED | 334 | #else //KAB_EMBEDDED |
332 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); | 335 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); |
333 | #endif //KAB_EMBEDDED | 336 | #endif //KAB_EMBEDDED |
334 | lHFnt->setBuddy( btnHeaderFont ); | 337 | lHFnt->setBuddy( btnHeaderFont ); |
335 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); | 338 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); |
336 | 339 | ||
337 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); | 340 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); |
338 | 341 | ||
339 | QWhatsThis::add( cbEnableCustomFonts, i18n( | 342 | Q3WhatsThis::add( cbEnableCustomFonts, i18n( |
340 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " | 343 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " |
341 | "Otherwise the default KDE font will be used, in bold style for the header and " | 344 | "Otherwise the default KDE font will be used, in bold style for the header and " |
342 | "normal style for the data." | 345 | "normal style for the data." |
343 | ) ); | 346 | ) ); |
344 | 347 | ||
345 | tabs->addTab( fntTab, i18n("&Fonts") ); | 348 | tabs->addTab( fntTab, i18n("&Fonts") ); |
346 | 349 | ||
347 | // Behaviour | 350 | // Behaviour |
348 | QVBox *behaviourTab = new QVBox( this ); | 351 | Q3VBox *behaviourTab = new Q3VBox( this ); |
349 | behaviourTab->setMargin( margin ); | 352 | behaviourTab->setMargin( margin ); |
350 | behaviourTab->setSpacing( spacing ); | 353 | behaviourTab->setSpacing( spacing ); |
351 | 354 | ||
352 | cbShowEmptyFields = new QCheckBox( i18n("Show &empty fields"), behaviourTab ); | 355 | cbShowEmptyFields = new QCheckBox( i18n("Show &empty fields"), behaviourTab ); |
353 | cbShowFieldLabels = new QCheckBox( i18n("Show field &labels"), behaviourTab ); | 356 | cbShowFieldLabels = new QCheckBox( i18n("Show field &labels"), behaviourTab ); |
354 | 357 | ||
355 | behaviourTab->setStretchFactor( new QWidget( behaviourTab ), 1 ); | 358 | behaviourTab->setStretchFactor( new QWidget( behaviourTab ), 1 ); |
356 | 359 | ||
357 | tabs->addTab( behaviourTab, i18n("Be&havior") ); | 360 | tabs->addTab( behaviourTab, i18n("Be&havior") ); |
358 | 361 | ||
359 | } | 362 | } |
360 | 363 | ||
361 | void CardViewLookNFeelPage::updateFontLabel( QFont fnt, QLabel *l ) | 364 | void CardViewLookNFeelPage::updateFontLabel( QFont fnt, QLabel *l ) |
362 | { | 365 | { |
363 | l->setFont( fnt ); | 366 | l->setFont( fnt ); |
364 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); | 367 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); |
365 | } | 368 | } |
366 | 369 | ||
367 | #ifndef KAB_EMBEDDED | 370 | #ifndef KAB_EMBEDDED_ |
368 | #include "configurecardviewdialog.moc" | 371 | #include "moc_configurecardviewdialog.cpp" |
369 | #endif //KAB_EMBEDDED | 372 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/configurecardviewdialog.h b/kaddressbook/views/configurecardviewdialog.h index 7a62226..4af475d 100644 --- a/kaddressbook/views/configurecardviewdialog.h +++ b/kaddressbook/views/configurecardviewdialog.h | |||
@@ -17,27 +17,29 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef CONFIGURECARDVIEWDIALOG_H | 24 | #ifndef CONFIGURECARDVIEWDIALOG_H |
25 | #define CONFIGURECARDVIEWDIALOG_H | 25 | #define CONFIGURECARDVIEWDIALOG_H |
26 | 26 | ||
27 | #include "viewconfigurewidget.h" | 27 | #include "viewconfigurewidget.h" |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | #include <qwidget.h> | 30 | #include <qwidget.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | //Added by qt3to4: | ||
33 | #include <QLabel> | ||
32 | 34 | ||
33 | class QString; | 35 | class QString; |
34 | class QWidget; | 36 | class QWidget; |
35 | class QCheckBox; | 37 | class QCheckBox; |
36 | class QLabel; | 38 | class QLabel; |
37 | class KConfig; | 39 | class KConfig; |
38 | 40 | ||
39 | namespace KABC { class AddressBook; } | 41 | namespace KABC { class AddressBook; } |
40 | 42 | ||
41 | class CardViewLookAndFeelPage; | 43 | class CardViewLookAndFeelPage; |
42 | 44 | ||
43 | /** | 45 | /** |
@@ -68,25 +70,25 @@ class ConfigureCardViewWidget : public ViewConfigureWidget | |||
68 | Colors | 70 | Colors |
69 | * background color | 71 | * background color |
70 | * text color | 72 | * text color |
71 | * highlight color | 73 | * highlight color |
72 | * title/sep text color | 74 | * title/sep text color |
73 | * title/sep bg color | 75 | * title/sep bg color |
74 | 76 | ||
75 | Layout | 77 | Layout |
76 | * item margin | 78 | * item margin |
77 | * item spacing | 79 | * item spacing |
78 | */ | 80 | */ |
79 | 81 | ||
80 | class CardViewLookNFeelPage : public QVBox { | 82 | class CardViewLookNFeelPage : public Q3VBox { |
81 | 83 | ||
82 | Q_OBJECT | 84 | Q_OBJECT |
83 | 85 | ||
84 | public: | 86 | public: |
85 | CardViewLookNFeelPage( QWidget *parent=0, const char *name=0 ); | 87 | CardViewLookNFeelPage( QWidget *parent=0, const char *name=0 ); |
86 | ~CardViewLookNFeelPage(); | 88 | ~CardViewLookNFeelPage(); |
87 | 89 | ||
88 | void restoreSettings( KConfig* ); | 90 | void restoreSettings( KConfig* ); |
89 | void saveSettings( KConfig* ); | 91 | void saveSettings( KConfig* ); |
90 | 92 | ||
91 | private slots: | 93 | private slots: |
92 | void setTextFont(); | 94 | void setTextFont(); |
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp index c329cd9..7ed897a 100644 --- a/kaddressbook/views/configuretableviewdialog.cpp +++ b/kaddressbook/views/configuretableviewdialog.cpp | |||
@@ -18,29 +18,32 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qradiobutton.h> | 28 | #include <qradiobutton.h> |
29 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qvbox.h> | 30 | #include <q3vbox.h> |
31 | #include <qbuttongroup.h> | 31 | #include <q3buttongroup.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qwhatsthis.h> | 33 | #include <q3whatsthis.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3Frame> | ||
35 | 38 | ||
36 | #include <kglobal.h> | 39 | #include <kglobal.h> |
37 | #include <klocale.h> | 40 | #include <klocale.h> |
38 | #include <klineedit.h> | 41 | #include <klineedit.h> |
39 | #include <kurlrequester.h> | 42 | #include <kurlrequester.h> |
40 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
41 | #include <kfontdialog.h> | 44 | #include <kfontdialog.h> |
42 | 45 | ||
43 | #ifndef KAB_EMBEDDED | 46 | #ifndef KAB_EMBEDDED |
44 | #include <kimageio.h> | 47 | #include <kimageio.h> |
45 | #else //KAB_EMBEDDED | 48 | #else //KAB_EMBEDDED |
46 | #endif //KAB_EMBEDDED | 49 | #endif //KAB_EMBEDDED |
@@ -75,25 +78,25 @@ void ConfigureTableViewWidget::restoreSettings( KConfig *config ) | |||
75 | } | 78 | } |
76 | 79 | ||
77 | void ConfigureTableViewWidget::saveSettings( KConfig *config ) | 80 | void ConfigureTableViewWidget::saveSettings( KConfig *config ) |
78 | { | 81 | { |
79 | ViewConfigureWidget::saveSettings( config ); | 82 | ViewConfigureWidget::saveSettings( config ); |
80 | 83 | ||
81 | mPage->saveSettings( config ); | 84 | mPage->saveSettings( config ); |
82 | } | 85 | } |
83 | 86 | ||
84 | 87 | ||
85 | 88 | ||
86 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) | 89 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) |
87 | : QVBox(parent, name) | 90 | : Q3VBox(parent, name) |
88 | { | 91 | { |
89 | initGUI(); | 92 | initGUI(); |
90 | 93 | ||
91 | // Set initial state | 94 | // Set initial state |
92 | enableBackgroundToggled(mBackgroundBox->isChecked()); | 95 | enableBackgroundToggled(mBackgroundBox->isChecked()); |
93 | } | 96 | } |
94 | 97 | ||
95 | void LookAndFeelPage::restoreSettings( KConfig *config ) | 98 | void LookAndFeelPage::restoreSettings( KConfig *config ) |
96 | { | 99 | { |
97 | mAlternateButton->setChecked(config->readBoolEntry("ABackground", true)); | 100 | mAlternateButton->setChecked(config->readBoolEntry("ABackground", true)); |
98 | mLineButton->setChecked(config->readBoolEntry("SingleLine", false)); | 101 | mLineButton->setChecked(config->readBoolEntry("SingleLine", false)); |
99 | mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true)); | 102 | mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true)); |
@@ -220,30 +223,30 @@ void LookAndFeelPage::enableColors() | |||
220 | if ( cbEnableCustomColors->isChecked() ) | 223 | if ( cbEnableCustomColors->isChecked() ) |
221 | lbColors->setFocus(); | 224 | lbColors->setFocus(); |
222 | } | 225 | } |
223 | 226 | ||
224 | void LookAndFeelPage::initGUI() | 227 | void LookAndFeelPage::initGUI() |
225 | { | 228 | { |
226 | int spacing = KDialog::spacingHint(); | 229 | int spacing = KDialog::spacingHint(); |
227 | int margin = KDialog::marginHint(); | 230 | int margin = KDialog::marginHint(); |
228 | 231 | ||
229 | QTabWidget *tabs = new QTabWidget( this ); | 232 | QTabWidget *tabs = new QTabWidget( this ); |
230 | 233 | ||
231 | // General | 234 | // General |
232 | QVBox *generalTab = new QVBox( this, "generaltab" ); | 235 | Q3VBox *generalTab = new Q3VBox( this, "generaltab" ); |
233 | 236 | ||
234 | generalTab->setSpacing( spacing ); | 237 | generalTab->setSpacing( spacing ); |
235 | generalTab->setMargin( margin ); | 238 | generalTab->setMargin( margin ); |
236 | 239 | ||
237 | QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, | 240 | Q3ButtonGroup *group = new Q3ButtonGroup(1, Qt::Horizontal, |
238 | i18n("Row Separator"), generalTab); | 241 | i18n("Row Separator"), generalTab); |
239 | 242 | ||
240 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), | 243 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), |
241 | group, "mAlternateButton"); | 244 | group, "mAlternateButton"); |
242 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); | 245 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); |
243 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); | 246 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); |
244 | 247 | ||
245 | mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, | 248 | mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab, |
246 | "mBackgroundBox"); | 249 | "mBackgroundBox"); |
247 | connect(mBackgroundBox, SIGNAL(toggled(bool)), | 250 | connect(mBackgroundBox, SIGNAL(toggled(bool)), |
248 | SLOT(enableBackgroundToggled(bool))); | 251 | SLOT(enableBackgroundToggled(bool))); |
249 | // LR image not implemented | 252 | // LR image not implemented |
@@ -253,93 +256,93 @@ void LookAndFeelPage::initGUI() | |||
253 | mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | | 256 | mBackgroundName->setMode(KFile::File | KFile::ExistingOnly | |
254 | KFile::LocalOnly); | 257 | KFile::LocalOnly); |
255 | mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); | 258 | mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading)); |
256 | #endif //KAB_EMBEDDED | 259 | #endif //KAB_EMBEDDED |
257 | 260 | ||
258 | // ToolTip Checkbox | 261 | // ToolTip Checkbox |
259 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, | 262 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, |
260 | "mToolTipBox"); | 263 | "mToolTipBox"); |
261 | 264 | ||
262 | tabs->addTab( generalTab, i18n("&General") ); | 265 | tabs->addTab( generalTab, i18n("&General") ); |
263 | 266 | ||
264 | // Colors | 267 | // Colors |
265 | QVBox *colorTab = new QVBox( this, "colortab" ); | 268 | Q3VBox *colorTab = new Q3VBox( this, "colortab" ); |
266 | colorTab->setSpacing( spacing ); | 269 | colorTab->setSpacing( spacing ); |
267 | colorTab->setMargin( spacing ); | 270 | colorTab->setMargin( spacing ); |
268 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | 271 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); |
269 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | 272 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); |
270 | lbColors = new ColorListBox( colorTab ); | 273 | lbColors = new ColorListBox( colorTab ); |
271 | tabs->addTab( colorTab, i18n("&Colors") ); | 274 | tabs->addTab( colorTab, i18n("&Colors") ); |
272 | 275 | ||
273 | QWhatsThis::add( cbEnableCustomColors, i18n( | 276 | Q3WhatsThis::add( cbEnableCustomColors, i18n( |
274 | "If custom colors are enabled, you may choose the colors for the view below. " | 277 | "If custom colors are enabled, you may choose the colors for the view below. " |
275 | "Otherwise colors from your current KDE color scheme are used." | 278 | "Otherwise colors from your current KDE color scheme are used." |
276 | ) ); | 279 | ) ); |
277 | QWhatsThis::add( lbColors, i18n( | 280 | Q3WhatsThis::add( lbColors, i18n( |
278 | "Double click or press RETURN on a item to select a color for the related strings in the view." | 281 | "Double click or press RETURN on a item to select a color for the related strings in the view." |
279 | ) ); | 282 | ) ); |
280 | 283 | ||
281 | // Fonts | 284 | // Fonts |
282 | QVBox *fntTab = new QVBox( this, "fonttab" ); | 285 | Q3VBox *fntTab = new Q3VBox( this, "fonttab" ); |
283 | 286 | ||
284 | fntTab->setSpacing( spacing ); | 287 | fntTab->setSpacing( spacing ); |
285 | fntTab->setMargin( spacing ); | 288 | fntTab->setMargin( spacing ); |
286 | 289 | ||
287 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | 290 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); |
288 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | 291 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); |
289 | 292 | ||
290 | vbFonts = new QWidget( fntTab ); | 293 | vbFonts = new QWidget( fntTab ); |
291 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | 294 | Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 ); |
292 | gFnts->setSpacing( spacing ); | 295 | gFnts->setSpacing( spacing ); |
293 | gFnts->setAutoAdd( true ); | 296 | gFnts->setAutoAdd( true ); |
294 | gFnts->setColStretch( 1, 1 ); | 297 | gFnts->setColStretch( 1, 1 ); |
295 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | 298 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); |
296 | lTextFont = new QLabel( vbFonts ); | 299 | lTextFont = new QLabel( vbFonts ); |
297 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 300 | lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
298 | #ifndef KAB_EMBEDDED | 301 | #ifndef KAB_EMBEDDED |
299 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | 302 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); |
300 | #else //KAB_EMBEDDED | 303 | #else //KAB_EMBEDDED |
301 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | 304 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); |
302 | #endif //KAB_EMBEDDED | 305 | #endif //KAB_EMBEDDED |
303 | 306 | ||
304 | lTFnt->setBuddy( btnFont ); | 307 | lTFnt->setBuddy( btnFont ); |
305 | 308 | ||
306 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); | 309 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); |
307 | 310 | ||
308 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); | 311 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); |
309 | lHeaderFont = new QLabel( vbFonts ); | 312 | lHeaderFont = new QLabel( vbFonts ); |
310 | lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 313 | lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
311 | #ifndef KAB_EMBEDDED | 314 | #ifndef KAB_EMBEDDED |
312 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); | 315 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); |
313 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
314 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); | 317 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); |
315 | #endif //KAB_EMBEDDED | 318 | #endif //KAB_EMBEDDED |
316 | lHFnt->setBuddy( btnHeaderFont ); | 319 | lHFnt->setBuddy( btnHeaderFont ); |
317 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); | 320 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); |
318 | 321 | ||
319 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); | 322 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); |
320 | 323 | ||
321 | QWhatsThis::add( cbEnableCustomFonts, i18n( | 324 | Q3WhatsThis::add( cbEnableCustomFonts, i18n( |
322 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " | 325 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " |
323 | "Otherwise the default KDE font will be used, in bold style for the header and " | 326 | "Otherwise the default KDE font will be used, in bold style for the header and " |
324 | "normal style for the data." | 327 | "normal style for the data." |
325 | ) ); | 328 | ) ); |
326 | 329 | ||
327 | tabs->addTab( fntTab, i18n("&Fonts") ); | 330 | tabs->addTab( fntTab, i18n("&Fonts") ); |
328 | 331 | ||
329 | } | 332 | } |
330 | 333 | ||
331 | void LookAndFeelPage::enableBackgroundToggled(bool enabled) | 334 | void LookAndFeelPage::enableBackgroundToggled(bool enabled) |
332 | { | 335 | { |
333 | mBackgroundName->setEnabled(enabled); | 336 | mBackgroundName->setEnabled(enabled); |
334 | } | 337 | } |
335 | 338 | ||
336 | 339 | ||
337 | void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l ) | 340 | void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l ) |
338 | { | 341 | { |
339 | l->setFont( fnt ); | 342 | l->setFont( fnt ); |
340 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); | 343 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); |
341 | } | 344 | } |
342 | 345 | ||
343 | #ifndef KAB_EMBEDDED | 346 | #ifndef KAB_EMBEDDED_ |
344 | #include "configuretableviewdialog.moc" | 347 | #include "moc_configuretableviewdialog.cpp" |
345 | #endif //KAB_EMBEDDED | 348 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/configuretableviewdialog.h b/kaddressbook/views/configuretableviewdialog.h index 003ccf8..8125fc9 100644 --- a/kaddressbook/views/configuretableviewdialog.h +++ b/kaddressbook/views/configuretableviewdialog.h | |||
@@ -17,25 +17,27 @@ | |||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef CONFIGURETABLEVIEWDIALOG_H | 24 | #ifndef CONFIGURETABLEVIEWDIALOG_H |
25 | #define CONFIGURETABLEVIEWDIALOG_H | 25 | #define CONFIGURETABLEVIEWDIALOG_H |
26 | 26 | ||
27 | #include "viewconfigurewidget.h" | 27 | #include "viewconfigurewidget.h" |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | //Added by qt3to4: | ||
31 | #include <QLabel> | ||
30 | 32 | ||
31 | class QString; | 33 | class QString; |
32 | class QWidget; | 34 | class QWidget; |
33 | class QRadioButton; | 35 | class QRadioButton; |
34 | class QCheckBox; | 36 | class QCheckBox; |
35 | class KURLRequester; | 37 | class KURLRequester; |
36 | class KConfig; | 38 | class KConfig; |
37 | class QLabel; | 39 | class QLabel; |
38 | 40 | ||
39 | namespace KABC { class AddressBook; } | 41 | namespace KABC { class AddressBook; } |
40 | 42 | ||
41 | class LookAndFeelPage; | 43 | class LookAndFeelPage; |
@@ -54,25 +56,25 @@ class ConfigureTableViewWidget : public ViewConfigureWidget | |||
54 | virtual void restoreSettings( KConfig* ); | 56 | virtual void restoreSettings( KConfig* ); |
55 | virtual void saveSettings( KConfig* ); | 57 | virtual void saveSettings( KConfig* ); |
56 | 58 | ||
57 | private: | 59 | private: |
58 | void initGUI(); | 60 | void initGUI(); |
59 | 61 | ||
60 | LookAndFeelPage *mPage; | 62 | LookAndFeelPage *mPage; |
61 | }; | 63 | }; |
62 | 64 | ||
63 | /** | 65 | /** |
64 | Internal class. It is only defined here for moc | 66 | Internal class. It is only defined here for moc |
65 | */ | 67 | */ |
66 | class LookAndFeelPage : public QVBox | 68 | class LookAndFeelPage : public Q3VBox |
67 | { | 69 | { |
68 | Q_OBJECT | 70 | Q_OBJECT |
69 | 71 | ||
70 | public: | 72 | public: |
71 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); | 73 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); |
72 | ~LookAndFeelPage() {} | 74 | ~LookAndFeelPage() {} |
73 | 75 | ||
74 | void restoreSettings( KConfig* ); | 76 | void restoreSettings( KConfig* ); |
75 | void saveSettings( KConfig* ); | 77 | void saveSettings( KConfig* ); |
76 | 78 | ||
77 | protected slots: | 79 | protected slots: |
78 | void enableBackgroundToggled( bool ); | 80 | void enableBackgroundToggled( bool ); |
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 9accf78..227645d 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -12,67 +12,73 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qheader.h> | 24 | #include <q3header.h> |
25 | #include <qiconset.h> | 25 | #include <qicon.h> |
26 | #include <qimage.h> | 26 | #include <qimage.h> |
27 | #include <qdragobject.h> | 27 | #include <q3dragobject.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qbrush.h> | 30 | #include <qbrush.h> |
31 | #include <qevent.h> | 31 | #include <qevent.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //Added by qt3to4: | ||
34 | #include <QDropEvent> | ||
35 | #include <QPixmap> | ||
36 | #include <QMouseEvent> | ||
37 | #include <QKeyEvent> | ||
33 | 38 | ||
34 | #include <klocale.h> | 39 | #include <klocale.h> |
35 | #include <kglobalsettings.h> | 40 | #include <kglobalsettings.h> |
36 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
37 | #include <kdebug.h> | 42 | #include <kdebug.h> |
38 | #include <kconfig.h> | 43 | #include <kconfig.h> |
39 | #include <kapplication.h> | 44 | #include <kapplication.h> |
40 | #include <kurl.h> | 45 | #include <kurl.h> |
41 | 46 | ||
42 | #include "kaddressbooktableview.h" | 47 | #include "kaddressbooktableview.h" |
43 | 48 | ||
44 | #include "contactlistview.h" | 49 | #include "contactlistview.h" |
45 | 50 | ||
46 | ///////////////////////////////// | 51 | ///////////////////////////////// |
47 | // DynamicTip Methods | 52 | // DynamicTip Methods |
48 | 53 | ||
49 | DynamicTip::DynamicTip( ContactListView *parent) | 54 | DynamicTip::DynamicTip( ContactListView *parent) |
50 | : QToolTip( parent ) | 55 | /* TODO:hacker:: QToolTip( parent ) */ |
51 | { | 56 | { |
52 | } | 57 | } |
53 | 58 | ||
54 | void DynamicTip::maybeTip( const QPoint &pos ) | 59 | void DynamicTip::maybeTip( const QPoint &pos ) |
55 | { | 60 | { |
61 | /* TODO:hacker: | ||
56 | static bool ishidden = true; | 62 | static bool ishidden = true; |
57 | if (!parentWidget()->inherits( "ContactListView" )) | 63 | if (!parentWidget()->inherits( "ContactListView" )) |
58 | return; | 64 | return; |
59 | 65 | ||
60 | ContactListView *plv = (ContactListView*)parentWidget(); | 66 | ContactListView *plv = (ContactListView*)parentWidget(); |
61 | if (!plv->tooltips()) | 67 | if (!plv->tooltips()) |
62 | return; | 68 | return; |
63 | 69 | ||
64 | QPoint posVp = plv->viewport()->pos(); | 70 | QPoint posVp = plv->viewport()->pos(); |
65 | 71 | ||
66 | QListViewItem *lvi = plv->itemAt( pos - posVp ); | 72 | Q3ListViewItem *lvi = plv->itemAt( pos - posVp ); |
67 | if (!lvi) | 73 | if (!lvi) |
68 | return; | 74 | return; |
69 | 75 | ||
70 | #ifndef KAB_EMBEDDED | 76 | #ifndef KAB_EMBEDDED |
71 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); | 77 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); |
72 | #else //KAB_EMBEDDED | 78 | #else //KAB_EMBEDDED |
73 | ContactListViewItem *plvi = (ContactListViewItem*)(lvi); | 79 | ContactListViewItem *plvi = (ContactListViewItem*)(lvi); |
74 | #endif //KAB_EMBEDDED | 80 | #endif //KAB_EMBEDDED |
75 | 81 | ||
76 | if (!plvi) | 82 | if (!plvi) |
77 | return; | 83 | return; |
78 | 84 | ||
@@ -142,71 +148,71 @@ void DynamicTip::maybeTip( const QPoint &pos ) | |||
142 | lastw = linew; | 148 | lastw = linew; |
143 | } | 149 | } |
144 | 150 | ||
145 | ++i; | 151 | ++i; |
146 | } | 152 | } |
147 | } | 153 | } |
148 | 154 | ||
149 | tip( r, s ); | 155 | tip( r, s ); |
150 | } | 156 | } |
151 | else | 157 | else |
152 | hide(); | 158 | hide(); |
153 | ishidden = !ishidden; | 159 | ishidden = !ishidden; |
154 | 160 | */ | |
155 | } | 161 | } |
156 | 162 | ||
157 | /////////////////////////// | 163 | /////////////////////////// |
158 | // ContactListViewItem Methods | 164 | // ContactListViewItem Methods |
159 | 165 | ||
160 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | 166 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, |
161 | ContactListView *parent, | 167 | ContactListView *parent, |
162 | KABC::AddressBook *doc, | 168 | KABC::AddressBook *doc, |
163 | const KABC::Field::List &fields ) | 169 | const KABC::Field::List &fields ) |
164 | : KListViewItem(parent), mAddressee(a), mFields( fields ), | 170 | : KListViewItem(parent), mAddressee(a), mFields( fields ), |
165 | parentListView( parent ), mDocument(doc) | 171 | parentListView( parent ), mDocument(doc) |
166 | { | 172 | { |
167 | refresh(); | 173 | refresh(); |
168 | } | 174 | } |
169 | 175 | ||
170 | QString ContactListViewItem::key(int column, bool ascending) const | 176 | QString ContactListViewItem::key(int column, bool ascending) const |
171 | { | 177 | { |
172 | #ifndef DESKTOP_VERSION | 178 | #ifndef DESKTOP_VERSION |
173 | int lan = KGlobal::locale()->language(); | 179 | int lan = KGlobal::locale()->language(); |
174 | //qDebug("language %d ", lan); | 180 | //qDebug("language %d ", lan); |
175 | if ( lan == 1 ) { //GERMAN | 181 | if ( lan == 1 ) { //GERMAN |
176 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); | 182 | QString ret = Q3ListViewItem::key(column, ascending).lower().utf8(); |
177 | int start = -1; | 183 | int start = -1; |
178 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 184 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
179 | ret.at(start-1) = 'a'; | 185 | ret.at(start-1) = 'a'; |
180 | } | 186 | } |
181 | start = -1; | 187 | start = -1; |
182 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 188 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
183 | ret.at(start-1) = 'o'; | 189 | ret.at(start-1) = 'o'; |
184 | } | 190 | } |
185 | start = -1; | 191 | start = -1; |
186 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { | 192 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { |
187 | ret.at(start-1) = 'o'; | 193 | ret.at(start-1) = 'o'; |
188 | } | 194 | } |
189 | start = -1; | 195 | start = -1; |
190 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { | 196 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { |
191 | ret.at(start-1) = 's'; | 197 | ret.at(start-1) = 's'; |
192 | } | 198 | } |
193 | //qDebug("conv string %s ", ret.latin1()); | 199 | //qDebug("conv string %s ", ret.latin1()); |
194 | 200 | ||
195 | return ret; | 201 | return ret; |
196 | 202 | ||
197 | } | 203 | } |
198 | else | 204 | else |
199 | #endif | 205 | #endif |
200 | return QListViewItem::key(column, ascending).lower(); | 206 | return Q3ListViewItem::key(column, ascending).lower(); |
201 | } | 207 | } |
202 | 208 | ||
203 | void ContactListViewItem::paintCell(QPainter * p, | 209 | void ContactListViewItem::paintCell(QPainter * p, |
204 | const QColorGroup & cg, | 210 | const QColorGroup & cg, |
205 | int column, | 211 | int column, |
206 | int width, | 212 | int width, |
207 | int align) | 213 | int align) |
208 | { | 214 | { |
209 | KListViewItem::paintCell(p, cg, column, width, align); | 215 | KListViewItem::paintCell(p, cg, column, width, align); |
210 | 216 | ||
211 | if ( !p ) | 217 | if ( !p ) |
212 | return; | 218 | return; |
@@ -279,25 +285,25 @@ ContactListView::ContactListView(KAddressBookTableView *view, | |||
279 | 285 | ||
280 | 286 | ||
281 | new DynamicTip( this ); | 287 | new DynamicTip( this ); |
282 | } | 288 | } |
283 | void ContactListView::printMe() | 289 | void ContactListView::printMe() |
284 | { | 290 | { |
285 | #ifdef DESKTOP_VERSION | 291 | #ifdef DESKTOP_VERSION |
286 | QPrinter printer; | 292 | QPrinter printer; |
287 | if (!printer.setup() ) | 293 | if (!printer.setup() ) |
288 | return; | 294 | return; |
289 | QPainter p; | 295 | QPainter p; |
290 | p.begin ( &printer ); | 296 | p.begin ( &printer ); |
291 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 297 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
292 | float dx, dy; | 298 | float dx, dy; |
293 | int wid = (m.width() * 9)/10; | 299 | int wid = (m.width() * 9)/10; |
294 | dx = (float) wid/(float)contentsWidth (); | 300 | dx = (float) wid/(float)contentsWidth (); |
295 | dy = (float)(m.height()) / (float)contentsHeight (); | 301 | dy = (float)(m.height()) / (float)contentsHeight (); |
296 | float scale; | 302 | float scale; |
297 | // scale to fit the width or height of the paper | 303 | // scale to fit the width or height of the paper |
298 | if ( dx < dy ) | 304 | if ( dx < dy ) |
299 | scale = dx; | 305 | scale = dx; |
300 | else | 306 | else |
301 | scale = dy; | 307 | scale = dy; |
302 | p.translate( m.width()/10,0 ); | 308 | p.translate( m.width()/10,0 ); |
303 | p.scale( scale, scale ); | 309 | p.scale( scale, scale ); |
@@ -334,35 +340,35 @@ void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | |||
334 | } | 340 | } |
335 | 341 | ||
336 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) | 342 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) |
337 | { | 343 | { |
338 | presspos = e->pos(); | 344 | presspos = e->pos(); |
339 | KListView::contentsMousePressEvent(e); | 345 | KListView::contentsMousePressEvent(e); |
340 | } | 346 | } |
341 | 347 | ||
342 | 348 | ||
343 | // To initiate a drag operation | 349 | // To initiate a drag operation |
344 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 350 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
345 | { | 351 | { |
346 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 352 | if ((e->state() & Qt::LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
347 | emit startAddresseeDrag(); | 353 | emit startAddresseeDrag(); |
348 | } | 354 | } |
349 | else | 355 | else |
350 | KListView::contentsMouseMoveEvent( e ); | 356 | KListView::contentsMouseMoveEvent( e ); |
351 | } | 357 | } |
352 | 358 | ||
353 | bool ContactListView::acceptDrag(QDropEvent *e) const | 359 | bool ContactListView::acceptDrag(QDropEvent *e) const |
354 | { | 360 | { |
355 | #ifndef KAB_EMBEDDED | 361 | #ifndef KAB_EMBEDDED |
356 | return QTextDrag::canDecode(e); | 362 | return Q3TextDrag::canDecode(e); |
357 | #else //KAB_EMBEDDED | 363 | #else //KAB_EMBEDDED |
358 | qDebug("ContactListView::acceptDrag has to be fixed"); | 364 | qDebug("ContactListView::acceptDrag has to be fixed"); |
359 | return false; | 365 | return false; |
360 | #endif //KAB_EMBEDDED | 366 | #endif //KAB_EMBEDDED |
361 | } | 367 | } |
362 | 368 | ||
363 | void ContactListView::itemDropped(QDropEvent *e) | 369 | void ContactListView::itemDropped(QDropEvent *e) |
364 | { | 370 | { |
365 | contentsDropEvent(e); | 371 | contentsDropEvent(e); |
366 | } | 372 | } |
367 | 373 | ||
368 | void ContactListView::contentsDropEvent( QDropEvent *e ) | 374 | void ContactListView::contentsDropEvent( QDropEvent *e ) |
@@ -415,15 +421,15 @@ void ContactListView::keyPressEvent ( QKeyEvent * e ) | |||
415 | void ContactListView::keyReleaseEvent ( QKeyEvent * e ) | 421 | void ContactListView::keyReleaseEvent ( QKeyEvent * e ) |
416 | { | 422 | { |
417 | if ( mFlagBlockKeyPressed ) | 423 | if ( mFlagBlockKeyPressed ) |
418 | return; | 424 | return; |
419 | if ( !e->isAutoRepeat() ) { | 425 | if ( !e->isAutoRepeat() ) { |
420 | mFlagBlockKeyPressed = true; | 426 | mFlagBlockKeyPressed = true; |
421 | qApp->processEvents(); | 427 | qApp->processEvents(); |
422 | mFlagBlockKeyPressed = false; | 428 | mFlagBlockKeyPressed = false; |
423 | mFlagKeyPressed = false; | 429 | mFlagKeyPressed = false; |
424 | } | 430 | } |
425 | KListView::keyReleaseEvent ( e ); | 431 | KListView::keyReleaseEvent ( e ); |
426 | } | 432 | } |
427 | #ifndef KAB_EMBEDDED | 433 | #ifndef KAB_EMBEDDED_ |
428 | #include "contactlistview.moc" | 434 | #include "moc_contactlistview.cpp" |
429 | #endif //KAB_EMBEDDED | 435 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h index 46477e1..c92b002 100644 --- a/kaddressbook/views/contactlistview.h +++ b/kaddressbook/views/contactlistview.h | |||
@@ -1,35 +1,39 @@ | |||
1 | #ifndef CONTACTLISTVIEW_H | 1 | #ifndef CONTACTLISTVIEW_H |
2 | #define CONTACTLISTVIEW_H | 2 | #define CONTACTLISTVIEW_H |
3 | 3 | ||
4 | #include <qcolor.h> | 4 | #include <qcolor.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qtooltip.h> | 6 | #include <qtooltip.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | //Added by qt3to4: | ||
9 | #include <QDropEvent> | ||
10 | #include <QMouseEvent> | ||
11 | #include <QKeyEvent> | ||
8 | 12 | ||
9 | #include <klistview.h> | 13 | #include <klistview.h> |
10 | 14 | ||
11 | #include <kabc/field.h> | 15 | #include <kabc/field.h> |
12 | #include <kabc/addressee.h> | 16 | #include <kabc/addressee.h> |
13 | #include <kabc/addressbook.h> | 17 | #include <kabc/addressbook.h> |
14 | 18 | ||
15 | 19 | ||
16 | class QDropEvent; | 20 | class QDropEvent; |
17 | class KAddressBookTableView; | 21 | class KAddressBookTableView; |
18 | class ContactListView; | 22 | class ContactListView; |
19 | 23 | ||
20 | /** The whole tooltip design needs a lot of work. Currently it is | 24 | /** The whole tooltip design needs a lot of work. Currently it is |
21 | * hacked together to function. | 25 | * hacked together to function. |
22 | */ | 26 | */ |
23 | class DynamicTip : public QToolTip | 27 | class DynamicTip /* TODO:hacker: : public QToolTip */ |
24 | { | 28 | { |
25 | public: | 29 | public: |
26 | DynamicTip( ContactListView * parent ); | 30 | DynamicTip( ContactListView * parent ); |
27 | 31 | ||
28 | protected: | 32 | protected: |
29 | void maybeTip( const QPoint & ); | 33 | void maybeTip( const QPoint & ); |
30 | 34 | ||
31 | private: | 35 | private: |
32 | }; | 36 | }; |
33 | 37 | ||
34 | class ContactListViewItem : public KListViewItem | 38 | class ContactListViewItem : public KListViewItem |
35 | { | 39 | { |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index b503652..1e5a556 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -12,31 +12,36 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qdragobject.h> | 24 | #include <q3dragobject.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qiconview.h> | 26 | #include <q3iconview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | //Added by qt3to4: | ||
32 | #include <QDropEvent> | ||
33 | #include <QKeyEvent> | ||
34 | #include <Q3VBoxLayout> | ||
35 | #include <QDragEnterEvent> | ||
31 | 36 | ||
32 | #include <kabc/addressbook.h> | 37 | #include <kabc/addressbook.h> |
33 | #include <kabc/addressee.h> | 38 | #include <kabc/addressee.h> |
34 | #include <kconfig.h> | 39 | #include <kconfig.h> |
35 | #include <kdebug.h> | 40 | #include <kdebug.h> |
36 | #include <klocale.h> | 41 | #include <klocale.h> |
37 | 42 | ||
38 | #include "kabprefs.h" | 43 | #include "kabprefs.h" |
39 | #include "viewmanager.h" | 44 | #include "viewmanager.h" |
40 | 45 | ||
41 | 46 | ||
42 | #include "kaddressbookcardview.h" | 47 | #include "kaddressbookcardview.h" |
@@ -116,48 +121,48 @@ AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) | |||
116 | 121 | ||
117 | AddresseeCardView::~AddresseeCardView() | 122 | AddresseeCardView::~AddresseeCardView() |
118 | { | 123 | { |
119 | } | 124 | } |
120 | void AddresseeCardView::printMe() | 125 | void AddresseeCardView::printMe() |
121 | { | 126 | { |
122 | #ifdef DESKTOP_VERSION | 127 | #ifdef DESKTOP_VERSION |
123 | QPrinter printer; | 128 | QPrinter printer; |
124 | if (!printer.setup() ) | 129 | if (!printer.setup() ) |
125 | return; | 130 | return; |
126 | QPainter p; | 131 | QPainter p; |
127 | p.begin ( &printer ); | 132 | p.begin ( &printer ); |
128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 133 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
129 | float dx, dy; | 134 | float dx, dy; |
130 | int wid = (m.width() * 9)/10; | 135 | int wid = (m.width() * 9)/10; |
131 | dx = (float) wid/(float)contentsWidth (); | 136 | dx = (float) wid/(float)contentsWidth (); |
132 | dy = (float)(m.height()) / (float)contentsHeight (); | 137 | dy = (float)(m.height()) / (float)contentsHeight (); |
133 | float scale; | 138 | float scale; |
134 | // scale to fit the width or height of the paper | 139 | // scale to fit the width or height of the paper |
135 | if ( dx < dy ) | 140 | if ( dx < dy ) |
136 | scale = dx; | 141 | scale = dx; |
137 | else | 142 | else |
138 | scale = dy; | 143 | scale = dy; |
139 | p.translate( m.width()/10,0 ); | 144 | p.translate( m.width()/10,0 ); |
140 | p.scale( scale, scale ); | 145 | p.scale( scale, scale ); |
141 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 146 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
142 | p.end(); | 147 | p.end(); |
143 | repaint(); | 148 | repaint(); |
144 | #endif | 149 | #endif |
145 | } | 150 | } |
146 | 151 | ||
147 | 152 | ||
148 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) | 153 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) |
149 | { | 154 | { |
150 | #ifndef KAB_EMBEDDED | 155 | #ifndef KAB_EMBEDDED |
151 | if (QTextDrag::canDecode(e)) | 156 | if (Q3TextDrag::canDecode(e)) |
152 | e->accept(); | 157 | e->accept(); |
153 | #else //KAB_EMBEDDED | 158 | #else //KAB_EMBEDDED |
154 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); | 159 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); |
155 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
156 | } | 161 | } |
157 | 162 | ||
158 | void AddresseeCardView::dropEvent(QDropEvent *e) | 163 | void AddresseeCardView::dropEvent(QDropEvent *e) |
159 | { | 164 | { |
160 | emit addresseeDropped(e); | 165 | emit addresseeDropped(e); |
161 | } | 166 | } |
162 | 167 | ||
163 | void AddresseeCardView::startDrag() | 168 | void AddresseeCardView::startDrag() |
@@ -167,25 +172,25 @@ void AddresseeCardView::startDrag() | |||
167 | 172 | ||
168 | 173 | ||
169 | /////////////////////////////// | 174 | /////////////////////////////// |
170 | // KAddressBookCardView | 175 | // KAddressBookCardView |
171 | 176 | ||
172 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 177 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
173 | QWidget *parent, const char *name ) | 178 | QWidget *parent, const char *name ) |
174 | : KAddressBookView( ab, parent, name ) | 179 | : KAddressBookView( ab, parent, name ) |
175 | { | 180 | { |
176 | mShowEmptyFields = false; | 181 | mShowEmptyFields = false; |
177 | 182 | ||
178 | // Init the GUI | 183 | // Init the GUI |
179 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 184 | Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget()); |
180 | 185 | ||
181 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 186 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
182 | mCardView->setSelectionMode(CardView::Extended); | 187 | mCardView->setSelectionMode(CardView::Extended); |
183 | layout->addWidget(mCardView); | 188 | layout->addWidget(mCardView); |
184 | 189 | ||
185 | // Connect up the signals | 190 | // Connect up the signals |
186 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 191 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
187 | this, SLOT(addresseeExecuted(CardViewItem *))); | 192 | this, SLOT(addresseeExecuted(CardViewItem *))); |
188 | connect(mCardView, SIGNAL(selectionChanged()), | 193 | connect(mCardView, SIGNAL(selectionChanged()), |
189 | this, SLOT(addresseeSelected())); | 194 | this, SLOT(addresseeSelected())); |
190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 195 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
191 | this, SIGNAL(dropped(QDropEvent*))); | 196 | this, SIGNAL(dropped(QDropEvent*))); |
@@ -511,15 +516,15 @@ void KAddressBookCardView::addresseeSelected() | |||
511 | if ( aItem ) | 516 | if ( aItem ) |
512 | { | 517 | { |
513 | emit selected(aItem->addressee().uid()); | 518 | emit selected(aItem->addressee().uid()); |
514 | found = true; | 519 | found = true; |
515 | } | 520 | } |
516 | } | 521 | } |
517 | } | 522 | } |
518 | 523 | ||
519 | if (!found) | 524 | if (!found) |
520 | emit selected(QString::null); | 525 | emit selected(QString::null); |
521 | 526 | ||
522 | } | 527 | } |
523 | #ifndef KAB_EMBEDDED | 528 | #ifndef KAB_EMBEDDED_ |
524 | #include "kaddressbookcardview.moc" | 529 | #include "moc_kaddressbookcardview.cpp" |
525 | #endif //KAB_EMBEDDED | 530 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 2a71f7e..8f8e48b 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -16,24 +16,27 @@ | |||
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | //Added by qt3to4: | ||
29 | #include <QDragEnterEvent> | ||
30 | #include <QDropEvent> | ||
28 | #ifndef KAB_EMBEDDED | 31 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 32 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <klocale.h> | 34 | #include <klocale.h> |
32 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
33 | 36 | ||
34 | #include "cardview.h" | 37 | #include "cardview.h" |
35 | #include "kaddressbookview.h" | 38 | #include "kaddressbookview.h" |
36 | #include "configurecardviewdialog.h" | 39 | #include "configurecardviewdialog.h" |
37 | 40 | ||
38 | class QDragEnterEvent; | 41 | class QDragEnterEvent; |
39 | class QDragEntryEvent; | 42 | class QDragEntryEvent; |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index d6ddec3..3a41a4b 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -13,37 +13,45 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qiconview.h> | 25 | #include <q3iconview.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | #include <kabc/addressee.h> | 28 | #include <kabc/addressee.h> |
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #else //KAB_EMBEDDED | 35 | #else //KAB_EMBEDDED |
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | //Added by qt3to4: | ||
39 | #include <QDropEvent> | ||
40 | #include <Q3ValueList> | ||
41 | #include <QPixmap> | ||
42 | #include <QKeyEvent> | ||
43 | #include <QEvent> | ||
44 | #include <Q3VBoxLayout> | ||
45 | |||
38 | #include <kabc/addressbook.h> | 46 | #include <kabc/addressbook.h> |
39 | #include "kabprefs.h" | 47 | #include "kabprefs.h" |
40 | #include "viewmanager.h" | 48 | #include "viewmanager.h" |
41 | #include "kaddressbookiconview.h" | 49 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 50 | #include <qlayout.h> |
43 | #include <qregexp.h> | 51 | #include <qregexp.h> |
44 | #include <qapplication.h> | 52 | #include <qapplication.h> |
45 | #include <kglobal.h> | 53 | #include <kglobal.h> |
46 | /*US transfered to the headerfile | 54 | /*US transfered to the headerfile |
47 | class IconViewFactory : public ViewFactory | 55 | class IconViewFactory : public ViewFactory |
48 | { | 56 | { |
49 | public: | 57 | public: |
@@ -64,82 +72,82 @@ extern "C" { | |||
64 | { | 72 | { |
65 | return ( new IconViewFactory ); | 73 | return ( new IconViewFactory ); |
66 | } | 74 | } |
67 | } | 75 | } |
68 | 76 | ||
69 | //////////////////////////////// | 77 | //////////////////////////////// |
70 | // AddresseeIconView (internal class) | 78 | // AddresseeIconView (internal class) |
71 | #ifndef KAB_EMBEDDED | 79 | #ifndef KAB_EMBEDDED |
72 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 80 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
73 | : KIconView(parent, name) | 81 | : KIconView(parent, name) |
74 | #else //KAB_EMBEDDED | 82 | #else //KAB_EMBEDDED |
75 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 83 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
76 | : QIconView(parent, name) | 84 | : Q3IconView(parent, name) |
77 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
78 | 86 | ||
79 | { | 87 | { |
80 | setSelectionMode( QIconView::Extended ); | 88 | setSelectionMode( Q3IconView::Extended ); |
81 | setResizeMode( QIconView::Adjust ); | 89 | setResizeMode( Q3IconView::Adjust ); |
82 | setWordWrapIconText( true ); | 90 | setWordWrapIconText( true ); |
83 | setGridX( 100 ); | 91 | setGridX( 100 ); |
84 | setItemsMovable(false); | 92 | setItemsMovable(false); |
85 | setSorting(true, true); | 93 | setSorting(true, true); |
86 | 94 | ||
87 | 95 | ||
88 | //US ??? setMode( KIconView::Select ); | 96 | //US ??? setMode( KIconView::Select ); |
89 | 97 | ||
90 | #ifndef KAB_EMBEDDED | 98 | #ifndef KAB_EMBEDDED |
91 | 99 | ||
92 | connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), | 100 | connect(this, SIGNAL(dropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)), |
93 | this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&))); | 101 | this, SLOT(itemDropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&))); |
94 | #endif //KAB_EMBEDDED | 102 | #endif //KAB_EMBEDDED |
95 | } | 103 | } |
96 | 104 | ||
97 | AddresseeIconView::~AddresseeIconView() | 105 | AddresseeIconView::~AddresseeIconView() |
98 | { | 106 | { |
99 | } | 107 | } |
100 | 108 | ||
101 | 109 | ||
102 | void AddresseeIconView::itemDropped(QDropEvent *e, | 110 | void AddresseeIconView::itemDropped(QDropEvent *e, |
103 | const QValueList<QIconDragItem> &) | 111 | const Q3ValueList<Q3IconDragItem> &) |
104 | { | 112 | { |
105 | emit addresseeDropped(e); | 113 | emit addresseeDropped(e); |
106 | } | 114 | } |
107 | 115 | ||
108 | QDragObject *AddresseeIconView::dragObject() | 116 | Q3DragObject *AddresseeIconView::dragObject() |
109 | { | 117 | { |
110 | emit startAddresseeDrag(); | 118 | emit startAddresseeDrag(); |
111 | 119 | ||
112 | // We never want IconView to start the drag | 120 | // We never want IconView to start the drag |
113 | return 0; | 121 | return 0; |
114 | } | 122 | } |
115 | //////////////////////////////// | 123 | //////////////////////////////// |
116 | // AddresseeIconViewItem (internal class) | 124 | // AddresseeIconViewItem (internal class) |
117 | #ifndef KAB_EMBEDDED | 125 | #ifndef KAB_EMBEDDED |
118 | class AddresseeIconViewItem : public KIconViewItem | 126 | class AddresseeIconViewItem : public KIconViewItem |
119 | #else //KAB_EMBEDDED | 127 | #else //KAB_EMBEDDED |
120 | class AddresseeIconViewItem : public QIconViewItem | 128 | class AddresseeIconViewItem : public Q3IconViewItem |
121 | #endif //KAB_EMBEDDED | 129 | #endif //KAB_EMBEDDED |
122 | { | 130 | { |
123 | public: | 131 | public: |
124 | #ifndef KAB_EMBEDDED | 132 | #ifndef KAB_EMBEDDED |
125 | AddresseeIconViewItem(const KABC::Field::List &fields, | 133 | AddresseeIconViewItem(const KABC::Field::List &fields, |
126 | KABC::AddressBook *doc, const KABC::Addressee &a, | 134 | KABC::AddressBook *doc, const KABC::Addressee &a, |
127 | QIconView *parent) | 135 | Q3IconView *parent) |
128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 136 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
129 | #else //KAB_EMBEDDED | 137 | #else //KAB_EMBEDDED |
130 | AddresseeIconViewItem(const KABC::Field::List &fields, | 138 | AddresseeIconViewItem(const KABC::Field::List &fields, |
131 | KABC::AddressBook *doc, const KABC::Addressee &a, | 139 | KABC::AddressBook *doc, const KABC::Addressee &a, |
132 | QIconView *parent) | 140 | Q3IconView *parent) |
133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 141 | : Q3IconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
134 | #endif //KAB_EMBEDDED | 142 | #endif //KAB_EMBEDDED |
135 | { | 143 | { |
136 | if ( mFields.isEmpty() ) { | 144 | if ( mFields.isEmpty() ) { |
137 | mFields = KABC::Field::defaultFields(); | 145 | mFields = KABC::Field::defaultFields(); |
138 | } | 146 | } |
139 | refresh(); | 147 | refresh(); |
140 | } | 148 | } |
141 | 149 | ||
142 | const KABC::Addressee &addressee() const { return mAddressee; } | 150 | const KABC::Addressee &addressee() const { return mAddressee; } |
143 | 151 | ||
144 | void refresh() | 152 | void refresh() |
145 | { | 153 | { |
@@ -191,36 +199,36 @@ class AddresseeIconViewItem : public QIconViewItem | |||
191 | KABC::AddressBook *mDocument; | 199 | KABC::AddressBook *mDocument; |
192 | KABC::Addressee mAddressee; | 200 | KABC::Addressee mAddressee; |
193 | }; | 201 | }; |
194 | 202 | ||
195 | /////////////////////////////// | 203 | /////////////////////////////// |
196 | // KAddressBookView | 204 | // KAddressBookView |
197 | 205 | ||
198 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 206 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
199 | QWidget *parent, const char *name) | 207 | QWidget *parent, const char *name) |
200 | : KAddressBookView( ab, parent, name ) | 208 | : KAddressBookView( ab, parent, name ) |
201 | { | 209 | { |
202 | // Init the GUI | 210 | // Init the GUI |
203 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 211 | Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget()); |
204 | 212 | ||
205 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 213 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
206 | layout->addWidget(mIconView); | 214 | layout->addWidget(mIconView); |
207 | 215 | ||
208 | // Connect up the signals | 216 | // Connect up the signals |
209 | 217 | ||
210 | //US method executed is part of KIconView | 218 | //US method executed is part of KIconView |
211 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 219 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
212 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
213 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 221 | connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
214 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 222 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
215 | 223 | ||
216 | connect(mIconView, SIGNAL(selectionChanged()), | 224 | connect(mIconView, SIGNAL(selectionChanged()), |
217 | this, SLOT(addresseeSelected())); | 225 | this, SLOT(addresseeSelected())); |
218 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 226 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
219 | this, SIGNAL(dropped(QDropEvent*))); | 227 | this, SIGNAL(dropped(QDropEvent*))); |
220 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 228 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
221 | this, SIGNAL(startDrag())); | 229 | this, SIGNAL(startDrag())); |
222 | } | 230 | } |
223 | 231 | ||
224 | KAddressBookIconView::~KAddressBookIconView() | 232 | KAddressBookIconView::~KAddressBookIconView() |
225 | { | 233 | { |
226 | } | 234 | } |
@@ -239,38 +247,38 @@ void KAddressBookIconView::scrollUP() | |||
239 | void KAddressBookIconView::scrollDOWN() | 247 | void KAddressBookIconView::scrollDOWN() |
240 | { | 248 | { |
241 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 249 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
242 | QApplication::postEvent( mIconView, ev ); | 250 | QApplication::postEvent( mIconView, ev ); |
243 | } | 251 | } |
244 | void KAddressBookIconView::readConfig(KConfig *config) | 252 | void KAddressBookIconView::readConfig(KConfig *config) |
245 | { | 253 | { |
246 | KAddressBookView::readConfig(config); | 254 | KAddressBookView::readConfig(config); |
247 | 255 | ||
248 | //US method executed is part of KIconView | 256 | //US method executed is part of KIconView |
249 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 257 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
250 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 258 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
251 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 259 | disconnect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
252 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 260 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
253 | 261 | ||
254 | //US method executed is part of KIconView. Use selectionChanged instead | 262 | //US method executed is part of KIconView. Use selectionChanged instead |
255 | /*US | 263 | /*US |
256 | if (KABPrefs::instance()->mHonorSingleClick) | 264 | if (KABPrefs::instance()->mHonorSingleClick) |
257 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 265 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
258 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 266 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
259 | else | 267 | else |
260 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 268 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
261 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 269 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
262 | */ | 270 | */ |
263 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 271 | connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
264 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 272 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
265 | 273 | ||
266 | } | 274 | } |
267 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 275 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
268 | { | 276 | { |
269 | mIconView->clear(); | 277 | mIconView->clear(); |
270 | mIconList.clear(); | 278 | mIconList.clear(); |
271 | if ( s.isEmpty() || s == "*" ) { | 279 | if ( s.isEmpty() || s == "*" ) { |
272 | refresh(); | 280 | refresh(); |
273 | return; | 281 | return; |
274 | } | 282 | } |
275 | QRegExp re = getRegExp( s ); | 283 | QRegExp re = getRegExp( s ); |
276 | if (!re.isValid()) | 284 | if (!re.isValid()) |
@@ -327,47 +335,47 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
327 | } | 335 | } |
328 | mIconView->arrangeItemsInGrid( true ); | 336 | mIconView->arrangeItemsInGrid( true ); |
329 | if ( mIconView->firstItem() ) { | 337 | if ( mIconView->firstItem() ) { |
330 | mIconView->setCurrentItem ( mIconView->firstItem() ); | 338 | mIconView->setCurrentItem ( mIconView->firstItem() ); |
331 | mIconView->setSelected ( mIconView->firstItem() , true ); | 339 | mIconView->setSelected ( mIconView->firstItem() , true ); |
332 | } | 340 | } |
333 | else | 341 | else |
334 | emit selected(QString::null); | 342 | emit selected(QString::null); |
335 | } | 343 | } |
336 | QStringList KAddressBookIconView::selectedUids() | 344 | QStringList KAddressBookIconView::selectedUids() |
337 | { | 345 | { |
338 | QStringList uidList; | 346 | QStringList uidList; |
339 | QIconViewItem *item; | 347 | Q3IconViewItem *item; |
340 | AddresseeIconViewItem *aItem; | 348 | AddresseeIconViewItem *aItem; |
341 | 349 | ||
342 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 350 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
343 | { | 351 | { |
344 | if (item->isSelected()) | 352 | if (item->isSelected()) |
345 | { | 353 | { |
346 | #ifndef KAB_EMBEDDED | 354 | #ifndef KAB_EMBEDDED |
347 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 355 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
348 | #else //KAB_EMBEDDED | 356 | #else //KAB_EMBEDDED |
349 | aItem = (AddresseeIconViewItem*)(item); | 357 | aItem = (AddresseeIconViewItem*)(item); |
350 | #endif //KAB_EMBEDDED | 358 | #endif //KAB_EMBEDDED |
351 | if (aItem) | 359 | if (aItem) |
352 | uidList << aItem->addressee().uid(); | 360 | uidList << aItem->addressee().uid(); |
353 | } | 361 | } |
354 | } | 362 | } |
355 | 363 | ||
356 | return uidList; | 364 | return uidList; |
357 | } | 365 | } |
358 | 366 | ||
359 | void KAddressBookIconView::refresh(QString uid) | 367 | void KAddressBookIconView::refresh(QString uid) |
360 | { | 368 | { |
361 | QIconViewItem *item; | 369 | Q3IconViewItem *item; |
362 | AddresseeIconViewItem *aItem; | 370 | AddresseeIconViewItem *aItem; |
363 | 371 | ||
364 | if ( uid.isNull() ) { | 372 | if ( uid.isNull() ) { |
365 | // Rebuild the view | 373 | // Rebuild the view |
366 | mIconView->clear(); | 374 | mIconView->clear(); |
367 | mIconList.clear(); | 375 | mIconList.clear(); |
368 | 376 | ||
369 | KABC::Addressee::List addresseeList = addressees(); | 377 | KABC::Addressee::List addresseeList = addressees(); |
370 | KABC::Addressee::List::Iterator iter; | 378 | KABC::Addressee::List::Iterator iter; |
371 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { | 379 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { |
372 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) | 380 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) |
373 | continue; | 381 | continue; |
@@ -397,25 +405,25 @@ void KAddressBookIconView::refresh(QString uid) | |||
397 | if ((aItem) && (aItem->addressee().uid() == uid)) { | 405 | if ((aItem) && (aItem->addressee().uid() == uid)) { |
398 | aItem->refresh(); | 406 | aItem->refresh(); |
399 | mIconView->arrangeItemsInGrid( true ); | 407 | mIconView->arrangeItemsInGrid( true ); |
400 | return; | 408 | return; |
401 | } | 409 | } |
402 | } | 410 | } |
403 | refresh( QString::null ); | 411 | refresh( QString::null ); |
404 | } | 412 | } |
405 | } | 413 | } |
406 | 414 | ||
407 | void KAddressBookIconView::setSelected(QString uid, bool selected) | 415 | void KAddressBookIconView::setSelected(QString uid, bool selected) |
408 | { | 416 | { |
409 | QIconViewItem *item; | 417 | Q3IconViewItem *item; |
410 | AddresseeIconViewItem *aItem; | 418 | AddresseeIconViewItem *aItem; |
411 | 419 | ||
412 | if (uid.isNull()) | 420 | if (uid.isNull()) |
413 | { | 421 | { |
414 | mIconView->selectAll(selected); | 422 | mIconView->selectAll(selected); |
415 | } | 423 | } |
416 | else | 424 | else |
417 | { | 425 | { |
418 | bool found = false; | 426 | bool found = false; |
419 | for (item = mIconView->firstItem(); item && !found; | 427 | for (item = mIconView->firstItem(); item && !found; |
420 | item = item->nextItem()) | 428 | item = item->nextItem()) |
421 | { | 429 | { |
@@ -426,40 +434,40 @@ void KAddressBookIconView::setSelected(QString uid, bool selected) | |||
426 | #endif //KAB_EMBEDDED | 434 | #endif //KAB_EMBEDDED |
427 | 435 | ||
428 | if ((aItem) && (aItem->addressee().uid() == uid)) | 436 | if ((aItem) && (aItem->addressee().uid() == uid)) |
429 | { | 437 | { |
430 | mIconView->setSelected(aItem, selected); | 438 | mIconView->setSelected(aItem, selected); |
431 | mIconView->ensureItemVisible( aItem ); | 439 | mIconView->ensureItemVisible( aItem ); |
432 | found = true; | 440 | found = true; |
433 | } | 441 | } |
434 | } | 442 | } |
435 | } | 443 | } |
436 | } | 444 | } |
437 | 445 | ||
438 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) | 446 | void KAddressBookIconView::addresseeExecuted(Q3IconViewItem *item) |
439 | { | 447 | { |
440 | #ifndef KAB_EMBEDDED | 448 | #ifndef KAB_EMBEDDED |
441 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 449 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
442 | #else //KAB_EMBEDDED | 450 | #else //KAB_EMBEDDED |
443 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); | 451 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); |
444 | #endif //KAB_EMBEDDED | 452 | #endif //KAB_EMBEDDED |
445 | 453 | ||
446 | if (aItem) { | 454 | if (aItem) { |
447 | emit executed(aItem->addressee().uid()); | 455 | emit executed(aItem->addressee().uid()); |
448 | } | 456 | } |
449 | } | 457 | } |
450 | 458 | ||
451 | void KAddressBookIconView::addresseeSelected() | 459 | void KAddressBookIconView::addresseeSelected() |
452 | { | 460 | { |
453 | QIconViewItem *item; | 461 | Q3IconViewItem *item; |
454 | AddresseeIconViewItem *aItem; | 462 | AddresseeIconViewItem *aItem; |
455 | 463 | ||
456 | bool found = false; | 464 | bool found = false; |
457 | for (item = mIconView->firstItem(); item && !found; | 465 | for (item = mIconView->firstItem(); item && !found; |
458 | item = item->nextItem()) | 466 | item = item->nextItem()) |
459 | { | 467 | { |
460 | if (item->isSelected()) | 468 | if (item->isSelected()) |
461 | { | 469 | { |
462 | #ifndef KAB_EMBEDDED | 470 | #ifndef KAB_EMBEDDED |
463 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 471 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
464 | #else //KAB_EMBEDDED | 472 | #else //KAB_EMBEDDED |
465 | aItem = (AddresseeIconViewItem*)(item); | 473 | aItem = (AddresseeIconViewItem*)(item); |
@@ -467,15 +475,15 @@ void KAddressBookIconView::addresseeSelected() | |||
467 | if (aItem) | 475 | if (aItem) |
468 | { | 476 | { |
469 | emit selected(aItem->addressee().uid()); | 477 | emit selected(aItem->addressee().uid()); |
470 | found = true; | 478 | found = true; |
471 | } | 479 | } |
472 | } | 480 | } |
473 | } | 481 | } |
474 | 482 | ||
475 | if (!found) | 483 | if (!found) |
476 | emit selected(QString::null); | 484 | emit selected(QString::null); |
477 | } | 485 | } |
478 | 486 | ||
479 | #ifndef KAB_EMBEDDED | 487 | #ifndef KAB_EMBEDDED_ |
480 | #include "kaddressbookiconview.moc" | 488 | #include "moc_kaddressbookiconview.cpp" |
481 | #endif //KAB_EMBEDDED | 489 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index b0b9fea..6fad4c6 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h | |||
@@ -16,38 +16,41 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KADDRESSBOOKICONVIEW_H | 24 | #ifndef KADDRESSBOOKICONVIEW_H |
25 | #define KADDRESSBOOKICONVIEW_H | 25 | #define KADDRESSBOOKICONVIEW_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3ValueList> | ||
30 | #include <QDropEvent> | ||
28 | #ifndef KAB_EMBEDDED | 31 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 32 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <qiconview.h> | 34 | #include <q3iconview.h> |
32 | #include <qptrlist.h> | 35 | #include <q3ptrlist.h> |
33 | #include <klocale.h> | 36 | #include <klocale.h> |
34 | #endif //KAB_EMBEDDED | 37 | #endif //KAB_EMBEDDED |
35 | #include "kaddressbookview.h" | 38 | #include "kaddressbookview.h" |
36 | 39 | ||
37 | class QIconViewItem; | 40 | class Q3IconViewItem; |
38 | class KConfig; | 41 | class KConfig; |
39 | class AddresseeIconView; | 42 | class AddresseeIconView; |
40 | class AddresseeIconViewItem; | 43 | class AddresseeIconViewItem; |
41 | class QIconDragItem; | 44 | class Q3IconDragItem; |
42 | class KAddressBookIconView; | 45 | class KAddressBookIconView; |
43 | 46 | ||
44 | namespace KABC { class AddressBook; } | 47 | namespace KABC { class AddressBook; } |
45 | 48 | ||
46 | /** This is an example kaddressbook view that is implemented using | 49 | /** This is an example kaddressbook view that is implemented using |
47 | * KIconView. This view is not the most useful view, but it displays | 50 | * KIconView. This view is not the most useful view, but it displays |
48 | * how simple implementing a new view can be. | 51 | * how simple implementing a new view can be. |
49 | */ | 52 | */ |
50 | class KAddressBookIconView : public KAddressBookView | 53 | class KAddressBookIconView : public KAddressBookView |
51 | { | 54 | { |
52 | Q_OBJECT | 55 | Q_OBJECT |
53 | 56 | ||
@@ -59,65 +62,65 @@ class KAddressBookIconView : public KAddressBookView | |||
59 | virtual QStringList selectedUids(); | 62 | virtual QStringList selectedUids(); |
60 | virtual QString type() const { return "Icon"; } | 63 | virtual QString type() const { return "Icon"; } |
61 | void doSearch( const QString& s ,KABC::Field *field ); | 64 | void doSearch( const QString& s ,KABC::Field *field ); |
62 | 65 | ||
63 | virtual void readConfig(KConfig *config); | 66 | virtual void readConfig(KConfig *config); |
64 | virtual void scrollUP(); | 67 | virtual void scrollUP(); |
65 | virtual void scrollDOWN(); | 68 | virtual void scrollDOWN(); |
66 | virtual void setFocusAV(); | 69 | virtual void setFocusAV(); |
67 | 70 | ||
68 | public slots: | 71 | public slots: |
69 | void refresh(QString uid = QString::null); | 72 | void refresh(QString uid = QString::null); |
70 | #ifndef KAB_EMBEDDED | 73 | #ifndef KAB_EMBEDDED |
71 | //MOC_SKIP_BEGIN | 74 | #ifndef Q_MOC_RUN |
72 | void setSelected(QString uid = QString::null, bool selected = true); | 75 | void setSelected(QString uid = QString::null, bool selected = true); |
73 | //MOC_SKIP_END | 76 | #endif |
74 | #else //KAB_EMBEDDED | 77 | #else //KAB_EMBEDDED |
75 | //US my MOC do not like default parameters ??? | 78 | //US my MOC do not like default parameters ??? |
76 | void setSelected(QString uid, bool selected); | 79 | void setSelected(QString uid, bool selected); |
77 | #endif //KAB_EMBEDDED | 80 | #endif //KAB_EMBEDDED |
78 | 81 | ||
79 | protected slots: | 82 | protected slots: |
80 | void addresseeExecuted(QIconViewItem *item); | 83 | void addresseeExecuted(Q3IconViewItem *item); |
81 | void addresseeSelected(); | 84 | void addresseeSelected(); |
82 | 85 | ||
83 | private: | 86 | private: |
84 | AddresseeIconView *mIconView; | 87 | AddresseeIconView *mIconView; |
85 | QPtrList<AddresseeIconViewItem> mIconList; | 88 | Q3PtrList<AddresseeIconViewItem> mIconList; |
86 | }; | 89 | }; |
87 | 90 | ||
88 | 91 | ||
89 | #ifndef KAB_EMBEDDED | 92 | #ifndef KAB_EMBEDDED |
90 | //MOC_SKIP_BEGIN | 93 | #ifndef Q_MOC_RUN |
91 | class AddresseeIconView : public KIconView | 94 | class AddresseeIconView : public KIconView |
92 | //MOC_SKIP_END | 95 | #endif |
93 | #else //KAB_EMBEDDED | 96 | #else //KAB_EMBEDDED |
94 | class AddresseeIconView : public QIconView | 97 | class AddresseeIconView : public Q3IconView |
95 | #endif //KAB_EMBEDDED | 98 | #endif //KAB_EMBEDDED |
96 | { | 99 | { |
97 | Q_OBJECT | 100 | Q_OBJECT |
98 | 101 | ||
99 | public: | 102 | public: |
100 | AddresseeIconView(QWidget *parent, const char *name); | 103 | AddresseeIconView(QWidget *parent, const char *name); |
101 | ~AddresseeIconView(); | 104 | ~AddresseeIconView(); |
102 | 105 | ||
103 | signals: | 106 | signals: |
104 | void addresseeDropped(QDropEvent *); | 107 | void addresseeDropped(QDropEvent *); |
105 | void startAddresseeDrag(); | 108 | void startAddresseeDrag(); |
106 | 109 | ||
107 | protected: | 110 | protected: |
108 | virtual QDragObject *dragObject(); | 111 | virtual Q3DragObject *dragObject(); |
109 | 112 | ||
110 | protected slots: | 113 | protected slots: |
111 | void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &); | 114 | void itemDropped(QDropEvent *, const Q3ValueList<Q3IconDragItem> &); |
112 | }; | 115 | }; |
113 | 116 | ||
114 | class IconViewFactory : public ViewFactory | 117 | class IconViewFactory : public ViewFactory |
115 | { | 118 | { |
116 | public: | 119 | public: |
117 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 120 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
118 | { | 121 | { |
119 | return new KAddressBookIconView( ab, parent, name ); | 122 | return new KAddressBookIconView( ab, parent, name ); |
120 | } | 123 | } |
121 | 124 | ||
122 | QString type() const { return "Icon"; } | 125 | QString type() const { return "Icon"; } |
123 | 126 | ||
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 272f2eb..7efaaa9 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -1,57 +1,61 @@ | |||
1 | // $Id$ | 1 | // $Id$ |
2 | 2 | ||
3 | #include <qvbox.h> | 3 | #include <q3vbox.h> |
4 | #include <qlistbox.h> | 4 | #include <q3listbox.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | #include <qimage.h> | 7 | #include <qimage.h> |
8 | #include <qcombobox.h> | 8 | #include <qcombobox.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qdragobject.h> | 10 | #include <q3dragobject.h> |
11 | #include <qevent.h> | 11 | #include <qevent.h> |
12 | #include <qurl.h> | 12 | #include <q3url.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | //Added by qt3to4: | ||
15 | #include <QDropEvent> | ||
16 | #include <QKeyEvent> | ||
17 | #include <Q3VBoxLayout> | ||
14 | 18 | ||
15 | #include <kabc/addressbook.h> | 19 | #include <kabc/addressbook.h> |
16 | #include <kapplication.h> | 20 | #include <kapplication.h> |
17 | #include <kconfig.h> | 21 | #include <kconfig.h> |
18 | #include <kcolorbutton.h> | 22 | #include <kcolorbutton.h> |
19 | #include <kdebug.h> | 23 | #include <kdebug.h> |
20 | #include <kglobal.h> | 24 | #include <kglobal.h> |
21 | #include <kiconloader.h> | 25 | #include <kiconloader.h> |
22 | #include <klineedit.h> | 26 | #include <klineedit.h> |
23 | #include <klocale.h> | 27 | #include <klocale.h> |
24 | #include <kmessagebox.h> | 28 | #include <kmessagebox.h> |
25 | #include <kurl.h> | 29 | #include <kurl.h> |
26 | #include <kurlrequester.h> | 30 | #include <kurlrequester.h> |
27 | 31 | ||
28 | //US#include "configuretableviewdialog.h" | 32 | //US#include "configuretableviewdialog.h" |
29 | #include "contactlistview.h" | 33 | #include "contactlistview.h" |
30 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
31 | #include "undocmds.h" | 35 | #include "undocmds.h" |
32 | #include "viewmanager.h" | 36 | #include "viewmanager.h" |
33 | 37 | ||
34 | #include <qlayout.h> | 38 | #include <qlayout.h> |
35 | #include <qheader.h> | 39 | #include <q3header.h> |
36 | #include <qregexp.h> | 40 | #include <qregexp.h> |
37 | 41 | ||
38 | #include "kaddressbooktableview.h" | 42 | #include "kaddressbooktableview.h" |
39 | 43 | ||
40 | 44 | ||
41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | 45 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, |
42 | QWidget *parent, const char *name ) | 46 | QWidget *parent, const char *name ) |
43 | : KAddressBookView( ab, parent, name ) | 47 | : KAddressBookView( ab, parent, name ) |
44 | { | 48 | { |
45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); | 49 | mainLayout = new Q3VBoxLayout( viewWidget(), 2 ); |
46 | 50 | ||
47 | // The list view will be created when the config is read. | 51 | // The list view will be created when the config is read. |
48 | mListView = 0; | 52 | mListView = 0; |
49 | } | 53 | } |
50 | 54 | ||
51 | KAddressBookTableView::~KAddressBookTableView() | 55 | KAddressBookTableView::~KAddressBookTableView() |
52 | { | 56 | { |
53 | } | 57 | } |
54 | void KAddressBookTableView::setFocusAV() | 58 | void KAddressBookTableView::setFocusAV() |
55 | { | 59 | { |
56 | if ( mListView ) | 60 | if ( mListView ) |
57 | mListView->setFocus(); | 61 | mListView->setFocus(); |
@@ -68,75 +72,75 @@ void KAddressBookTableView::scrollDOWN() | |||
68 | { | 72 | { |
69 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 73 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
70 | QApplication::postEvent( mListView, ev ); | 74 | QApplication::postEvent( mListView, ev ); |
71 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); | 75 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); |
72 | QApplication::postEvent( mListView, ev ); | 76 | QApplication::postEvent( mListView, ev ); |
73 | } | 77 | } |
74 | void KAddressBookTableView::reconstructListView() | 78 | void KAddressBookTableView::reconstructListView() |
75 | { | 79 | { |
76 | if (mListView) | 80 | if (mListView) |
77 | { | 81 | { |
78 | disconnect(mListView, SIGNAL(selectionChanged()), | 82 | disconnect(mListView, SIGNAL(selectionChanged()), |
79 | this, SLOT(addresseeSelected())); | 83 | this, SLOT(addresseeSelected())); |
80 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 84 | disconnect(mListView, SIGNAL(executed(Q3ListViewItem*)), |
81 | this, SLOT(addresseeExecuted(QListViewItem*))); | 85 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
82 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 86 | disconnect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)), |
83 | this, SLOT(addresseeExecuted(QListViewItem*))); | 87 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
84 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 88 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
85 | SIGNAL(startDrag())); | 89 | SIGNAL(startDrag())); |
86 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 90 | disconnect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)), |
87 | this, SLOT(addresseeExecuted(QListViewItem*))); | 91 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
88 | 92 | ||
89 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 93 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
90 | SIGNAL(dropped(QDropEvent*))); | 94 | SIGNAL(dropped(QDropEvent*))); |
91 | delete mListView; | 95 | delete mListView; |
92 | } | 96 | } |
93 | 97 | ||
94 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 98 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
95 | 99 | ||
96 | connect(this, SIGNAL(printView()), | 100 | connect(this, SIGNAL(printView()), |
97 | mListView , SLOT(printMe())); | 101 | mListView , SLOT(printMe())); |
98 | //US set singleClick manually, because it is no global configparameter in embedded space | 102 | //US set singleClick manually, because it is no global configparameter in embedded space |
99 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); | 103 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); |
100 | 104 | ||
101 | // Add the columns | 105 | // Add the columns |
102 | KABC::Field::List fieldList = fields(); | 106 | KABC::Field::List fieldList = fields(); |
103 | KABC::Field::List::ConstIterator it; | 107 | KABC::Field::List::ConstIterator it; |
104 | 108 | ||
105 | int c = 0; | 109 | int c = 0; |
106 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 110 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
107 | mListView->addColumn( (*it)->label() ); | 111 | mListView->addColumn( (*it)->label() ); |
108 | mListView->setColumnWidthMode(c++, QListView::Manual); | 112 | mListView->setColumnWidthMode(c++, Q3ListView::Manual); |
109 | //US | 113 | //US |
110 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 114 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
111 | } | 115 | } |
112 | 116 | ||
113 | connect(mListView, SIGNAL(selectionChanged()), | 117 | connect(mListView, SIGNAL(selectionChanged()), |
114 | this, SLOT(addresseeSelected())); | 118 | this, SLOT(addresseeSelected())); |
115 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 119 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
116 | SIGNAL(startDrag())); | 120 | SIGNAL(startDrag())); |
117 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 121 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
118 | SIGNAL(dropped(QDropEvent*))); | 122 | SIGNAL(dropped(QDropEvent*))); |
119 | 123 | ||
120 | if (KABPrefs::instance()->mHonorSingleClick) { | 124 | if (KABPrefs::instance()->mHonorSingleClick) { |
121 | // qDebug("KAddressBookTableView::reconstructListView single"); | 125 | // qDebug("KAddressBookTableView::reconstructListView single"); |
122 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 126 | connect(mListView, SIGNAL(executed(Q3ListViewItem*)), |
123 | this, SLOT(addresseeExecuted(QListViewItem*))); | 127 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
124 | } else { | 128 | } else { |
125 | // qDebug("KAddressBookTableView::reconstructListView double"); | 129 | // qDebug("KAddressBookTableView::reconstructListView double"); |
126 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 130 | connect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)), |
127 | this, SLOT(addresseeExecuted(QListViewItem*))); | 131 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
128 | } | 132 | } |
129 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 133 | connect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)), |
130 | this, SLOT(addresseeExecuted(QListViewItem*))); | 134 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
131 | connect(mListView, SIGNAL(signalDelete()), | 135 | connect(mListView, SIGNAL(signalDelete()), |
132 | this, SLOT(addresseeDeleted())); | 136 | this, SLOT(addresseeDeleted())); |
133 | 137 | ||
134 | //US performceimprovement. Refresh is done from the outside | 138 | //US performceimprovement. Refresh is done from the outside |
135 | //US refresh(); | 139 | //US refresh(); |
136 | 140 | ||
137 | mListView->setSorting( 0, true ); | 141 | mListView->setSorting( 0, true ); |
138 | mainLayout->addWidget( mListView ); | 142 | mainLayout->addWidget( mListView ); |
139 | mainLayout->activate(); | 143 | mainLayout->activate(); |
140 | mListView->show(); | 144 | mListView->show(); |
141 | } | 145 | } |
142 | 146 | ||
@@ -335,47 +339,47 @@ void KAddressBookTableView::refresh(QString uid) | |||
335 | // of items. | 339 | // of items. |
336 | mListView->repaint(); | 340 | mListView->repaint(); |
337 | if ( !currentItem ) | 341 | if ( !currentItem ) |
338 | currentItem = (ContactListViewItem *)mListView->firstChild(); | 342 | currentItem = (ContactListViewItem *)mListView->firstChild(); |
339 | if ( currentItem ) { | 343 | if ( currentItem ) { |
340 | mListView->setCurrentItem( currentItem ); | 344 | mListView->setCurrentItem( currentItem ); |
341 | mListView->ensureItemVisible( currentItem ); | 345 | mListView->ensureItemVisible( currentItem ); |
342 | mListView->setSelected( currentItem, true ); | 346 | mListView->setSelected( currentItem, true ); |
343 | } | 347 | } |
344 | } else { | 348 | } else { |
345 | // Only need to update on entry. Iterate through and try to find it | 349 | // Only need to update on entry. Iterate through and try to find it |
346 | ContactListViewItem *ceItem; | 350 | ContactListViewItem *ceItem; |
347 | QListViewItemIterator it( mListView ); | 351 | Q3ListViewItemIterator it( mListView ); |
348 | while ( it.current() ) { | 352 | while ( it.current() ) { |
349 | #ifndef KAB_EMBEDDED | 353 | #ifndef KAB_EMBEDDED |
350 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 354 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
351 | #else //KAB_EMBEDDED | 355 | #else //KAB_EMBEDDED |
352 | ceItem = (ContactListViewItem*)( it.current() ); | 356 | ceItem = (ContactListViewItem*)( it.current() ); |
353 | #endif //KAB_EMBEDDED | 357 | #endif //KAB_EMBEDDED |
354 | 358 | ||
355 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 359 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
356 | ceItem->refresh(); | 360 | ceItem->refresh(); |
357 | return; | 361 | return; |
358 | } | 362 | } |
359 | ++it; | 363 | ++it; |
360 | } | 364 | } |
361 | 365 | ||
362 | refresh( QString::null ); | 366 | refresh( QString::null ); |
363 | } | 367 | } |
364 | } | 368 | } |
365 | 369 | ||
366 | QStringList KAddressBookTableView::selectedUids() | 370 | QStringList KAddressBookTableView::selectedUids() |
367 | { | 371 | { |
368 | QStringList uidList; | 372 | QStringList uidList; |
369 | QListViewItem *item; | 373 | Q3ListViewItem *item; |
370 | ContactListViewItem *ceItem; | 374 | ContactListViewItem *ceItem; |
371 | 375 | ||
372 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 376 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
373 | { | 377 | { |
374 | if (mListView->isSelected( item )) | 378 | if (mListView->isSelected( item )) |
375 | { | 379 | { |
376 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
377 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 381 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
378 | #else //KAB_EMBEDDED | 382 | #else //KAB_EMBEDDED |
379 | ceItem = (ContactListViewItem*)(item); | 383 | ceItem = (ContactListViewItem*)(item); |
380 | #endif //KAB_EMBEDDED | 384 | #endif //KAB_EMBEDDED |
381 | 385 | ||
@@ -385,25 +389,25 @@ QStringList KAddressBookTableView::selectedUids() | |||
385 | } | 389 | } |
386 | if ( uidList.count() == 0 ) | 390 | if ( uidList.count() == 0 ) |
387 | if ( mListView->currentItem() ) { | 391 | if ( mListView->currentItem() ) { |
388 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; | 392 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; |
389 | uidList << ceItem->addressee().uid(); | 393 | uidList << ceItem->addressee().uid(); |
390 | } | 394 | } |
391 | 395 | ||
392 | return uidList; | 396 | return uidList; |
393 | } | 397 | } |
394 | 398 | ||
395 | void KAddressBookTableView::setSelected(QString uid, bool selected) | 399 | void KAddressBookTableView::setSelected(QString uid, bool selected) |
396 | { | 400 | { |
397 | QListViewItem *item; | 401 | Q3ListViewItem *item; |
398 | ContactListViewItem *ceItem; | 402 | ContactListViewItem *ceItem; |
399 | 403 | ||
400 | if (uid.isNull()) | 404 | if (uid.isNull()) |
401 | { | 405 | { |
402 | mListView->selectAll(selected); | 406 | mListView->selectAll(selected); |
403 | } | 407 | } |
404 | else | 408 | else |
405 | { | 409 | { |
406 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 410 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
407 | { | 411 | { |
408 | #ifndef KAB_EMBEDDED | 412 | #ifndef KAB_EMBEDDED |
409 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 413 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
@@ -420,49 +424,49 @@ void KAddressBookTableView::setSelected(QString uid, bool selected) | |||
420 | mListView->ensureItemVisible(item); | 424 | mListView->ensureItemVisible(item); |
421 | } | 425 | } |
422 | } | 426 | } |
423 | } | 427 | } |
424 | } | 428 | } |
425 | 429 | ||
426 | void KAddressBookTableView::addresseeSelected() | 430 | void KAddressBookTableView::addresseeSelected() |
427 | { | 431 | { |
428 | // We need to try to find the first selected item. This might not be the | 432 | // We need to try to find the first selected item. This might not be the |
429 | // last selected item, but when QListView is in multiselection mode, | 433 | // last selected item, but when QListView is in multiselection mode, |
430 | // there is no way to figure out which one was | 434 | // there is no way to figure out which one was |
431 | // selected last. | 435 | // selected last. |
432 | QListViewItem *item; | 436 | Q3ListViewItem *item; |
433 | bool found =false; | 437 | bool found =false; |
434 | for (item = mListView->firstChild(); item && !found; | 438 | for (item = mListView->firstChild(); item && !found; |
435 | item = item->nextSibling()) | 439 | item = item->nextSibling()) |
436 | { | 440 | { |
437 | if (item->isSelected()) | 441 | if (item->isSelected()) |
438 | { | 442 | { |
439 | found = true; | 443 | found = true; |
440 | #ifndef KAB_EMBEDDED | 444 | #ifndef KAB_EMBEDDED |
441 | ContactListViewItem *ceItem | 445 | ContactListViewItem *ceItem |
442 | = dynamic_cast<ContactListViewItem*>(item); | 446 | = dynamic_cast<ContactListViewItem*>(item); |
443 | #else //KAB_EMBEDDED | 447 | #else //KAB_EMBEDDED |
444 | ContactListViewItem *ceItem | 448 | ContactListViewItem *ceItem |
445 | = (ContactListViewItem*)(item); | 449 | = (ContactListViewItem*)(item); |
446 | #endif //KAB_EMBEDDED | 450 | #endif //KAB_EMBEDDED |
447 | 451 | ||
448 | if ( ceItem ) emit selected(ceItem->addressee().uid()); | 452 | if ( ceItem ) emit selected(ceItem->addressee().uid()); |
449 | } | 453 | } |
450 | } | 454 | } |
451 | 455 | ||
452 | if (!found) | 456 | if (!found) |
453 | emit selected(QString::null); | 457 | emit selected(QString::null); |
454 | } | 458 | } |
455 | 459 | ||
456 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | 460 | void KAddressBookTableView::addresseeExecuted(Q3ListViewItem *item) |
457 | { | 461 | { |
458 | if (item) | 462 | if (item) |
459 | { | 463 | { |
460 | #ifndef KAB_EMBEDDED | 464 | #ifndef KAB_EMBEDDED |
461 | ContactListViewItem *ceItem | 465 | ContactListViewItem *ceItem |
462 | = dynamic_cast<ContactListViewItem*>(item); | 466 | = dynamic_cast<ContactListViewItem*>(item); |
463 | #else //KAB_EMBEDDED | 467 | #else //KAB_EMBEDDED |
464 | ContactListViewItem *ceItem | 468 | ContactListViewItem *ceItem |
465 | = (ContactListViewItem*)(item); | 469 | = (ContactListViewItem*)(item); |
466 | #endif //KAB_EMBEDDED | 470 | #endif //KAB_EMBEDDED |
467 | 471 | ||
468 | if (ceItem) | 472 | if (ceItem) |
@@ -478,15 +482,15 @@ void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | |||
478 | 482 | ||
479 | void KAddressBookTableView::addresseeDeleted() | 483 | void KAddressBookTableView::addresseeDeleted() |
480 | { | 484 | { |
481 | 485 | ||
482 | emit deleteRequest(); | 486 | emit deleteRequest(); |
483 | 487 | ||
484 | } | 488 | } |
485 | 489 | ||
486 | 490 | ||
487 | 491 | ||
488 | 492 | ||
489 | 493 | ||
490 | #ifndef KAB_EMBEDDED | 494 | #ifndef KAB_EMBEDDED_ |
491 | #include "kaddressbooktableview.moc" | 495 | #include "moc_kaddressbooktableview.cpp" |
492 | #endif //KAB_EMBEDDED | 496 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index 38db7b4..c3cb038 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h | |||
@@ -1,43 +1,45 @@ | |||
1 | #ifndef KADDRESSBOOKTABLEVIEW_H | 1 | #ifndef KADDRESSBOOKTABLEVIEW_H |
2 | #define KADDRESSBOOKTABLEVIEW_H | 2 | #define KADDRESSBOOKTABLEVIEW_H |
3 | 3 | ||
4 | 4 | ||
5 | #ifndef KAB_EMBEDDED | 5 | #ifndef KAB_EMBEDDED |
6 | 6 | ||
7 | 7 | ||
8 | #ifdef HAVE_CONFIG_H | 8 | #ifdef HAVE_CONFIG_H |
9 | #include <config.h> | 9 | #include <config.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <qwidget.h> | 12 | #include <qwidget.h> |
13 | #include <qlistview.h> | 13 | #include <q3listview.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qdialog.h> | 15 | #include <qdialog.h> |
16 | #include <qtabdialog.h> | 16 | #include <q3tabdialog.h> |
17 | #include <qstringlist.h> | 17 | #include <qstringlist.h> |
18 | #include <qvaluelist.h> | 18 | #include <q3valuelist.h> |
19 | 19 | ||
20 | #include "undo.h" | 20 | #include "undo.h" |
21 | 21 | ||
22 | #else //KAB_EMBEDDED | 22 | #else //KAB_EMBEDDED |
23 | #include "views/configuretableviewdialog.h" | 23 | #include "views/configuretableviewdialog.h" |
24 | #endif //KAB_EMBEDDED | 24 | #endif //KAB_EMBEDDED |
25 | 25 | ||
26 | #include "klocale.h" | 26 | #include "klocale.h" |
27 | #include "kaddressbookview.h" | 27 | #include "kaddressbookview.h" |
28 | //Added by qt3to4: | ||
29 | #include <Q3VBoxLayout> | ||
28 | 30 | ||
29 | class QListViewItem; | 31 | class Q3ListViewItem; |
30 | class QListBox; | 32 | class Q3ListBox; |
31 | class QVBoxLayout; | 33 | class Q3VBoxLayout; |
32 | class KConfig; | 34 | class KConfig; |
33 | 35 | ||
34 | class ContactListViewItem; | 36 | class ContactListViewItem; |
35 | class ContactListView; | 37 | class ContactListView; |
36 | 38 | ||
37 | 39 | ||
38 | namespace KABC { class AddressBook; } | 40 | namespace KABC { class AddressBook; } |
39 | 41 | ||
40 | /** | 42 | /** |
41 | * This class is the table view for kaddressbook. This view is a KListView | 43 | * This class is the table view for kaddressbook. This view is a KListView |
42 | * with multiple columns for the selected fields. | 44 | * with multiple columns for the selected fields. |
43 | * | 45 | * |
@@ -70,28 +72,28 @@ friend class ContactListView; | |||
70 | public slots: | 72 | public slots: |
71 | virtual void reconstructListView(); | 73 | virtual void reconstructListView(); |
72 | 74 | ||
73 | protected slots: | 75 | protected slots: |
74 | /** Called whenever the user selects an addressee in the list view. | 76 | /** Called whenever the user selects an addressee in the list view. |
75 | */ | 77 | */ |
76 | void addresseeSelected(); | 78 | void addresseeSelected(); |
77 | void addresseeDeleted(); | 79 | void addresseeDeleted(); |
78 | 80 | ||
79 | /** Called whenever the user executes an addressee. In terms of the | 81 | /** Called whenever the user executes an addressee. In terms of the |
80 | * list view, this is probably a double click | 82 | * list view, this is probably a double click |
81 | */ | 83 | */ |
82 | void addresseeExecuted(QListViewItem*); | 84 | void addresseeExecuted(Q3ListViewItem*); |
83 | 85 | ||
84 | private: | 86 | private: |
85 | QVBoxLayout *mainLayout; | 87 | Q3VBoxLayout *mainLayout; |
86 | ContactListView *mListView; | 88 | ContactListView *mListView; |
87 | }; | 89 | }; |
88 | 90 | ||
89 | 91 | ||
90 | class TableViewFactory : public ViewFactory | 92 | class TableViewFactory : public ViewFactory |
91 | { | 93 | { |
92 | public: | 94 | public: |
93 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 95 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
94 | { | 96 | { |
95 | return new KAddressBookTableView( ab, parent, name ); | 97 | return new KAddressBookTableView( ab, parent, name ); |
96 | } | 98 | } |
97 | 99 | ||
diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index 7281003..ed5807f 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp | |||
@@ -21,25 +21,25 @@ | |||
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qtextstream.h> | 33 | #include <q3textstream.h> |
34 | #include <qtextcodec.h> | 34 | #include <qtextcodec.h> |
35 | 35 | ||
36 | #include <kfiledialog.h> | 36 | #include <kfiledialog.h> |
37 | #ifndef KAB_EMBEDDED | 37 | #ifndef KAB_EMBEDDED |
38 | #include <kio/netaccess.h> | 38 | #include <kio/netaccess.h> |
39 | #endif //KAB_EMBEDDED | 39 | #endif //KAB_EMBEDDED |
40 | 40 | ||
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <ktempfile.h> | 43 | #include <ktempfile.h> |
44 | #include <kurl.h> | 44 | #include <kurl.h> |
45 | 45 | ||
@@ -95,45 +95,45 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& | |||
95 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); | 95 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); |
96 | KMessageBox::error( parentWidget(), txt.arg( url.url() ) | 96 | KMessageBox::error( parentWidget(), txt.arg( url.url() ) |
97 | .arg( strerror( tmpFile.status() ) ) ); | 97 | .arg( strerror( tmpFile.status() ) ) ); |
98 | return false; | 98 | return false; |
99 | } | 99 | } |
100 | 100 | ||
101 | doExport( tmpFile.file(), list ); | 101 | doExport( tmpFile.file(), list ); |
102 | tmpFile.close(); | 102 | tmpFile.close(); |
103 | 103 | ||
104 | return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); | 104 | return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); |
105 | } else { | 105 | } else { |
106 | QFile file( url.path() ); | 106 | QFile file( url.path() ); |
107 | if ( !file.open( IO_WriteOnly ) ) { | 107 | if ( !file.open( QIODevice::WriteOnly ) ) { |
108 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); | 108 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); |
109 | KMessageBox::error( parentWidget(), txt.arg( url.path() ) ); | 109 | KMessageBox::error( parentWidget(), txt.arg( url.path() ) ); |
110 | return false; | 110 | return false; |
111 | } | 111 | } |
112 | 112 | ||
113 | doExport( &file, list ); | 113 | doExport( &file, list ); |
114 | file.close(); | 114 | file.close(); |
115 | 115 | ||
116 | return true; | 116 | return true; |
117 | } | 117 | } |
118 | 118 | ||
119 | #else //KAB_EMBEDDED | 119 | #else //KAB_EMBEDDED |
120 | 120 | ||
121 | QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() ); | 121 | QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() ); |
122 | 122 | ||
123 | if ( fileName.isEmpty() ) | 123 | if ( fileName.isEmpty() ) |
124 | return false; | 124 | return false; |
125 | 125 | ||
126 | QFile file( fileName ); | 126 | QFile file( fileName ); |
127 | if ( !file.open( IO_WriteOnly ) ) { | 127 | if ( !file.open( QIODevice::WriteOnly ) ) { |
128 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); | 128 | QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); |
129 | KMessageBox::error( parentWidget(), txt.arg( fileName ) ); | 129 | KMessageBox::error( parentWidget(), txt.arg( fileName ) ); |
130 | return false; | 130 | return false; |
131 | } | 131 | } |
132 | 132 | ||
133 | doExport( &file, list ); | 133 | doExport( &file, list ); |
134 | file.close(); | 134 | file.close(); |
135 | 135 | ||
136 | return true; | 136 | return true; |
137 | 137 | ||
138 | 138 | ||
139 | #endif //KAB_EMBEDDED | 139 | #endif //KAB_EMBEDDED |
@@ -142,25 +142,25 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& | |||
142 | 142 | ||
143 | KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const | 143 | KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const |
144 | { | 144 | { |
145 | CSVImportDialog dlg( addressBook(), parentWidget() ); | 145 | CSVImportDialog dlg( addressBook(), parentWidget() ); |
146 | if ( dlg.exec() ) | 146 | if ( dlg.exec() ) |
147 | return dlg.contacts(); | 147 | return dlg.contacts(); |
148 | else | 148 | else |
149 | return KABC::AddresseeList(); | 149 | return KABC::AddresseeList(); |
150 | } | 150 | } |
151 | 151 | ||
152 | void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) | 152 | void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) |
153 | { | 153 | { |
154 | QTextStream t( fp ); | 154 | Q3TextStream t( fp ); |
155 | t.setCodec( QTextCodec::codecForName("utf8") ); | 155 | t.setCodec( QTextCodec::codecForName("utf8") ); |
156 | 156 | ||
157 | KABC::AddresseeList::ConstIterator iter; | 157 | KABC::AddresseeList::ConstIterator iter; |
158 | KABC::Field::List fields = addressBook()->fields(); | 158 | KABC::Field::List fields = addressBook()->fields(); |
159 | KABC::Field::List::Iterator fieldIter; | 159 | KABC::Field::List::Iterator fieldIter; |
160 | bool first = true; | 160 | bool first = true; |
161 | 161 | ||
162 | // First output the column headings | 162 | // First output the column headings |
163 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { | 163 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { |
164 | if ( !first ) | 164 | if ( !first ) |
165 | t << ","; | 165 | t << ","; |
166 | 166 | ||
@@ -178,17 +178,15 @@ void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) | |||
178 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { | 178 | for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) { |
179 | if ( !first ) | 179 | if ( !first ) |
180 | t << ","; | 180 | t << ","; |
181 | 181 | ||
182 | t << "\"" << (*fieldIter)->value( addr ) << "\""; | 182 | t << "\"" << (*fieldIter)->value( addr ) << "\""; |
183 | first = false; | 183 | first = false; |
184 | } | 184 | } |
185 | 185 | ||
186 | t << "\n"; | 186 | t << "\n"; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | #ifndef KAB_EMBEDDED | 190 | #ifndef KAB_EMBEDDED_ |
191 | #include "csv_xxport.moc" | 191 | #include "moc_csv_xxport.cpp" |
192 | #endif //KAB_EMBEDDED | 192 | #endif //KAB_EMBEDDED |
193 | |||
194 | |||
diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp index 862241e..7959cac 100644 --- a/kaddressbook/xxport/csvimportdialog.cpp +++ b/kaddressbook/xxport/csvimportdialog.cpp | |||
@@ -18,54 +18,58 @@ | |||
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include <qbuttongroup.h> | 30 | #include <q3buttongroup.h> |
31 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #ifdef DESKTOP_VERSION | 33 | #ifdef DESKTOP_VERSION |
34 | #include <qinputdialog.h> | 34 | #include <qinputdialog.h> |
35 | #else | 35 | #else |
36 | #include <qtcompat/qinputdialog.h> | 36 | #include <qtcompat/qinputdialog.h> |
37 | #endif | 37 | #endif |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qtable.h> | 42 | #include <q3table.h> |
43 | #include <qlayout.h> | 43 | #include <qlayout.h> |
44 | #include <qtextstream.h> | 44 | #include <q3textstream.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | //Added by qt3to4: | ||
47 | #include <Q3HBoxLayout> | ||
48 | #include <Q3ValueList> | ||
49 | #include <Q3GridLayout> | ||
46 | 50 | ||
47 | #include <kapplication.h> | 51 | #include <kapplication.h> |
48 | #include <kdebug.h> | 52 | #include <kdebug.h> |
49 | #include <kdialogbase.h> | 53 | #include <kdialogbase.h> |
50 | #include <kfiledialog.h> | 54 | #include <kfiledialog.h> |
51 | #include <klineedit.h> | 55 | #include <klineedit.h> |
52 | #include <klocale.h> | 56 | #include <klocale.h> |
53 | #include <kglobal.h> | 57 | #include <kglobal.h> |
54 | #include <kmessagebox.h> | 58 | #include <kmessagebox.h> |
55 | #include <kstandarddirs.h> | 59 | #include <kstandarddirs.h> |
56 | #include <kurlrequester.h> | 60 | #include <kurlrequester.h> |
57 | 61 | ||
58 | #ifdef DESKTOP_VERSION | 62 | #ifdef DESKTOP_VERSION |
59 | #include "qtable.h" | 63 | #include "q3table.h" |
60 | #else | 64 | #else |
61 | #include "qcombotableitem.h" | 65 | #include "qcombotableitem.h" |
62 | #endif | 66 | #endif |
63 | #include "csvimportdialog.h" | 67 | #include "csvimportdialog.h" |
64 | 68 | ||
65 | CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, | 69 | CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, |
66 | const char * name ) | 70 | const char * name ) |
67 | : KDialogBase( Plain, i18n ( "CSV Import Dialog" ), Ok | Cancel | User1 | | 71 | : KDialogBase( Plain, i18n ( "CSV Import Dialog" ), Ok | Cancel | User1 | |
68 | User2, Ok, parent, name, true, true ), | 72 | User2, Ok, parent, name, true, true ), |
69 | mAdjustRows( false ), | 73 | mAdjustRows( false ), |
70 | mStartLine( 0 ), | 74 | mStartLine( 0 ), |
71 | mTextQuote( '"' ), | 75 | mTextQuote( '"' ), |
@@ -152,50 +156,50 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, | |||
152 | connect( mUrlRequester, SIGNAL( urlSelected( const QString& ) ), | 156 | connect( mUrlRequester, SIGNAL( urlSelected( const QString& ) ), |
153 | this, SLOT( setFile( const QString& ) ) ); | 157 | this, SLOT( setFile( const QString& ) ) ); |
154 | connect( mUrlRequester->lineEdit(), SIGNAL( textChanged ( const QString& ) ), | 158 | connect( mUrlRequester->lineEdit(), SIGNAL( textChanged ( const QString& ) ), |
155 | this, SLOT( urlChanged( const QString& ) ) ); | 159 | this, SLOT( urlChanged( const QString& ) ) ); |
156 | 160 | ||
157 | connect( this, SIGNAL( user1Clicked() ), | 161 | connect( this, SIGNAL( user1Clicked() ), |
158 | this, SLOT( applyTemplate() ) ); | 162 | this, SLOT( applyTemplate() ) ); |
159 | 163 | ||
160 | connect( this, SIGNAL( user2Clicked() ), | 164 | connect( this, SIGNAL( user2Clicked() ), |
161 | this, SLOT( saveTemplate() ) ); | 165 | this, SLOT( saveTemplate() ) ); |
162 | 166 | ||
163 | // if ( QApplication::desktop()->width() < 321 ) | 167 | // if ( QApplication::desktop()->width() < 321 ) |
164 | QIconSet icon = SmallIcon("filesave"); | 168 | QIcon icon = SmallIcon("filesave"); |
165 | 169 | ||
166 | findButton( User2 )->setIconSet (icon ) ; | 170 | findButton( User2 )->setIconSet (icon ) ; |
167 | icon = SmallIcon("fileopen"); | 171 | icon = SmallIcon("fileopen"); |
168 | findButton( User1 )->setIconSet (icon ) ; | 172 | findButton( User1 )->setIconSet (icon ) ; |
169 | int wid = findButton( User2 )->sizeHint().height(); | 173 | int wid = findButton( User2 )->sizeHint().height(); |
170 | findButton( User2 )->setMaximumWidth( wid+4 ); | 174 | findButton( User2 )->setMaximumWidth( wid+4 ); |
171 | findButton( User1 )->setMaximumWidth( wid+4 ); | 175 | findButton( User1 )->setMaximumWidth( wid+4 ); |
172 | } | 176 | } |
173 | 177 | ||
174 | CSVImportDialog::~CSVImportDialog() | 178 | CSVImportDialog::~CSVImportDialog() |
175 | { | 179 | { |
176 | } | 180 | } |
177 | 181 | ||
178 | KABC::AddresseeList CSVImportDialog::contacts() const | 182 | KABC::AddresseeList CSVImportDialog::contacts() const |
179 | { | 183 | { |
180 | KABC::AddresseeList contacts; | 184 | KABC::AddresseeList contacts; |
181 | 185 | ||
182 | for ( int row = 1; row < mTable->numRows(); ++row ) { | 186 | for ( int row = 1; row < mTable->numRows(); ++row ) { |
183 | KABC::Addressee a; | 187 | KABC::Addressee a; |
184 | bool emptyRow = true; | 188 | bool emptyRow = true; |
185 | KABC::Address addrHome( KABC::Address::Home ); | 189 | KABC::Address addrHome( KABC::Address::Home ); |
186 | KABC::Address addrWork( KABC::Address::Work ); | 190 | KABC::Address addrWork( KABC::Address::Work ); |
187 | for ( int col = 0; col < mTable->numCols(); ++col ) { | 191 | for ( int col = 0; col < mTable->numCols(); ++col ) { |
188 | 192 | ||
189 | QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, col ) ); | 193 | Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, col ) ); |
190 | 194 | ||
191 | if ( !item ) { | 195 | if ( !item ) { |
192 | qDebug( "ERROR: item cast failed" ); | 196 | qDebug( "ERROR: item cast failed" ); |
193 | continue; | 197 | continue; |
194 | } | 198 | } |
195 | 199 | ||
196 | QString value = mTable->text( row, col ); | 200 | QString value = mTable->text( row, col ); |
197 | if ( !value.isEmpty() ) | 201 | if ( !value.isEmpty() ) |
198 | emptyRow = false; | 202 | emptyRow = false; |
199 | 203 | ||
200 | switch ( posToType( item->currentItem() ) ) | 204 | switch ( posToType( item->currentItem() ) ) |
201 | { | 205 | { |
@@ -220,25 +224,25 @@ KABC::AddresseeList CSVImportDialog::contacts() const | |||
220 | case Suffix: | 224 | case Suffix: |
221 | a.setSuffix( value ); | 225 | a.setSuffix( value ); |
222 | break; | 226 | break; |
223 | case NickName: | 227 | case NickName: |
224 | a.setNickName( value ); | 228 | a.setNickName( value ); |
225 | break; | 229 | break; |
226 | case Birthday: | 230 | case Birthday: |
227 | //US | 231 | //US |
228 | //the generated code had the following format: a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); | 232 | //the generated code had the following format: a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); |
229 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? | 233 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? |
230 | { | 234 | { |
231 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate | 235 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate |
232 | a.setBirthday(dt); | 236 | a.setBirthday(QDateTime(dt)); |
233 | } | 237 | } |
234 | break; | 238 | break; |
235 | case Email: | 239 | case Email: |
236 | if ( !value.isEmpty() ) | 240 | if ( !value.isEmpty() ) |
237 | a.insertEmail( value, true ); | 241 | a.insertEmail( value, true ); |
238 | break; | 242 | break; |
239 | case Role: | 243 | case Role: |
240 | a.setRole( value ); | 244 | a.setRole( value ); |
241 | break; | 245 | break; |
242 | case Title: | 246 | case Title: |
243 | a.setTitle( value ); | 247 | a.setTitle( value ); |
244 | break; | 248 | break; |
@@ -373,44 +377,44 @@ KABC::AddresseeList CSVImportDialog::contacts() const | |||
373 | 377 | ||
374 | if ( !emptyRow && !a.isEmpty() ) | 378 | if ( !emptyRow && !a.isEmpty() ) |
375 | contacts.append( a ); | 379 | contacts.append( a ); |
376 | } | 380 | } |
377 | 381 | ||
378 | return contacts; | 382 | return contacts; |
379 | } | 383 | } |
380 | 384 | ||
381 | void CSVImportDialog::initGUI() | 385 | void CSVImportDialog::initGUI() |
382 | { | 386 | { |
383 | QWidget* page = plainPage(); | 387 | QWidget* page = plainPage(); |
384 | 388 | ||
385 | QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), | 389 | Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHintSmall(), |
386 | spacingHintSmall() ); | 390 | spacingHintSmall() ); |
387 | QHBoxLayout *hbox = new QHBoxLayout(); | 391 | Q3HBoxLayout *hbox = new Q3HBoxLayout(); |
388 | hbox->setSpacing( spacingHint() ); | 392 | hbox->setSpacing( spacingHint() ); |
389 | 393 | ||
390 | QLabel *label = new QLabel( i18n( "File to import:" ), page ); | 394 | QLabel *label = new QLabel( i18n( "File to import:" ), page ); |
391 | hbox->addWidget( label ); | 395 | hbox->addWidget( label ); |
392 | 396 | ||
393 | mUrlRequester = new KURLRequester( page ); | 397 | mUrlRequester = new KURLRequester( page ); |
394 | mUrlRequester->setFilter( "*.csv" ); | 398 | mUrlRequester->setFilter( "*.csv" ); |
395 | hbox->addWidget( mUrlRequester ); | 399 | hbox->addWidget( mUrlRequester ); |
396 | 400 | ||
397 | layout->addMultiCellLayout( hbox, 0, 0, 0, 2 ); | 401 | layout->addMultiCellLayout( hbox, 0, 0, 0, 2 ); |
398 | 402 | ||
399 | // Delimiter: comma, semicolon, tab, space, other | 403 | // Delimiter: comma, semicolon, tab, space, other |
400 | mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page ); | 404 | mDelimiterBox = new Q3ButtonGroup( i18n( "Delimiter" ), page ); |
401 | mDelimiterBox->setColumnLayout( 0, Qt::Vertical ); | 405 | mDelimiterBox->setColumnLayout( 0, Qt::Vertical ); |
402 | mDelimiterBox->layout()->setSpacing( spacingHint() ); | 406 | mDelimiterBox->layout()->setSpacing( spacingHint() ); |
403 | mDelimiterBox->layout()->setMargin( marginHint() ); | 407 | mDelimiterBox->layout()->setMargin( marginHint() ); |
404 | QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() ); | 408 | Q3GridLayout *delimiterLayout = new Q3GridLayout( mDelimiterBox->layout() ); |
405 | delimiterLayout->setAlignment( Qt::AlignTop ); | 409 | delimiterLayout->setAlignment( Qt::AlignTop ); |
406 | layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 ); | 410 | layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 ); |
407 | 411 | ||
408 | mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox ); | 412 | mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox ); |
409 | mRadioComma->setChecked( true ); | 413 | mRadioComma->setChecked( true ); |
410 | delimiterLayout->addWidget( mRadioComma, 0, 0 ); | 414 | delimiterLayout->addWidget( mRadioComma, 0, 0 ); |
411 | 415 | ||
412 | mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox ); | 416 | mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox ); |
413 | delimiterLayout->addWidget( mRadioSemicolon, 0, 1 ); | 417 | delimiterLayout->addWidget( mRadioSemicolon, 0, 1 ); |
414 | 418 | ||
415 | mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox ); | 419 | mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox ); |
416 | delimiterLayout->addWidget( mRadioTab, 1, 0 ); | 420 | delimiterLayout->addWidget( mRadioTab, 1, 0 ); |
@@ -441,26 +445,26 @@ void CSVImportDialog::initGUI() | |||
441 | label = new QLabel( i18n( "Start at line:" ), page ); | 445 | label = new QLabel( i18n( "Start at line:" ), page ); |
442 | layout->addWidget( label, 2, 1 ); | 446 | layout->addWidget( label, 2, 1 ); |
443 | 447 | ||
444 | label = new QLabel( i18n( "Textquote:" ), page ); | 448 | label = new QLabel( i18n( "Textquote:" ), page ); |
445 | layout->addWidget( label, 2, 0 ); | 449 | layout->addWidget( label, 2, 0 ); |
446 | label = new QLabel( i18n( "Codec:" ), page ); | 450 | label = new QLabel( i18n( "Codec:" ), page ); |
447 | layout->addWidget( label, 2, 2 ); | 451 | layout->addWidget( label, 2, 2 ); |
448 | 452 | ||
449 | mIgnoreDuplicates = new QCheckBox( page ); | 453 | mIgnoreDuplicates = new QCheckBox( page ); |
450 | mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) ); | 454 | mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) ); |
451 | layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 ); | 455 | layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 ); |
452 | 456 | ||
453 | mTable = new QTable( 0, 0, page ); | 457 | mTable = new Q3Table( 0, 0, page ); |
454 | mTable->setSelectionMode( QTable::NoSelection ); | 458 | mTable->setSelectionMode( Q3Table::NoSelection ); |
455 | //mTable->horizontalHeader()->hide(); | 459 | //mTable->horizontalHeader()->hide(); |
456 | layout->addMultiCellWidget( mTable, 5, 5, 0, 2 ); | 460 | layout->addMultiCellWidget( mTable, 5, 5, 0, 2 ); |
457 | /*US | 461 | /*US |
458 | setButtonText( User1, i18n( "Apply Template" ) ); | 462 | setButtonText( User1, i18n( "Apply Template" ) ); |
459 | setButtonText( User2, i18n( "Save Template" ) ); | 463 | setButtonText( User2, i18n( "Save Template" ) ); |
460 | */ | 464 | */ |
461 | 465 | ||
462 | enableButtonOK( false ); | 466 | enableButtonOK( false ); |
463 | 467 | ||
464 | findButton( User1 )->setEnabled( false ); | 468 | findButton( User1 )->setEnabled( false ); |
465 | findButton( User2 )->setEnabled( false ); | 469 | findButton( User2 )->setEnabled( false ); |
466 | 470 | ||
@@ -474,68 +478,68 @@ void CSVImportDialog::initGUI() | |||
474 | void CSVImportDialog::fillTable() | 478 | void CSVImportDialog::fillTable() |
475 | { | 479 | { |
476 | int row, column; | 480 | int row, column; |
477 | bool lastCharDelimiter = false; | 481 | bool lastCharDelimiter = false; |
478 | bool ignoreDups = mIgnoreDuplicates->isChecked(); | 482 | bool ignoreDups = mIgnoreDuplicates->isChecked(); |
479 | enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD, | 483 | enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD, |
480 | S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START; | 484 | S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START; |
481 | 485 | ||
482 | QChar x; | 486 | QChar x; |
483 | QString field = ""; | 487 | QString field = ""; |
484 | 488 | ||
485 | // store previous assignment | 489 | // store previous assignment |
486 | QValueList<int> mTypeOld = mTypeStore; | 490 | Q3ValueList<int> mTypeOld = mTypeStore; |
487 | 491 | ||
488 | mTypeStore.clear(); | 492 | mTypeStore.clear(); |
489 | for ( column = 0; column < mTable->numCols(); ++column ) { | 493 | for ( column = 0; column < mTable->numCols(); ++column ) { |
490 | QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) ); | 494 | Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, column ) ); |
491 | 495 | ||
492 | if ( !item || mClearTypeStore ) | 496 | if ( !item || mClearTypeStore ) |
493 | mTypeStore.append( typeToPos( Undefined ) ); | 497 | mTypeStore.append( typeToPos( Undefined ) ); |
494 | else if ( item ) | 498 | else if ( item ) |
495 | mTypeStore.append( item->currentItem() ); | 499 | mTypeStore.append( item->currentItem() ); |
496 | } | 500 | } |
497 | 501 | ||
498 | clearTable(); | 502 | clearTable(); |
499 | 503 | ||
500 | row = column = 1; | 504 | row = column = 1; |
501 | if ( mComboCodec->currentItem () == 0 ) { | 505 | if ( mComboCodec->currentItem () == 0 ) { |
502 | mData = QString::fromUtf8( mFileArray.data() ); | 506 | mData = QString::fromUtf8( mFileArray.data() ); |
503 | } else if ( mComboCodec->currentItem () == 1 ) { | 507 | } else if ( mComboCodec->currentItem () == 1 ) { |
504 | mData = QString::fromLatin1( mFileArray.data() ); | 508 | mData = QString::fromLatin1( mFileArray.data() ); |
505 | } else { | 509 | } else { |
506 | mData = QString::fromLocal8Bit( mFileArray.data() ); | 510 | mData = QString::fromLocal8Bit( mFileArray.data() ); |
507 | } | 511 | } |
508 | 512 | ||
509 | QTextStream inputStream( mData, IO_ReadOnly ); | 513 | Q3TextStream inputStream( mData, QIODevice::ReadOnly ); |
510 | 514 | ||
511 | if ( mComboCodec->currentItem () == 0 ) { | 515 | if ( mComboCodec->currentItem () == 0 ) { |
512 | inputStream.setEncoding( QTextStream::UnicodeUTF8 ); | 516 | inputStream.setEncoding( Q3TextStream::UnicodeUTF8 ); |
513 | } else if ( mComboCodec->currentItem () == 1 ) { | 517 | } else if ( mComboCodec->currentItem () == 1 ) { |
514 | inputStream.setEncoding( QTextStream::Latin1 ); | 518 | inputStream.setEncoding( Q3TextStream::Latin1 ); |
515 | } else { | 519 | } else { |
516 | inputStream.setEncoding( QTextStream::Locale ); | 520 | inputStream.setEncoding( Q3TextStream::Locale ); |
517 | } | 521 | } |
518 | 522 | ||
519 | int maxColumn = 0; | 523 | int maxColumn = 0; |
520 | while ( !inputStream.atEnd() ) { | 524 | while ( !inputStream.atEnd() ) { |
521 | inputStream >> x; // read one char | 525 | inputStream >> x; // read one char |
522 | 526 | ||
523 | if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly | 527 | if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly |
524 | 528 | ||
525 | switch ( state ) { | 529 | switch ( state ) { |
526 | case S_START : | 530 | case S_START : |
527 | if ( x == mTextQuote ) { | 531 | if ( x == mTextQuote ) { |
528 | state = S_QUOTED_FIELD; | 532 | state = S_QUOTED_FIELD; |
529 | } else if ( x == mDelimiter ) { | 533 | } else if ( QString(x) == mDelimiter ) { |
530 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 534 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
531 | ++column; | 535 | ++column; |
532 | lastCharDelimiter = true; | 536 | lastCharDelimiter = true; |
533 | } else if ( x == '\n' ) { | 537 | } else if ( x == '\n' ) { |
534 | ++row; | 538 | ++row; |
535 | column = 1; | 539 | column = 1; |
536 | } else { | 540 | } else { |
537 | field += x; | 541 | field += x; |
538 | state = S_MAYBE_NORMAL_FIELD; | 542 | state = S_MAYBE_NORMAL_FIELD; |
539 | } | 543 | } |
540 | break; | 544 | break; |
541 | case S_QUOTED_FIELD : | 545 | case S_QUOTED_FIELD : |
@@ -552,81 +556,81 @@ void CSVImportDialog::fillTable() | |||
552 | ++column; | 556 | ++column; |
553 | lastCharDelimiter = true; | 557 | lastCharDelimiter = true; |
554 | } | 558 | } |
555 | state = S_START; | 559 | state = S_START; |
556 | } else { | 560 | } else { |
557 | field += x; | 561 | field += x; |
558 | } | 562 | } |
559 | break; | 563 | break; |
560 | case S_MAYBE_END_OF_QUOTED_FIELD : | 564 | case S_MAYBE_END_OF_QUOTED_FIELD : |
561 | if ( x == mTextQuote ) { | 565 | if ( x == mTextQuote ) { |
562 | field += x; | 566 | field += x; |
563 | state = S_QUOTED_FIELD; | 567 | state = S_QUOTED_FIELD; |
564 | } else if ( x == mDelimiter || x == '\n' ) { | 568 | } else if ( QString(x) == mDelimiter || x == '\n' ) { |
565 | setText( row - mStartLine + 1, column, field ); | 569 | setText( row - mStartLine + 1, column, field ); |
566 | field = ""; | 570 | field = ""; |
567 | if ( x == '\n' ) { | 571 | if ( x == '\n' ) { |
568 | ++row; | 572 | ++row; |
569 | column = 1; | 573 | column = 1; |
570 | } else { | 574 | } else { |
571 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 575 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
572 | ++column; | 576 | ++column; |
573 | lastCharDelimiter = true; | 577 | lastCharDelimiter = true; |
574 | } | 578 | } |
575 | state = S_START; | 579 | state = S_START; |
576 | } else { | 580 | } else { |
577 | state = S_END_OF_QUOTED_FIELD; | 581 | state = S_END_OF_QUOTED_FIELD; |
578 | } | 582 | } |
579 | break; | 583 | break; |
580 | case S_END_OF_QUOTED_FIELD : | 584 | case S_END_OF_QUOTED_FIELD : |
581 | if ( x == mDelimiter || x == '\n' ) { | 585 | if ( QString(x) == mDelimiter || x == '\n' ) { |
582 | setText( row - mStartLine + 1, column, field ); | 586 | setText( row - mStartLine + 1, column, field ); |
583 | field = ""; | 587 | field = ""; |
584 | if ( x == '\n' ) { | 588 | if ( x == '\n' ) { |
585 | ++row; | 589 | ++row; |
586 | column = 1; | 590 | column = 1; |
587 | } else { | 591 | } else { |
588 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 592 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
589 | ++column; | 593 | ++column; |
590 | lastCharDelimiter = true; | 594 | lastCharDelimiter = true; |
591 | } | 595 | } |
592 | state = S_START; | 596 | state = S_START; |
593 | } else { | 597 | } else { |
594 | state = S_END_OF_QUOTED_FIELD; | 598 | state = S_END_OF_QUOTED_FIELD; |
595 | } | 599 | } |
596 | break; | 600 | break; |
597 | case S_MAYBE_NORMAL_FIELD : | 601 | case S_MAYBE_NORMAL_FIELD : |
598 | if ( x == mTextQuote ) { | 602 | if ( x == mTextQuote ) { |
599 | field = ""; | 603 | field = ""; |
600 | state = S_QUOTED_FIELD; | 604 | state = S_QUOTED_FIELD; |
601 | break; | 605 | break; |
602 | } | 606 | } |
603 | case S_NORMAL_FIELD : | 607 | case S_NORMAL_FIELD : |
604 | if ( x == mDelimiter || x == '\n' ) { | 608 | if ( QString(x) == mDelimiter || x == '\n' ) { |
605 | setText( row - mStartLine + 1, column, field ); | 609 | setText( row - mStartLine + 1, column, field ); |
606 | field = ""; | 610 | field = ""; |
607 | if ( x == '\n' ) { | 611 | if ( x == '\n' ) { |
608 | ++row; | 612 | ++row; |
609 | column = 1; | 613 | column = 1; |
610 | } else { | 614 | } else { |
611 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) | 615 | if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) |
612 | ++column; | 616 | ++column; |
613 | lastCharDelimiter = true; | 617 | lastCharDelimiter = true; |
614 | } | 618 | } |
615 | state = S_START; | 619 | state = S_START; |
616 | } else { | 620 | } else { |
617 | field += x; | 621 | field += x; |
618 | } | 622 | } |
619 | } | 623 | } |
620 | if ( x != mDelimiter ) | 624 | if ( QString(x) != mDelimiter ) |
621 | lastCharDelimiter = false; | 625 | lastCharDelimiter = false; |
622 | 626 | ||
623 | if ( column > maxColumn ) | 627 | if ( column > maxColumn ) |
624 | maxColumn = column; | 628 | maxColumn = column; |
625 | } | 629 | } |
626 | 630 | ||
627 | // file with only one line without '\n' | 631 | // file with only one line without '\n' |
628 | if ( field.length() > 0 ) { | 632 | if ( field.length() > 0 ) { |
629 | setText( row - mStartLine + 1, column, field ); | 633 | setText( row - mStartLine + 1, column, field ); |
630 | ++row; | 634 | ++row; |
631 | field = ""; | 635 | field = ""; |
632 | } | 636 | } |
@@ -640,25 +644,25 @@ void CSVImportDialog::fillTable() | |||
640 | while ( iii < count ) { | 644 | while ( iii < count ) { |
641 | keys << "dummy"; | 645 | keys << "dummy"; |
642 | ++iii; | 646 | ++iii; |
643 | } | 647 | } |
644 | QMap<QString, uint>::ConstIterator it; | 648 | QMap<QString, uint>::ConstIterator it; |
645 | for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it) | 649 | for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it) |
646 | keys[( it.data() )] = it.key(); | 650 | keys[( it.data() )] = it.key(); |
647 | //US end | 651 | //US end |
648 | 652 | ||
649 | for ( column = 0; column < mTable->numCols(); ++column ) { | 653 | for ( column = 0; column < mTable->numCols(); ++column ) { |
650 | 654 | ||
651 | //US QComboTableItem *item = new QComboTableItem( mTable, mTypeMap.keys() ); | 655 | //US QComboTableItem *item = new QComboTableItem( mTable, mTypeMap.keys() ); |
652 | QComboTableItem *item = new QComboTableItem( mTable, keys ); | 656 | Q3ComboTableItem *item = new Q3ComboTableItem( mTable, keys ); |
653 | mTable->setItem( 0, column, item ); | 657 | mTable->setItem( 0, column, item ); |
654 | if ( column < mTypeStore.count() ) | 658 | if ( column < mTypeStore.count() ) |
655 | item->setCurrentItem( mTypeStore[ column ] ); | 659 | item->setCurrentItem( mTypeStore[ column ] ); |
656 | else | 660 | else |
657 | item->setCurrentItem( typeToPos( Undefined ) ); | 661 | item->setCurrentItem( typeToPos( Undefined ) ); |
658 | 662 | ||
659 | mTable->adjustColumn( column ); | 663 | mTable->adjustColumn( column ); |
660 | } | 664 | } |
661 | } | 665 | } |
662 | 666 | ||
663 | void CSVImportDialog::clearTable() | 667 | void CSVImportDialog::clearTable() |
664 | { | 668 | { |
@@ -755,25 +759,25 @@ void CSVImportDialog::textquoteSelected( const QString& mark ) | |||
755 | 759 | ||
756 | void CSVImportDialog::lineSelected( const QString& line ) | 760 | void CSVImportDialog::lineSelected( const QString& line ) |
757 | { | 761 | { |
758 | mStartLine = line.toInt() - 1; | 762 | mStartLine = line.toInt() - 1; |
759 | fillTable(); | 763 | fillTable(); |
760 | } | 764 | } |
761 | 765 | ||
762 | void CSVImportDialog::slotOk() | 766 | void CSVImportDialog::slotOk() |
763 | { | 767 | { |
764 | bool assigned = false; | 768 | bool assigned = false; |
765 | 769 | ||
766 | for ( int column = 0; column < mTable->numCols(); ++column ) { | 770 | for ( int column = 0; column < mTable->numCols(); ++column ) { |
767 | QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, | 771 | Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, |
768 | column ) ); | 772 | column ) ); |
769 | if ( item && posToType( item->currentItem() ) != Undefined ) | 773 | if ( item && posToType( item->currentItem() ) != Undefined ) |
770 | assigned = true; | 774 | assigned = true; |
771 | } | 775 | } |
772 | 776 | ||
773 | if ( assigned ) | 777 | if ( assigned ) |
774 | KDialogBase::slotOk(); | 778 | KDialogBase::slotOk(); |
775 | else | 779 | else |
776 | KMessageBox::sorry( this, i18n( "You have to assign at least one column." ) ); | 780 | KMessageBox::sorry( this, i18n( "You have to assign at least one column." ) ); |
777 | } | 781 | } |
778 | 782 | ||
779 | void CSVImportDialog::applyTemplate() | 783 | void CSVImportDialog::applyTemplate() |
@@ -827,25 +831,25 @@ void CSVImportDialog::applyTemplate() | |||
827 | textquoteSelected( mComboQuote->currentText() ); | 831 | textquoteSelected( mComboQuote->currentText() ); |
828 | 832 | ||
829 | // create the column map | 833 | // create the column map |
830 | config.setGroup( "csv column map" ); | 834 | config.setGroup( "csv column map" ); |
831 | for ( uint i = 0; i < numColumns; ++i ) { | 835 | for ( uint i = 0; i < numColumns; ++i ) { |
832 | int col = config.readNumEntry( QString::number( i ) ); | 836 | int col = config.readNumEntry( QString::number( i ) ); |
833 | columnMap.insert( i, col ); | 837 | columnMap.insert( i, col ); |
834 | } | 838 | } |
835 | 839 | ||
836 | // apply the column map | 840 | // apply the column map |
837 | for ( uint column = 0; column < columnMap.count(); ++column ) { | 841 | for ( uint column = 0; column < columnMap.count(); ++column ) { |
838 | int type = columnMap[ column ]; | 842 | int type = columnMap[ column ]; |
839 | QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, | 843 | Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, |
840 | column ) ); | 844 | column ) ); |
841 | if ( item ) | 845 | if ( item ) |
842 | item->setCurrentItem( typeToPos( type ) ); | 846 | item->setCurrentItem( typeToPos( type ) ); |
843 | } | 847 | } |
844 | } | 848 | } |
845 | 849 | ||
846 | void CSVImportDialog::saveTemplate() | 850 | void CSVImportDialog::saveTemplate() |
847 | { | 851 | { |
848 | /*US | 852 | /*US |
849 | QString fileName = KFileDialog::getSaveFileName( | 853 | QString fileName = KFileDialog::getSaveFileName( |
850 | locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ), | 854 | locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ), |
851 | "*.desktop", this ); | 855 | "*.desktop", this ); |
@@ -869,25 +873,25 @@ void CSVImportDialog::saveTemplate() | |||
869 | config.setGroup( "General" ); | 873 | config.setGroup( "General" ); |
870 | config.writeEntry( "Columns", mTable->numCols() ); | 874 | config.writeEntry( "Columns", mTable->numCols() ); |
871 | config.writeEntry( "DelimiterType", mDelimiterBox->id( mDelimiterBox->selected() ) ); | 875 | config.writeEntry( "DelimiterType", mDelimiterBox->id( mDelimiterBox->selected() ) ); |
872 | config.writeEntry( "DelimiterOther", mDelimiterEdit->text() ); | 876 | config.writeEntry( "DelimiterOther", mDelimiterEdit->text() ); |
873 | config.writeEntry( "QuoteType", mComboQuote->currentItem() ); | 877 | config.writeEntry( "QuoteType", mComboQuote->currentItem() ); |
874 | 878 | ||
875 | config.setGroup( "Misc" ); | 879 | config.setGroup( "Misc" ); |
876 | config.writeEntry( "Name", name ); | 880 | config.writeEntry( "Name", name ); |
877 | 881 | ||
878 | config.setGroup( "csv column map" ); | 882 | config.setGroup( "csv column map" ); |
879 | 883 | ||
880 | for ( uint column = 0; column < mTable->numCols(); ++column ) { | 884 | for ( uint column = 0; column < mTable->numCols(); ++column ) { |
881 | QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, | 885 | Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, |
882 | column ) ); | 886 | column ) ); |
883 | if ( item ) | 887 | if ( item ) |
884 | config.writeEntry( QString::number( column ), posToType( | 888 | config.writeEntry( QString::number( column ), posToType( |
885 | item->currentItem() ) ); | 889 | item->currentItem() ) ); |
886 | else | 890 | else |
887 | config.writeEntry( QString::number( column ), 0 ); | 891 | config.writeEntry( QString::number( column ), 0 ); |
888 | } | 892 | } |
889 | 893 | ||
890 | config.sync(); | 894 | config.sync(); |
891 | } | 895 | } |
892 | 896 | ||
893 | QString CSVImportDialog::getText( int row, int col ) | 897 | QString CSVImportDialog::getText( int row, int col ) |
@@ -925,25 +929,25 @@ int CSVImportDialog::typeToPos( uint type ) const | |||
925 | 929 | ||
926 | void CSVImportDialog::ignoreDuplicatesChanged( int ) | 930 | void CSVImportDialog::ignoreDuplicatesChanged( int ) |
927 | { | 931 | { |
928 | fillTable(); | 932 | fillTable(); |
929 | } | 933 | } |
930 | 934 | ||
931 | void CSVImportDialog::setFile( const QString &fileName ) | 935 | void CSVImportDialog::setFile( const QString &fileName ) |
932 | { | 936 | { |
933 | if ( fileName.isEmpty() ) | 937 | if ( fileName.isEmpty() ) |
934 | return; | 938 | return; |
935 | 939 | ||
936 | QFile file( fileName ); | 940 | QFile file( fileName ); |
937 | if ( !file.open( IO_ReadOnly ) ) { | 941 | if ( !file.open( QIODevice::ReadOnly ) ) { |
938 | KMessageBox::sorry( this, i18n( "Cannot open input file!" ) ); | 942 | KMessageBox::sorry( this, i18n( "Cannot open input file!" ) ); |
939 | file.close(); | 943 | file.close(); |
940 | return; | 944 | return; |
941 | } | 945 | } |
942 | 946 | ||
943 | mFileArray = file.readAll(); | 947 | mFileArray = file.readAll(); |
944 | file.close(); | 948 | file.close(); |
945 | 949 | ||
946 | mClearTypeStore = true; | 950 | mClearTypeStore = true; |
947 | clearTable(); | 951 | clearTable(); |
948 | mTable->setNumCols( 0 ); | 952 | mTable->setNumCols( 0 ); |
949 | mTable->setNumRows( 0 ); | 953 | mTable->setNumRows( 0 ); |
@@ -955,15 +959,15 @@ void CSVImportDialog::setFile( const QString &fileName ) | |||
955 | 959 | ||
956 | void CSVImportDialog::urlChanged( const QString &file ) | 960 | void CSVImportDialog::urlChanged( const QString &file ) |
957 | { | 961 | { |
958 | bool state = !file.isEmpty(); | 962 | bool state = !file.isEmpty(); |
959 | 963 | ||
960 | enableButtonOK( state ); | 964 | enableButtonOK( state ); |
961 | 965 | ||
962 | findButton( User1 )->setEnabled( state ); | 966 | findButton( User1 )->setEnabled( state ); |
963 | findButton( User2 )->setEnabled( state ); | 967 | findButton( User2 )->setEnabled( state ); |
964 | 968 | ||
965 | } | 969 | } |
966 | 970 | ||
967 | #ifndef KAB_EMBEDDED | 971 | #ifndef KAB_EMBEDDED_ |
968 | #include <csvimportdialog.moc> | 972 | #include <moc_csvimportdialog.cpp> |
969 | #endif //KAB_EMBEDDED | 973 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/xxport/csvimportdialog.h b/kaddressbook/xxport/csvimportdialog.h index 2661420..520f3fa 100644 --- a/kaddressbook/xxport/csvimportdialog.h +++ b/kaddressbook/xxport/csvimportdialog.h | |||
@@ -24,35 +24,35 @@ Enhanced Version of the file for platform independent KDE tools. | |||
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef CSV_IMPORT_DLG_H | 29 | #ifndef CSV_IMPORT_DLG_H |
30 | #define CSV_IMPORT_DLG_H | 30 | #define CSV_IMPORT_DLG_H |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kabc/addresseelist.h> | 33 | #include <kabc/addresseelist.h> |
34 | #include <kdialogbase.h> | 34 | #include <kdialogbase.h> |
35 | 35 | ||
36 | #include <qvaluelist.h> | 36 | #include <q3valuelist.h> |
37 | 37 | ||
38 | class KURLRequester; | 38 | class KURLRequester; |
39 | 39 | ||
40 | class QButtonGroup; | 40 | class Q3ButtonGroup; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QCheckBox; | 42 | class QCheckBox; |
43 | class QLineEdit; | 43 | class QLineEdit; |
44 | class QPushButton; | 44 | class QPushButton; |
45 | class QRadioButton; | 45 | class QRadioButton; |
46 | class QTable; | 46 | class Q3Table; |
47 | 47 | ||
48 | class CSVImportDialog : public KDialogBase | 48 | class CSVImportDialog : public KDialogBase |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, | 53 | CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, |
54 | const char *name = 0 ); | 54 | const char *name = 0 ); |
55 | ~CSVImportDialog(); | 55 | ~CSVImportDialog(); |
56 | 56 | ||
57 | KABC::AddresseeList contacts() const; | 57 | KABC::AddresseeList contacts() const; |
58 | 58 | ||
@@ -76,26 +76,26 @@ class CSVImportDialog : public KDialogBase | |||
76 | private: | 76 | private: |
77 | enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName, | 77 | enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName, |
78 | Prefix, Suffix, NickName, Birthday, | 78 | Prefix, Suffix, NickName, Birthday, |
79 | HomeAddressStreet, HomeAddressLocality, HomeAddressRegion, | 79 | HomeAddressStreet, HomeAddressLocality, HomeAddressRegion, |
80 | HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel, | 80 | HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel, |
81 | BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion, | 81 | BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion, |
82 | BusinessAddressPostalCode, BusinessAddressCountry, | 82 | BusinessAddressPostalCode, BusinessAddressCountry, |
83 | BusinessAddressLabel, | 83 | BusinessAddressLabel, |
84 | HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, MobileWorkPhone, | 84 | HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, MobileWorkPhone, |
85 | Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories | 85 | Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories |
86 | }; | 86 | }; |
87 | 87 | ||
88 | QTable* mTable; | 88 | Q3Table* mTable; |
89 | QButtonGroup* mDelimiterBox; | 89 | Q3ButtonGroup* mDelimiterBox; |
90 | QRadioButton* mRadioComma; | 90 | QRadioButton* mRadioComma; |
91 | QRadioButton* mRadioSemicolon; | 91 | QRadioButton* mRadioSemicolon; |
92 | QRadioButton* mRadioTab; | 92 | QRadioButton* mRadioTab; |
93 | QRadioButton* mRadioSpace; | 93 | QRadioButton* mRadioSpace; |
94 | QRadioButton* mRadioOther; | 94 | QRadioButton* mRadioOther; |
95 | QLineEdit* mDelimiterEdit; | 95 | QLineEdit* mDelimiterEdit; |
96 | QComboBox* mComboLine; | 96 | QComboBox* mComboLine; |
97 | QComboBox* mComboQuote; | 97 | QComboBox* mComboQuote; |
98 | QComboBox* mComboCodec; | 98 | QComboBox* mComboCodec; |
99 | QCheckBox* mIgnoreDuplicates; | 99 | QCheckBox* mIgnoreDuplicates; |
100 | KURLRequester* mUrlRequester; | 100 | KURLRequester* mUrlRequester; |
101 | 101 | ||
@@ -110,17 +110,17 @@ class CSVImportDialog : public KDialogBase | |||
110 | int typeToPos( uint type ) const; | 110 | int typeToPos( uint type ) const; |
111 | 111 | ||
112 | bool mAdjustRows; | 112 | bool mAdjustRows; |
113 | int mStartLine; | 113 | int mStartLine; |
114 | QChar mTextQuote; | 114 | QChar mTextQuote; |
115 | QString mDelimiter; | 115 | QString mDelimiter; |
116 | QString mData; | 116 | QString mData; |
117 | QByteArray mFileArray; | 117 | QByteArray mFileArray; |
118 | QMap<QString, uint> mTypeMap; | 118 | QMap<QString, uint> mTypeMap; |
119 | KABC::AddressBook *mAddressBook; | 119 | KABC::AddressBook *mAddressBook; |
120 | int mCustomCounter; | 120 | int mCustomCounter; |
121 | bool mClearTypeStore; | 121 | bool mClearTypeStore; |
122 | QValueList<int> mTypeStore; | 122 | Q3ValueList<int> mTypeStore; |
123 | 123 | ||
124 | }; | 124 | }; |
125 | 125 | ||
126 | #endif | 126 | #endif |
diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp index 03efc1b..72d3fc2 100644 --- a/kaddressbook/xxport/kde2_xxport.cpp +++ b/kaddressbook/xxport/kde2_xxport.cpp | |||
@@ -107,15 +107,15 @@ KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const | |||
107 | } else if ( result == KMessageBox::No ) | 107 | } else if ( result == KMessageBox::No ) |
108 | proc << "kab2kabc"; | 108 | proc << "kab2kabc"; |
109 | else | 109 | else |
110 | kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl; | 110 | kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl; |
111 | 111 | ||
112 | proc.start( KProcess::Block ); | 112 | proc.start( KProcess::Block ); |
113 | 113 | ||
114 | addressBook()->load(); | 114 | addressBook()->load(); |
115 | 115 | ||
116 | return KABC::AddresseeList(); | 116 | return KABC::AddresseeList(); |
117 | } | 117 | } |
118 | 118 | ||
119 | #ifndef KAB_EMBEDDED | 119 | #ifndef KAB_EMBEDDED_ |
120 | #include "kde2_xxport.moc" | 120 | #include "moc_kde2_xxport.cpp" |
121 | #endif //KAB_EMBEDDED | 121 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 9a8fa68..64b9071 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp | |||
@@ -20,26 +20,28 @@ | |||
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <q3textstream.h> |
33 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3CString> | ||
34 | 36 | ||
35 | #include <kabc/vcardconverter.h> | 37 | #include <kabc/vcardconverter.h> |
36 | #include <kabc/vcardparser/vcardtool.h> | 38 | #include <kabc/vcardparser/vcardtool.h> |
37 | #include <kfiledialog.h> | 39 | #include <kfiledialog.h> |
38 | #ifndef KAB_EMBEDDED | 40 | #ifndef KAB_EMBEDDED |
39 | #include <kio/netaccess.h> | 41 | #include <kio/netaccess.h> |
40 | #endif //KAB_EMBEDDED | 42 | #endif //KAB_EMBEDDED |
41 | 43 | ||
42 | #include <klocale.h> | 44 | #include <klocale.h> |
43 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
44 | #include <ktempfile.h> | 46 | #include <ktempfile.h> |
45 | #include <kurl.h> | 47 | #include <kurl.h> |
@@ -93,32 +95,32 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString | |||
93 | name = "addressbook.vcf"; | 95 | name = "addressbook.vcf"; |
94 | 96 | ||
95 | #ifndef KAB_EMBEDDED | 97 | #ifndef KAB_EMBEDDED |
96 | QString fileName = KFileDialog::getSaveFileName( name ); | 98 | QString fileName = KFileDialog::getSaveFileName( name ); |
97 | #else //KAB_EMBEDDED | 99 | #else //KAB_EMBEDDED |
98 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); | 100 | QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); |
99 | #endif //KAB_EMBEDDED | 101 | #endif //KAB_EMBEDDED |
100 | 102 | ||
101 | if ( fileName.isEmpty() ) | 103 | if ( fileName.isEmpty() ) |
102 | return false; | 104 | return false; |
103 | 105 | ||
104 | QFile outFile( fileName ); | 106 | QFile outFile( fileName ); |
105 | if ( !outFile.open( IO_WriteOnly ) ) { | 107 | if ( !outFile.open( QIODevice::WriteOnly ) ) { |
106 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 108 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
107 | KMessageBox::error( parentWidget(), text.arg( fileName ) ); | 109 | KMessageBox::error( parentWidget(), text.arg( fileName ) ); |
108 | return false; | 110 | return false; |
109 | } | 111 | } |
110 | 112 | ||
111 | QTextStream t( &outFile ); | 113 | Q3TextStream t( &outFile ); |
112 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 114 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
113 | 115 | ||
114 | KABC::Addressee::List::ConstIterator it; | 116 | KABC::Addressee::List::ConstIterator it; |
115 | for ( it = list.begin(); it != list.end(); ++it ) { | 117 | for ( it = list.begin(); it != list.end(); ++it ) { |
116 | KABC::VCardConverter converter; | 118 | KABC::VCardConverter converter; |
117 | QString vcard; | 119 | QString vcard; |
118 | 120 | ||
119 | KABC::VCardConverter::Version version; | 121 | KABC::VCardConverter::Version version; |
120 | if ( data == "v21" ) | 122 | if ( data == "v21" ) |
121 | version = KABC::VCardConverter::v2_1; | 123 | version = KABC::VCardConverter::v2_1; |
122 | else | 124 | else |
123 | version = KABC::VCardConverter::v3_0; | 125 | version = KABC::VCardConverter::v3_0; |
124 | 126 | ||
@@ -144,25 +146,25 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const | |||
144 | if ( XXPortManager::importURL.isEmpty() ) | 146 | if ( XXPortManager::importURL.isEmpty() ) |
145 | { | 147 | { |
146 | url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); | 148 | url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); |
147 | } | 149 | } |
148 | else | 150 | else |
149 | url = XXPortManager::importURL; | 151 | url = XXPortManager::importURL; |
150 | if ( url.isEmpty() ) | 152 | if ( url.isEmpty() ) |
151 | return addrList; | 153 | return addrList; |
152 | QString caption( i18n( "vCard Import Failed" ) ); | 154 | QString caption( i18n( "vCard Import Failed" ) ); |
153 | if ( KIO::NetAccess::download( url, fileName ) ) { | 155 | if ( KIO::NetAccess::download( url, fileName ) ) { |
154 | QFile file( fileName ); | 156 | QFile file( fileName ); |
155 | 157 | ||
156 | file.open( IO_ReadOnly ); | 158 | file.open( QIODevice::ReadOnly ); |
157 | QByteArray rawData = file.readAll(); | 159 | QByteArray rawData = file.readAll(); |
158 | file.close(); | 160 | file.close(); |
159 | 161 | ||
160 | QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 162 | QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
161 | addrList = parseVCard( data ); | 163 | addrList = parseVCard( data ); |
162 | 164 | ||
163 | if ( !url.isLocalFile() ) | 165 | if ( !url.isLocalFile() ) |
164 | KIO::NetAccess::removeTempFile( fileName ); | 166 | KIO::NetAccess::removeTempFile( fileName ); |
165 | 167 | ||
166 | } else { | 168 | } else { |
167 | QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" ); | 169 | QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" ); |
168 | KMessageBox::error( parentWidget(), text.arg( url.url() ), caption ); | 170 | KMessageBox::error( parentWidget(), text.arg( url.url() ), caption ); |
@@ -187,26 +189,26 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const | |||
187 | if ( !fi.isFile() ) | 189 | if ( !fi.isFile() ) |
188 | return addrList; | 190 | return addrList; |
189 | } | 191 | } |
190 | else | 192 | else |
191 | { | 193 | { |
192 | //US url = XXPortManager::importURL; | 194 | //US url = XXPortManager::importURL; |
193 | qDebug("VCardXXPort::importContacts Urls at the moment not supported"); | 195 | qDebug("VCardXXPort::importContacts Urls at the moment not supported"); |
194 | if ( url.isEmpty() ) | 196 | if ( url.isEmpty() ) |
195 | return addrList; | 197 | return addrList; |
196 | 198 | ||
197 | } | 199 | } |
198 | QFile file( fileName ); | 200 | QFile file( fileName ); |
199 | if ( file.open( IO_ReadOnly ) ) { | 201 | if ( file.open( QIODevice::ReadOnly ) ) { |
200 | QCString rawData ( file.readAll().data(),file.size()+1); | 202 | Q3CString rawData ( file.readAll().data(),file.size()+1); |
201 | file.close(); | 203 | file.close(); |
202 | int start = 0; | 204 | int start = 0; |
203 | #ifndef DESKTOP_VERSION | 205 | #ifndef DESKTOP_VERSION |
204 | while ( start < rawData.size()-2 ) { | 206 | while ( start < rawData.size()-2 ) { |
205 | if ( rawData.at( start ) == '\r' ) | 207 | if ( rawData.at( start ) == '\r' ) |
206 | if ( rawData.at( start+1 ) == '\n' ) | 208 | if ( rawData.at( start+1 ) == '\n' ) |
207 | if ( rawData.at( start+2 ) == ' ' ) { | 209 | if ( rawData.at( start+2 ) == ' ' ) { |
208 | rawData.remove(start,3); | 210 | rawData.remove(start,3); |
209 | --start; | 211 | --start; |
210 | } | 212 | } |
211 | ++start; | 213 | ++start; |
212 | } | 214 | } |
@@ -258,15 +260,15 @@ KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const | |||
258 | KMessageBox::sorry( parentWidget(), text ); | 260 | KMessageBox::sorry( parentWidget(), text ); |
259 | } | 261 | } |
260 | } | 262 | } |
261 | */ | 263 | */ |
262 | if ( addrList.isEmpty() ) { | 264 | if ( addrList.isEmpty() ) { |
263 | QString text = i18n( "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n" ); | 265 | QString text = i18n( "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n" ); |
264 | KMessageBox::sorry( parentWidget(), text ); | 266 | KMessageBox::sorry( parentWidget(), text ); |
265 | } | 267 | } |
266 | return addrList; | 268 | return addrList; |
267 | } | 269 | } |
268 | 270 | ||
269 | 271 | ||
270 | #ifndef KAB_EMBEDDED | 272 | #ifndef KAB_EMBEDDED_ |
271 | #include "vcard_xxport.moc" | 273 | #include "moc_vcard_xxport.cpp" |
272 | #endif //KAB_EMBEDDED | 274 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 405f7ec..95b240d 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -21,24 +21,26 @@ | |||
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qlist.h> | 32 | #include <qlist.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3VBoxLayout> | ||
33 | 35 | ||
34 | #include <kabc/addressbook.h> | 36 | #include <kabc/addressbook.h> |
35 | #include <kabc/resource.h> | 37 | #include <kabc/resource.h> |
36 | #include <kdebug.h> | 38 | #include <kdebug.h> |
37 | #include <kdialogbase.h> | 39 | #include <kdialogbase.h> |
38 | #include <klocale.h> | 40 | #include <klocale.h> |
39 | #include <kmessagebox.h> | 41 | #include <kmessagebox.h> |
40 | 42 | ||
41 | #ifndef KAB_EMBEDDED | 43 | #ifndef KAB_EMBEDDED |
42 | #include <ktrader.h> | 44 | #include <ktrader.h> |
43 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
44 | extern "C" | 46 | extern "C" |
@@ -208,63 +210,60 @@ void XXPortManager::loadPlugins() | |||
208 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; | 210 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; |
209 | continue; | 211 | continue; |
210 | } | 212 | } |
211 | 213 | ||
212 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 214 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
213 | 215 | ||
214 | if ( !xxportFactory ) { | 216 | if ( !xxportFactory ) { |
215 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; | 217 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; |
216 | continue; | 218 | continue; |
217 | } | 219 | } |
218 | 220 | ||
219 | #else //KAB_EMBEDDED | 221 | #else //KAB_EMBEDDED |
220 | QList<XXPortFactory> factorylist; | 222 | QList<XXPortFactory*> factorylist; |
221 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); | 223 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); |
222 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); | 224 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); |
223 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); | 225 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); |
224 | //US factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); | 226 | //US factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); |
225 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); | 227 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); |
226 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); | 228 | factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); |
227 | 229 | ||
228 | QListIterator<XXPortFactory> it(factorylist); | 230 | for(QList<XXPortFactory*>::iterator it=factorylist.begin();it!=factorylist.end();++it) { |
229 | for ( ; it.current(); ++it ) | 231 | XXPortFactory *xxportFactory = *it; |
230 | { | ||
231 | XXPortFactory *xxportFactory = it.current(); | ||
232 | #endif //KAB_EMBEDDED | 232 | #endif //KAB_EMBEDDED |
233 | 233 | ||
234 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); | 234 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); |
235 | if ( obj ) { | 235 | if ( obj ) { |
236 | mCore->addGUIClient( obj ); | 236 | mCore->addGUIClient( obj ); |
237 | mXXPortObjects.insert( obj->identifier(), obj ); | 237 | mXXPortObjects.insert( obj->identifier(), obj ); |
238 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), | 238 | connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), |
239 | this, SLOT( slotExport( const QString&, const QString& ) ) ); | 239 | this, SLOT( slotExport( const QString&, const QString& ) ) ); |
240 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), | 240 | connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), |
241 | this, SLOT( slotImport( const QString&, const QString& ) ) ); | 241 | this, SLOT( slotImport( const QString&, const QString& ) ) ); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | 247 | PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, |
248 | const char *name ) | 248 | const char *name ) |
249 | : KDialogBase( Plain, i18n( "Import this contact?" ), Ok | User1| User2, Ok, parent, | 249 | : KDialogBase( Plain, i18n( "Import this contact?" ), Ok | User1| User2, Ok, parent, |
250 | name, true, true ,i18n( "Import all!" ),i18n( "No" ) ) | 250 | name, true, true ,i18n( "Import all!" ),i18n( "No" ) ) |
251 | { | 251 | { |
252 | QWidget *page = plainPage(); | 252 | QWidget *page = plainPage(); |
253 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); | 253 | Q3VBoxLayout *layout = new Q3VBoxLayout( page, marginHint(), spacingHint() ); |
254 | connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) ); | 254 | connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) ); |
255 | connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) ); | 255 | connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) ); |
256 | 256 | ||
257 | KABC::AddresseeView *view = new KABC::AddresseeView( page ); | 257 | KABC::AddresseeView *view = new KABC::AddresseeView( page ); |
258 | view->setAddressee( addr ); | 258 | view->setAddressee( addr ); |
259 | layout->addWidget( view ); | 259 | layout->addWidget( view ); |
260 | #ifdef DESKTOP_VERSION | 260 | #ifdef DESKTOP_VERSION |
261 | resize( 640, 480 ); | 261 | resize( 640, 480 ); |
262 | #else | 262 | #else |
263 | showMaximized(); | 263 | showMaximized(); |
264 | #endif | 264 | #endif |
265 | } | 265 | } |
266 | 266 | ||
267 | #ifndef KAB_EMBEDDED | 267 | #ifndef KAB_EMBEDDED_ |
268 | #include "xxportmanager.moc" | 268 | #include "moc_xxportmanager.cpp" |
269 | #endif //KAB_EMBEDDED | 269 | #endif //KAB_EMBEDDED |
270 | |||
diff --git a/kaddressbook/xxportmanager.h b/kaddressbook/xxportmanager.h index e801d9b..0528922 100644 --- a/kaddressbook/xxportmanager.h +++ b/kaddressbook/xxportmanager.h | |||
@@ -23,25 +23,25 @@ | |||
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | #ifndef XXPORTMANAGER_H | 32 | #ifndef XXPORTMANAGER_H |
33 | #define XXPORTMANAGER_H | 33 | #define XXPORTMANAGER_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <q3dict.h> |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | 37 | ||
38 | #include <kurl.h> | 38 | #include <kurl.h> |
39 | 39 | ||
40 | #include "xxportobject.h" | 40 | #include "xxportobject.h" |
41 | 41 | ||
42 | class KABCore; | 42 | class KABCore; |
43 | 43 | ||
44 | class XXPortManager : public QObject | 44 | class XXPortManager : public QObject |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
@@ -62,19 +62,19 @@ class XXPortManager : public QObject | |||
62 | 62 | ||
63 | signals: | 63 | signals: |
64 | void modified(); | 64 | void modified(); |
65 | 65 | ||
66 | protected slots: | 66 | protected slots: |
67 | void noPreview(); | 67 | void noPreview(); |
68 | void slotImport( const QString&, const QString& ); | 68 | void slotImport( const QString&, const QString& ); |
69 | void slotExport( const QString&, const QString& ); | 69 | void slotExport( const QString&, const QString& ); |
70 | 70 | ||
71 | private: | 71 | private: |
72 | void loadPlugins(); | 72 | void loadPlugins(); |
73 | 73 | ||
74 | QDict<XXPortObject> mXXPortObjects; | 74 | Q3Dict<XXPortObject> mXXPortObjects; |
75 | 75 | ||
76 | KABCore *mCore; | 76 | KABCore *mCore; |
77 | bool mShowPreview; | 77 | bool mShowPreview; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | #endif | 80 | #endif |
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index bd9d986..2d8d0ff 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp | |||
@@ -262,15 +262,15 @@ KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identi | |||
262 | res = tmpAB.load(); | 262 | res = tmpAB.load(); |
263 | 263 | ||
264 | adrlst = tmpAB.allAddressees(); | 264 | adrlst = tmpAB.allAddressees(); |
265 | 265 | ||
266 | //remove resource deletes also the Resourceobject, if the linkcount is 0 | 266 | //remove resource deletes also the Resourceobject, if the linkcount is 0 |
267 | tmpAB.removeResource( mResource ); | 267 | tmpAB.removeResource( mResource ); |
268 | 268 | ||
269 | return adrlst; | 269 | return adrlst; |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | 273 | ||
274 | #ifndef KAB_EMBEDDED | 274 | #ifndef KAB_EMBEDDED_ |
275 | #include "xxportobject.moc" | 275 | #include "moc_xxportobject.cpp" |
276 | #endif //KAB_EMBEDDED | 276 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index 278cab0..088bffa 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -27,73 +27,78 @@ Enhanced Version of the file for platform independent KDE tools. | |||
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kcombobox.h> | 34 | #include <kcombobox.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | 37 | ||
38 | #include <qapplication.h> | 38 | #include <qapplication.h> |
39 | #include <qbuttongroup.h> | 39 | #include <QDesktopWidget> |
40 | #include <q3buttongroup.h> | ||
40 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
41 | #include <qheader.h> | 42 | #include <q3header.h> |
42 | #include <qlabel.h> | 43 | #include <qlabel.h> |
43 | #include <qlayout.h> | 44 | #include <qlayout.h> |
44 | #include <qlistview.h> | 45 | #include <q3listview.h> |
45 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
46 | #include <qradiobutton.h> | 47 | #include <qradiobutton.h> |
47 | #include <qstringlist.h> | 48 | #include <qstringlist.h> |
48 | #include <qwhatsthis.h> | 49 | #include <q3whatsthis.h> |
50 | //Added by qt3to4: | ||
51 | #include <Q3GridLayout> | ||
52 | #include <Q3Frame> | ||
53 | #include <Q3VBoxLayout> | ||
49 | 54 | ||
50 | #include "kabcore.h" | 55 | #include "kabcore.h" |
51 | #include "kabprefs.h" | 56 | #include "kabprefs.h" |
52 | 57 | ||
53 | #include "xxportselectdialog.h" | 58 | #include "xxportselectdialog.h" |
54 | 59 | ||
55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 60 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
56 | QWidget* parent, const char* name ) | 61 | QWidget* parent, const char* name ) |
57 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, | 62 | : KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel, |
58 | Ok, parent, name, true, true ), mCore( core ), | 63 | Ok, parent, name, true, true ), mCore( core ), |
59 | mUseSorting( sort ) | 64 | mUseSorting( sort ) |
60 | { | 65 | { |
61 | initGUI(); | 66 | initGUI(); |
62 | 67 | ||
63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 68 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
64 | SLOT( filterChanged( int ) ) ); | 69 | SLOT( filterChanged( int ) ) ); |
65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 70 | connect( mCategoriesView, SIGNAL( clicked( Q3ListViewItem* ) ), |
66 | SLOT( categoryClicked( QListViewItem* ) ) ); | 71 | SLOT( categoryClicked( Q3ListViewItem* ) ) ); |
67 | 72 | ||
68 | // setup filters | 73 | // setup filters |
69 | #ifndef KAB_EMBEDDED | 74 | #ifndef KAB_EMBEDDED |
70 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 75 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
71 | Filter::List::iterator filterIt; | 76 | Filter::List::iterator filterIt; |
72 | #else //KAB_EMBEDDED | 77 | #else //KAB_EMBEDDED |
73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 78 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
74 | Filter::List::Iterator filterIt; | 79 | Filter::List::Iterator filterIt; |
75 | #endif //KAB_EMBEDDED | 80 | #endif //KAB_EMBEDDED |
76 | QStringList filters; | 81 | QStringList filters; |
77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 82 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
78 | filters.append( (*filterIt).name() ); | 83 | filters.append( (*filterIt).name() ); |
79 | 84 | ||
80 | mFiltersCombo->insertStringList( filters ); | 85 | mFiltersCombo->insertStringList( filters ); |
81 | mUseFilters->setEnabled( filters.count() > 0 ); | 86 | mUseFilters->setEnabled( filters.count() > 0 ); |
82 | 87 | ||
83 | // setup categories | 88 | // setup categories |
84 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 89 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
85 | QStringList::Iterator it; | 90 | QStringList::Iterator it; |
86 | for ( it = categories.begin(); it != categories.end(); ++it ) | 91 | for ( it = categories.begin(); it != categories.end(); ++it ) |
87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 92 | new Q3CheckListItem( mCategoriesView, *it, Q3CheckListItem::CheckBox ); |
88 | mUseCategories->setEnabled( categories.count() > 0 ); | 93 | mUseCategories->setEnabled( categories.count() > 0 ); |
89 | 94 | ||
90 | int count = mCore->selectedUIDs().count(); | 95 | int count = mCore->selectedUIDs().count(); |
91 | mUseSelection->setEnabled( count != 0 ); | 96 | mUseSelection->setEnabled( count != 0 ); |
92 | mUseSelection->setChecked( count > 1 ); | 97 | mUseSelection->setChecked( count > 1 ); |
93 | 98 | ||
94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 99 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 100 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
96 | 101 | ||
97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 102 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
98 | KABC::Field::List::Iterator fieldIt; | 103 | KABC::Field::List::Iterator fieldIt; |
99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 104 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
@@ -201,112 +206,112 @@ KABC::AddresseeList XXPortSelectDialog::contacts() | |||
201 | uint pos = mFieldCombo->currentItem(); | 206 | uint pos = mFieldCombo->currentItem(); |
202 | if ( pos < mFields.count() ) | 207 | if ( pos < mFields.count() ) |
203 | list.sortByField( mFields[ pos ] ); | 208 | list.sortByField( mFields[ pos ] ); |
204 | } | 209 | } |
205 | 210 | ||
206 | return list; | 211 | return list; |
207 | } | 212 | } |
208 | 213 | ||
209 | QStringList XXPortSelectDialog::categories() const | 214 | QStringList XXPortSelectDialog::categories() const |
210 | { | 215 | { |
211 | QStringList list; | 216 | QStringList list; |
212 | 217 | ||
213 | QListViewItemIterator it( mCategoriesView ); | 218 | Q3ListViewItemIterator it( mCategoriesView ); |
214 | for ( ; it.current(); ++it ) { | 219 | for ( ; it.current(); ++it ) { |
215 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 220 | Q3CheckListItem* qcli = static_cast<Q3CheckListItem*>(it.current()); |
216 | if ( qcli->isOn() ) | 221 | if ( qcli->isOn() ) |
217 | list.append( it.current()->text( 0 ) ); | 222 | list.append( it.current()->text( 0 ) ); |
218 | } | 223 | } |
219 | 224 | ||
220 | return list; | 225 | return list; |
221 | } | 226 | } |
222 | 227 | ||
223 | void XXPortSelectDialog::filterChanged( int ) | 228 | void XXPortSelectDialog::filterChanged( int ) |
224 | { | 229 | { |
225 | mUseFilters->setChecked( true ); | 230 | mUseFilters->setChecked( true ); |
226 | } | 231 | } |
227 | 232 | ||
228 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 233 | void XXPortSelectDialog::categoryClicked( Q3ListViewItem *i ) |
229 | { | 234 | { |
230 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 235 | Q3CheckListItem *qcli = static_cast<Q3CheckListItem*>( i ); |
231 | if ( qcli->isOn() ) | 236 | if ( qcli->isOn() ) |
232 | mUseCategories->setChecked( true ); | 237 | mUseCategories->setChecked( true ); |
233 | } | 238 | } |
234 | 239 | ||
235 | void XXPortSelectDialog::slotHelp() | 240 | void XXPortSelectDialog::slotHelp() |
236 | { | 241 | { |
237 | #ifndef KAB_EMBEDDED | 242 | #ifndef KAB_EMBEDDED |
238 | kapp->invokeHelp( "import-and-export" ); | 243 | kapp->invokeHelp( "import-and-export" ); |
239 | #else //KAB_EMBEDDED | 244 | #else //KAB_EMBEDDED |
240 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 245 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
241 | #endif //KAB_EMBEDDED | 246 | #endif //KAB_EMBEDDED |
242 | 247 | ||
243 | } | 248 | } |
244 | 249 | ||
245 | void XXPortSelectDialog::initGUI() | 250 | void XXPortSelectDialog::initGUI() |
246 | { | 251 | { |
247 | QFrame *page = plainPage(); | 252 | Q3Frame *page = plainPage(); |
248 | 253 | ||
249 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(), | 254 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, KDialog::marginHintSmall(), |
250 | KDialog::spacingHintSmall() ); | 255 | KDialog::spacingHintSmall() ); |
251 | 256 | ||
252 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 257 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
253 | topLayout->addWidget( label ); | 258 | topLayout->addWidget( label ); |
254 | 259 | ||
255 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 260 | mButtonGroup = new Q3ButtonGroup( i18n( "Contact Selection" ), page ); |
256 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 261 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
257 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 262 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
258 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 263 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
259 | 264 | ||
260 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 265 | Q3GridLayout *groupLayout = new Q3GridLayout( mButtonGroup->layout() ); |
261 | groupLayout->setAlignment( Qt::AlignTop ); | 266 | groupLayout->setAlignment( Qt::AlignTop ); |
262 | 267 | ||
263 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 268 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
264 | mUseWholeBook->setChecked( true ); | 269 | mUseWholeBook->setChecked( true ); |
265 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 270 | Q3WhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
266 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 271 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
267 | 272 | ||
268 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 273 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
269 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 274 | Q3WhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
270 | "This option is disabled if no contacts are selected." ) ); | 275 | "This option is disabled if no contacts are selected." ) ); |
271 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 276 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
272 | 277 | ||
273 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 278 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
274 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 279 | Q3WhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
275 | "This option is disabled if you haven't defined any filters" ) ); | 280 | "This option is disabled if you haven't defined any filters" ) ); |
276 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 281 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
277 | 282 | ||
278 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 283 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
279 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 284 | Q3WhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
280 | "This option is disabled if you have no categories." ) ); | 285 | "This option is disabled if you have no categories." ) ); |
281 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 286 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
282 | 287 | ||
283 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 288 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
284 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 289 | mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
285 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 290 | Q3WhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
286 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 291 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
287 | 292 | ||
288 | mCategoriesView = new QListView( mButtonGroup ); | 293 | mCategoriesView = new Q3ListView( mButtonGroup ); |
289 | mCategoriesView->addColumn( "" ); | 294 | mCategoriesView->addColumn( "" ); |
290 | mCategoriesView->header()->hide(); | 295 | mCategoriesView->header()->hide(); |
291 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 296 | Q3WhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
292 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 297 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
293 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); | 298 | mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); |
294 | //if (QApplication::desktop()->height() == 480 ) | 299 | //if (QApplication::desktop()->height() == 480 ) |
295 | // mCategoriesView->setMaximumHeight( 240 ); | 300 | // mCategoriesView->setMaximumHeight( 240 ); |
296 | topLayout->addWidget( mButtonGroup ); | 301 | topLayout->addWidget( mButtonGroup ); |
297 | 302 | ||
298 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 303 | Q3ButtonGroup *sortingGroup = new Q3ButtonGroup( i18n( "Sorting" ), page ); |
299 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 304 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
300 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 305 | Q3GridLayout *sortLayout = new Q3GridLayout( sortingGroup->layout(), 2, 2, |
301 | KDialog::spacingHint() ); | 306 | KDialog::spacingHint() ); |
302 | sortLayout->setAlignment( Qt::AlignTop ); | 307 | sortLayout->setAlignment( Qt::AlignTop ); |
303 | 308 | ||
304 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 309 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
305 | sortLayout->addWidget( label, 0, 0 ); | 310 | sortLayout->addWidget( label, 0, 0 ); |
306 | 311 | ||
307 | #ifndef KAB_EMBEDDED | 312 | #ifndef KAB_EMBEDDED |
308 | mFieldCombo = new KComboBox( false, sortingGroup ); | 313 | mFieldCombo = new KComboBox( false, sortingGroup ); |
309 | #else //KAB_EMBEDDED | 314 | #else //KAB_EMBEDDED |
310 | //US Combobox is not editable anyway | 315 | //US Combobox is not editable anyway |
311 | mFieldCombo = new KComboBox( sortingGroup ); | 316 | mFieldCombo = new KComboBox( sortingGroup ); |
312 | #endif //KAB_EMBEDDED | 317 | #endif //KAB_EMBEDDED |
@@ -326,17 +331,15 @@ void XXPortSelectDialog::initGUI() | |||
326 | topLayout->addWidget( sortingGroup ); | 331 | topLayout->addWidget( sortingGroup ); |
327 | 332 | ||
328 | if ( !mUseSorting ) | 333 | if ( !mUseSorting ) |
329 | sortingGroup->hide(); | 334 | sortingGroup->hide(); |
330 | if (QApplication::desktop()->width() <= 640 ) { | 335 | if (QApplication::desktop()->width() <= 640 ) { |
331 | showMaximized(); | 336 | showMaximized(); |
332 | #ifndef DESKTOP_VERSION | 337 | #ifndef DESKTOP_VERSION |
333 | hideButtons(); | 338 | hideButtons(); |
334 | #endif | 339 | #endif |
335 | } | 340 | } |
336 | } | 341 | } |
337 | 342 | ||
338 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED_ |
339 | #include "xxportselectdialog.moc" | 344 | #include "moc_xxportselectdialog.cpp" |
340 | #endif //KAB_EMBEDDED | 345 | #endif //KAB_EMBEDDED |
341 | |||
342 | |||
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h index 28b1fef..208f4f9 100644 --- a/kaddressbook/xxportselectdialog.h +++ b/kaddressbook/xxportselectdialog.h | |||
@@ -21,63 +21,63 @@ | |||
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef XXPORTSELECTDIALOG_H | 24 | #ifndef XXPORTSELECTDIALOG_H |
25 | #define XXPORTSELECTDIALOG_H | 25 | #define XXPORTSELECTDIALOG_H |
26 | 26 | ||
27 | #include <kabc/addresseelist.h> | 27 | #include <kabc/addresseelist.h> |
28 | #include <kabc/field.h> | 28 | #include <kabc/field.h> |
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | 30 | ||
31 | #include "filter.h" | 31 | #include "filter.h" |
32 | 32 | ||
33 | class QButtonGroup; | 33 | class Q3ButtonGroup; |
34 | class QComboBox; | 34 | class QComboBox; |
35 | class QListView; | 35 | class Q3ListView; |
36 | class QListViewItem; | 36 | class Q3ListViewItem; |
37 | class QRadioButton; | 37 | class QRadioButton; |
38 | 38 | ||
39 | class KABCore; | 39 | class KABCore; |
40 | class KComboBox; | 40 | class KComboBox; |
41 | 41 | ||
42 | class XXPortSelectDialog : public KDialogBase | 42 | class XXPortSelectDialog : public KDialogBase |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, | 47 | XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, |
48 | const char* name = 0 ); | 48 | const char* name = 0 ); |
49 | 49 | ||
50 | KABC::AddresseeList contacts(); | 50 | KABC::AddresseeList contacts(); |
51 | void tagSelected(); | 51 | void tagSelected(); |
52 | QStringList uids(); | 52 | QStringList uids(); |
53 | 53 | ||
54 | private slots: | 54 | private slots: |
55 | void filterChanged( int ); | 55 | void filterChanged( int ); |
56 | void categoryClicked( QListViewItem * i ); | 56 | void categoryClicked( Q3ListViewItem * i ); |
57 | 57 | ||
58 | protected slots: | 58 | protected slots: |
59 | void slotHelp(); | 59 | void slotHelp(); |
60 | 60 | ||
61 | private: | 61 | private: |
62 | void initGUI(); | 62 | void initGUI(); |
63 | QStringList categories() const; | 63 | QStringList categories() const; |
64 | 64 | ||
65 | QButtonGroup* mButtonGroup; | 65 | Q3ButtonGroup* mButtonGroup; |
66 | QRadioButton* mUseCategories; | 66 | QRadioButton* mUseCategories; |
67 | QRadioButton* mUseFilters; | 67 | QRadioButton* mUseFilters; |
68 | QRadioButton* mUseWholeBook; | 68 | QRadioButton* mUseWholeBook; |
69 | QRadioButton* mUseSelection; | 69 | QRadioButton* mUseSelection; |
70 | QComboBox* mFiltersCombo; | 70 | QComboBox* mFiltersCombo; |
71 | QListView* mCategoriesView; | 71 | Q3ListView* mCategoriesView; |
72 | 72 | ||
73 | KComboBox *mFieldCombo; | 73 | KComboBox *mFieldCombo; |
74 | KComboBox *mSortTypeCombo; | 74 | KComboBox *mSortTypeCombo; |
75 | 75 | ||
76 | KABCore *mCore; | 76 | KABCore *mCore; |
77 | KABC::AddresseeList mAddresseeList; | 77 | KABC::AddresseeList mAddresseeList; |
78 | Filter::List mFilters; | 78 | Filter::List mFilters; |
79 | KABC::Field::List mFields; | 79 | KABC::Field::List mFields; |
80 | bool mUseSorting; | 80 | bool mUseSorting; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #endif | 83 | #endif |