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/features | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kaddressbook/features/distributionlistwidget.cpp | 39 | ||||
-rw-r--r-- | kaddressbook/features/distributionlistwidget.h | 13 | ||||
-rw-r--r-- | kaddressbook/features/mergewidget.cpp | 14 | ||||
-rw-r--r-- | kaddressbook/features/mergewidget.h | 2 |
4 files changed, 41 insertions, 27 deletions
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: |