-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 24 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 37 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 2 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 15 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 4 |
8 files changed, 65 insertions, 22 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index dd2121a..cd198c4 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -1,168 +1,174 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | 28 | ||
29 | #include <kdialog.h> | 29 | #include <kdialog.h> |
30 | #include <klineedit.h> | 30 | #include <klineedit.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
35 | 35 | ||
36 | #include "incsearchwidget.h" | 36 | #include "incsearchwidget.h" |
37 | 37 | ||
38 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | 38 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) |
39 | : QWidget( parent, name ) | 39 | : QWidget( parent, name ) |
40 | { | 40 | { |
41 | #ifndef KAB_EMBEDDED | 41 | #ifndef KAB_EMBEDDED |
42 | //US setCaption( i18n( "Incremental Search" ) ); | 42 | //US setCaption( i18n( "Incremental Search" ) ); |
43 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
44 | 44 | ||
45 | QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); | 45 | QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); |
46 | 46 | ||
47 | #ifdef DESKTOP_VERSION | 47 | #ifdef DESKTOP_VERSION |
48 | QLabel *label = new QLabel( i18n( "Search:" ), this ); | 48 | QLabel *label = new QLabel( i18n( "Search:" ), this ); |
49 | label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); | 49 | label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); |
50 | layout->addWidget( label ); | 50 | layout->addWidget( label ); |
51 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
52 | 52 | ||
53 | mSearchText = new KLineEdit( this ); | 53 | mSearchText = new KLineEdit( this ); |
54 | layout->addWidget( mSearchText ); | 54 | layout->addWidget( mSearchText ); |
55 | // #ifdef KAB_EMBEDDED | 55 | // #ifdef KAB_EMBEDDED |
56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) | 56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) |
57 | // mSearchText->setMaximumWidth(30); | 57 | // mSearchText->setMaximumWidth(30); |
58 | // #endif //KAB_EMBEDDED | 58 | // #endif //KAB_EMBEDDED |
59 | //mSearchText->setMaximumWidth(60); | 59 | //mSearchText->setMaximumWidth(60); |
60 | 60 | ||
61 | 61 | ||
62 | mFieldCombo = new QComboBox( false, this ); | 62 | mFieldCombo = new QComboBox( false, this ); |
63 | layout->addWidget( mFieldCombo ); | 63 | layout->addWidget( mFieldCombo ); |
64 | mFieldCombo->setMaximumHeight( 34 ); | 64 | mFieldCombo->setMaximumHeight( 34 ); |
65 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); | 65 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); |
66 | 66 | ||
67 | // #ifndef KAB_EMBEDDED | 67 | // #ifndef KAB_EMBEDDED |
68 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); | 68 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); |
69 | // #else //KAB_EMBEDDED | 69 | // #else //KAB_EMBEDDED |
70 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); | 70 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); |
71 | // #endif //KAB_EMBEDDED | 71 | // #endif //KAB_EMBEDDED |
72 | 72 | ||
73 | 73 | ||
74 | // for performance reasons, we do a search on the pda only after return is pressed | 74 | // for performance reasons, we do a search on the pda only after return is pressed |
75 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), | 75 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), |
76 | SLOT( announceDoSearch2() ) ); | 76 | SLOT( announceDoSearch2() ) ); |
77 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 77 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
78 | SLOT( announceDoSearch2() ) ); | 78 | SLOT( announceDoSearch2() ) ); |
79 | 79 | ||
80 | connect( mSearchText, SIGNAL( returnPressed() ), | 80 | connect( mSearchText, SIGNAL( returnPressed() ), |
81 | SLOT( announceDoSearch() ) ); | 81 | SLOT( announceDoSearch() ) ); |
82 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 82 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
83 | SLOT( announceFieldChanged() ) ); | 83 | SLOT( announceFieldChanged() ) ); |
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); | 87 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); |
88 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); | 88 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); |
89 | 89 | ||
90 | 90 | ||
91 | setFocusProxy( mSearchText ); | 91 | setFocusProxy( mSearchText ); |
92 | } | 92 | } |
93 | 93 | ||
94 | IncSearchWidget::~IncSearchWidget() | 94 | IncSearchWidget::~IncSearchWidget() |
95 | { | 95 | { |
96 | 96 | ||
97 | } | 97 | } |
98 | void IncSearchWidget::announceDoSearch2() | 98 | void IncSearchWidget::announceDoSearch2() |
99 | { | 99 | { |
100 | if ( KABPrefs::instance()->mSearchWithReturn ) | 100 | if ( KABPrefs::instance()->mSearchWithReturn ) |
101 | return; | 101 | return; |
102 | emit doSearch( mSearchText->text() ); | 102 | emit doSearch( mSearchText->text() ); |
103 | //qDebug("emit dosreach "); | 103 | //qDebug("emit dosreach "); |
104 | } | 104 | } |
105 | 105 | ||
106 | void IncSearchWidget::announceDoSearch() | 106 | void IncSearchWidget::announceDoSearch() |
107 | { | 107 | { |
108 | 108 | ||
109 | emit doSearch( mSearchText->text() ); | 109 | emit doSearch( mSearchText->text() ); |
110 | // qDebug("emit dosreach "); | 110 | // qDebug("emit dosreach "); |
111 | } | 111 | } |
112 | 112 | ||
113 | void IncSearchWidget::announceFieldChanged() | 113 | void IncSearchWidget::announceFieldChanged() |
114 | { | 114 | { |
115 | emit fieldChanged(); | 115 | emit fieldChanged(); |
116 | } | 116 | } |
117 | 117 | void IncSearchWidget::setSize() | |
118 | { | ||
119 | if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { | ||
120 | mFieldCombo->setMaximumWidth( 40 ); | ||
121 | mSearchText->setMaximumWidth( 30 ); | ||
122 | } else { | ||
123 | QFontMetrics fm ( mFieldCombo->font() ); | ||
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | mFieldCombo->setMaximumWidth( wid+60 ); | ||
127 | mSearchText->setMaximumWidth( 1024 ); | ||
128 | } | ||
129 | } | ||
118 | void IncSearchWidget::setFields( const KABC::Field::List &list ) | 130 | void IncSearchWidget::setFields( const KABC::Field::List &list ) |
119 | { | 131 | { |
120 | 132 | ||
121 | mFieldCombo->clear(); | 133 | mFieldCombo->clear(); |
122 | mFieldCombo->insertItem( i18n( "All Fields" ) ); | 134 | mFieldCombo->insertItem( i18n( "All Fields" ) ); |
123 | QFontMetrics fm ( mFieldCombo->font() ); | 135 | |
124 | int wid = fm.width(i18n( "All Fields" ) ); | ||
125 | int max = wid; | ||
126 | |||
127 | KABC::Field::List::ConstIterator it; | 136 | KABC::Field::List::ConstIterator it; |
128 | for ( it = list.begin(); it != list.end(); ++it ) { | 137 | for ( it = list.begin(); it != list.end(); ++it ) { |
129 | mFieldCombo->insertItem( (*it)->label() ); | 138 | mFieldCombo->insertItem( (*it)->label() ); |
130 | // wid = fm.width((*it)->label() ); | ||
131 | //if ( wid > max ) | ||
132 | // max = wid; | ||
133 | } | 139 | } |
134 | 140 | ||
135 | mFieldList = list; | 141 | mFieldList = list; |
136 | 142 | ||
137 | announceDoSearch(); | 143 | announceDoSearch(); |
138 | announceFieldChanged(); | 144 | announceFieldChanged(); |
139 | mFieldCombo->setMaximumWidth( wid+60 ); | 145 | setSize(); |
140 | } | 146 | } |
141 | 147 | ||
142 | KABC::Field::List IncSearchWidget::fields() const | 148 | KABC::Field::List IncSearchWidget::fields() const |
143 | { | 149 | { |
144 | return mFieldList; | 150 | return mFieldList; |
145 | } | 151 | } |
146 | 152 | ||
147 | KABC::Field *IncSearchWidget::currentField()const | 153 | KABC::Field *IncSearchWidget::currentField()const |
148 | { | 154 | { |
149 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) | 155 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) |
150 | return 0; // for error or 'use all fields' | 156 | return 0; // for error or 'use all fields' |
151 | else | 157 | else |
152 | return mFieldList[ mFieldCombo->currentItem() - 1 ]; | 158 | return mFieldList[ mFieldCombo->currentItem() - 1 ]; |
153 | } | 159 | } |
154 | 160 | ||
155 | void IncSearchWidget::setCurrentItem( int pos ) | 161 | void IncSearchWidget::setCurrentItem( int pos ) |
156 | { | 162 | { |
157 | mFieldCombo->setCurrentItem( pos ); | 163 | mFieldCombo->setCurrentItem( pos ); |
158 | announceFieldChanged(); | 164 | announceFieldChanged(); |
159 | } | 165 | } |
160 | 166 | ||
161 | int IncSearchWidget::currentItem() const | 167 | int IncSearchWidget::currentItem() const |
162 | { | 168 | { |
163 | 169 | ||
164 | return mFieldCombo->currentItem(); | 170 | return mFieldCombo->currentItem(); |
165 | } | 171 | } |
166 | #ifndef KAB_EMBEDDED | 172 | #ifndef KAB_EMBEDDED |
167 | #include "incsearchwidget.moc" | 173 | #include "incsearchwidget.moc" |
168 | #endif //KAB_EMBEDDED | 174 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 1546a51..cae55cd 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h | |||
@@ -1,76 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 INCSEARCHWIDGET_H | 24 | #ifndef INCSEARCHWIDGET_H |
25 | #define INCSEARCHWIDGET_H | 25 | #define INCSEARCHWIDGET_H |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | 28 | ||
29 | #include <kabc/field.h> | 29 | #include <kabc/field.h> |
30 | 30 | ||
31 | class QComboBox; | 31 | class QComboBox; |
32 | class KLineEdit; | 32 | class KLineEdit; |
33 | 33 | ||
34 | class IncSearchWidget : public QWidget | 34 | class IncSearchWidget : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | IncSearchWidget( QWidget *parent, const char *name = 0 ); | 39 | IncSearchWidget( QWidget *parent, const char *name = 0 ); |
40 | ~IncSearchWidget(); | 40 | ~IncSearchWidget(); |
41 | 41 | ||
42 | void setFields( const KABC::Field::List &list ); | 42 | void setFields( const KABC::Field::List &list ); |
43 | KABC::Field::List fields() const; | 43 | KABC::Field::List fields() const; |
44 | 44 | ||
45 | KABC::Field *currentField() const; | 45 | KABC::Field *currentField() const; |
46 | 46 | ||
47 | void setCurrentItem( int pos ); | 47 | void setCurrentItem( int pos ); |
48 | int currentItem() const; | 48 | int currentItem() const; |
49 | void setSize(); | ||
49 | 50 | ||
50 | signals: | 51 | signals: |
51 | void scrollUP(); | 52 | void scrollUP(); |
52 | void scrollDOWN(); | 53 | void scrollDOWN(); |
53 | /** | 54 | /** |
54 | This signal is emmited whenever the text in the input | 55 | This signal is emmited whenever the text in the input |
55 | widget is changed. You can get the sorting field by | 56 | widget is changed. You can get the sorting field by |
56 | @ref currentField. | 57 | @ref currentField. |
57 | */ | 58 | */ |
58 | void doSearch( const QString& text ); | 59 | void doSearch( const QString& text ); |
59 | 60 | ||
60 | /** | 61 | /** |
61 | This signal is emmited whenever the search field changes. | 62 | This signal is emmited whenever the search field changes. |
62 | */ | 63 | */ |
63 | void fieldChanged(); | 64 | void fieldChanged(); |
64 | 65 | ||
65 | private slots: | 66 | private slots: |
66 | void announceDoSearch(); | 67 | void announceDoSearch(); |
67 | void announceDoSearch2(); | 68 | void announceDoSearch2(); |
68 | void announceFieldChanged(); | 69 | void announceFieldChanged(); |
69 | 70 | ||
70 | private: | 71 | private: |
71 | QComboBox* mFieldCombo; | 72 | QComboBox* mFieldCombo; |
72 | KLineEdit* mSearchText; | 73 | KLineEdit* mSearchText; |
73 | KABC::Field::List mFieldList; | 74 | KABC::Field::List mFieldList; |
74 | }; | 75 | }; |
75 | 76 | ||
76 | #endif | 77 | #endif |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 59aa5a5..09d8523 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,2692 +1,2707 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | Async a special exception, permission is given to link this program | 19 | Async 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 | /*s | 24 | /*s |
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 "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 <qprogressbar.h> |
43 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qvbox.h> | 53 | #include <qvbox.h> |
54 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 58 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 61 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 65 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
73 | 73 | ||
74 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
82 | 82 | ||
83 | #include <kapplication.h> | 83 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 118 | #include "xxportselectdialog.h" |
119 | 119 | ||
120 | 120 | ||
121 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
123 | 123 | ||
124 | #include <picture.h> | 124 | #include <picture.h> |
125 | #include <resource.h> | 125 | #include <resource.h> |
126 | 126 | ||
127 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 128 | #include <qmap.h> |
129 | #include <qdir.h> | 129 | #include <qdir.h> |
130 | #include <qfile.h> | 130 | #include <qfile.h> |
131 | #include <qvbox.h> | 131 | #include <qvbox.h> |
132 | #include <qlayout.h> | 132 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
137 | 137 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
141 | 141 | ||
142 | 142 | ||
143 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 144 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 151 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 152 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 153 | #include "addresseeconfig.h" |
154 | #include "nameeditdialog.h" | 154 | #include "nameeditdialog.h" |
155 | #include <kcmultidialog.h> | 155 | #include <kcmultidialog.h> |
156 | 156 | ||
157 | #ifdef _WIN32_ | 157 | #ifdef _WIN32_ |
158 | #ifdef _OL_IMPORT_ | 158 | #ifdef _OL_IMPORT_ |
159 | #include "kaimportoldialog.h" | 159 | #include "kaimportoldialog.h" |
160 | #endif | 160 | #endif |
161 | #else | 161 | #else |
162 | #include <unistd.h> | 162 | #include <unistd.h> |
163 | #endif | 163 | #endif |
164 | // sync includes | 164 | // sync includes |
165 | #include <libkdepim/ksyncprofile.h> | 165 | #include <libkdepim/ksyncprofile.h> |
166 | #include <libkdepim/ksyncprefsdialog.h> | 166 | #include <libkdepim/ksyncprefsdialog.h> |
167 | 167 | ||
168 | 168 | ||
169 | class KABCatPrefs : public QDialog | 169 | class KABCatPrefs : public QDialog |
170 | { | 170 | { |
171 | public: | 171 | public: |
172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | 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 ); | 179 | 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 ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 185 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | class KABFormatPrefs : public QDialog | 201 | class KABFormatPrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Set formatted name") ); | 207 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 212 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 214 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 215 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 219 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 220 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 222 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 224 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 226 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 229 | //resize( 200, 200 ); |
230 | 230 | ||
231 | } | 231 | } |
232 | public: | 232 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 233 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 234 | QCheckBox* setCompany; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | class KAex2phonePrefs : public QDialog | 239 | class KAex2phonePrefs : public QDialog |
240 | { | 240 | { |
241 | public: | 241 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 243 | QDialog( parent, name, true ) |
244 | { | 244 | { |
245 | setCaption( i18n("Export to phone options") ); | 245 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 246 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 247 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 248 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 249 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 251 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 252 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 253 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 256 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 257 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 258 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 259 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 260 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 261 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 262 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 263 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 264 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 266 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 268 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 270 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 272 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 275 | resize( 220, 240 ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | public: | 279 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 281 | QCheckBox* mWriteToSim; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | 284 | ||
285 | bool pasteWithNewUid = true; | 285 | bool pasteWithNewUid = true; |
286 | 286 | ||
287 | #ifdef KAB_EMBEDDED | 287 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 296 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | ||
301 | mMiniSplitter = 0; | 302 | mMiniSplitter = 0; |
302 | mExtensionBarSplitter = 0; | 303 | mExtensionBarSplitter = 0; |
303 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 304 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
304 | mAddressBook = KABC::StdAddressBook::self(); | 305 | mAddressBook = KABC::StdAddressBook::self(); |
305 | KABC::StdAddressBook::setAutomaticSave( false ); | 306 | KABC::StdAddressBook::setAutomaticSave( false ); |
306 | 307 | ||
307 | #ifndef KAB_EMBEDDED | 308 | #ifndef KAB_EMBEDDED |
308 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
309 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
310 | 311 | ||
311 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
312 | SLOT( addressBookChanged() ) ); | 313 | SLOT( addressBookChanged() ) ); |
313 | 314 | ||
314 | #if 0 | 315 | #if 0 |
315 | // LP moved to addressbook init method | 316 | // LP moved to addressbook init method |
316 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
317 | "X-Department", "KADDRESSBOOK" ); | 318 | "X-Department", "KADDRESSBOOK" ); |
318 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
319 | "X-Profession", "KADDRESSBOOK" ); | 320 | "X-Profession", "KADDRESSBOOK" ); |
320 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
321 | "X-AssistantsName", "KADDRESSBOOK" ); | 322 | "X-AssistantsName", "KADDRESSBOOK" ); |
322 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
323 | "X-ManagersName", "KADDRESSBOOK" ); | 324 | "X-ManagersName", "KADDRESSBOOK" ); |
324 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
325 | "X-SpousesName", "KADDRESSBOOK" ); | 326 | "X-SpousesName", "KADDRESSBOOK" ); |
326 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
327 | "X-Office", "KADDRESSBOOK" ); | 328 | "X-Office", "KADDRESSBOOK" ); |
328 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
329 | "X-IMAddress", "KADDRESSBOOK" ); | 330 | "X-IMAddress", "KADDRESSBOOK" ); |
330 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
331 | "X-Anniversary", "KADDRESSBOOK" ); | 332 | "X-Anniversary", "KADDRESSBOOK" ); |
332 | 333 | ||
333 | //US added this field to become compatible with Opie/qtopia addressbook | 334 | //US added this field to become compatible with Opie/qtopia addressbook |
334 | // values can be "female" or "male" or "". An empty field represents undefined. | 335 | // values can be "female" or "male" or "". An empty field represents undefined. |
335 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
336 | "X-Gender", "KADDRESSBOOK" ); | 337 | "X-Gender", "KADDRESSBOOK" ); |
337 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
338 | "X-Children", "KADDRESSBOOK" ); | 339 | "X-Children", "KADDRESSBOOK" ); |
339 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
340 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
341 | #endif | 342 | #endif |
342 | initGUI(); | 343 | initGUI(); |
343 | 344 | ||
344 | mIncSearchWidget->setFocus(); | 345 | mIncSearchWidget->setFocus(); |
345 | 346 | ||
346 | 347 | ||
347 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
348 | SLOT( setContactSelected( const QString& ) ) ); | 349 | SLOT( setContactSelected( const QString& ) ) ); |
349 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
350 | SLOT( executeContact( const QString& ) ) ); | 351 | SLOT( executeContact( const QString& ) ) ); |
351 | 352 | ||
352 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
353 | SLOT( deleteContacts( ) ) ); | 354 | SLOT( deleteContacts( ) ) ); |
354 | connect( mViewManager, SIGNAL( modified() ), | 355 | connect( mViewManager, SIGNAL( modified() ), |
355 | SLOT( setModified() ) ); | 356 | SLOT( setModified() ) ); |
356 | 357 | ||
357 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
358 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
359 | 360 | ||
360 | connect( mXXPortManager, SIGNAL( modified() ), | 361 | connect( mXXPortManager, SIGNAL( modified() ), |
361 | SLOT( setModified() ) ); | 362 | SLOT( setModified() ) ); |
362 | 363 | ||
363 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
364 | SLOT( incrementalSearch( const QString& ) ) ); | 365 | SLOT( incrementalSearch( const QString& ) ) ); |
365 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
366 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 367 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
367 | 368 | ||
368 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
369 | SLOT( sendMail( const QString& ) ) ); | 370 | SLOT( sendMail( const QString& ) ) ); |
370 | 371 | ||
371 | 372 | ||
372 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
376 | 377 | ||
377 | 378 | ||
378 | #ifndef KAB_EMBEDDED | 379 | #ifndef KAB_EMBEDDED |
379 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 380 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
380 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 381 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
381 | 382 | ||
382 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 383 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
383 | SLOT( browse( const QString& ) ) ); | 384 | SLOT( browse( const QString& ) ) ); |
384 | 385 | ||
385 | 386 | ||
386 | mAddressBookService = new KAddressBookService( this ); | 387 | mAddressBookService = new KAddressBookService( this ); |
387 | 388 | ||
388 | #endif //KAB_EMBEDDED | 389 | #endif //KAB_EMBEDDED |
389 | 390 | ||
390 | mMessageTimer = new QTimer( this ); | 391 | mMessageTimer = new QTimer( this ); |
391 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 392 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
392 | mEditorDialog = 0; | 393 | mEditorDialog = 0; |
393 | createAddresseeEditorDialog( this ); | 394 | createAddresseeEditorDialog( this ); |
394 | setModified( false ); | 395 | setModified( false ); |
395 | mBRdisabled = false; | 396 | mBRdisabled = false; |
396 | #ifndef DESKTOP_VERSION | 397 | #ifndef DESKTOP_VERSION |
397 | infrared = 0; | 398 | infrared = 0; |
398 | #endif | 399 | #endif |
399 | //toggleBeamReceive( ); | 400 | //toggleBeamReceive( ); |
400 | //mMainWindow->toolBar()->show(); | 401 | //mMainWindow->toolBar()->show(); |
401 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 402 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
402 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 403 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
403 | } | 404 | } |
404 | 405 | ||
405 | void KABCore::updateToolBar() | 406 | void KABCore::updateToolBar() |
406 | { | 407 | { |
407 | static int iii = 0; | 408 | static int iii = 0; |
408 | ++iii; | 409 | ++iii; |
409 | mMainWindow->toolBar()->repaintMe(); | 410 | mMainWindow->toolBar()->repaintMe(); |
410 | if ( iii < 4 ) | 411 | if ( iii < 4 ) |
411 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 412 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
412 | } | 413 | } |
413 | KABCore::~KABCore() | 414 | KABCore::~KABCore() |
414 | { | 415 | { |
415 | // save(); | 416 | // save(); |
416 | //saveSettings(); | 417 | //saveSettings(); |
417 | //KABPrefs::instance()->writeConfig(); | 418 | //KABPrefs::instance()->writeConfig(); |
418 | delete AddresseeConfig::instance(); | 419 | delete AddresseeConfig::instance(); |
419 | mAddressBook = 0; | 420 | mAddressBook = 0; |
420 | KABC::StdAddressBook::close(); | 421 | KABC::StdAddressBook::close(); |
421 | 422 | ||
422 | delete syncManager; | 423 | delete syncManager; |
423 | #ifndef DESKTOP_VERSION | 424 | #ifndef DESKTOP_VERSION |
424 | if ( infrared ) | 425 | if ( infrared ) |
425 | delete infrared; | 426 | delete infrared; |
426 | #endif | 427 | #endif |
427 | } | 428 | } |
428 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 429 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
429 | { | 430 | { |
430 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 431 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
431 | if ( cmsg == "setDocument(QString)" ) { | 432 | if ( cmsg == "setDocument(QString)" ) { |
432 | QDataStream stream( data, IO_ReadOnly ); | 433 | QDataStream stream( data, IO_ReadOnly ); |
433 | QString fileName; | 434 | QString fileName; |
434 | stream >> fileName; | 435 | stream >> fileName; |
435 | recieve( fileName ); | 436 | recieve( fileName ); |
436 | return; | 437 | return; |
437 | } | 438 | } |
438 | } | 439 | } |
439 | void KABCore::toggleBeamReceive( ) | 440 | void KABCore::toggleBeamReceive( ) |
440 | { | 441 | { |
441 | if ( mBRdisabled ) | 442 | if ( mBRdisabled ) |
442 | return; | 443 | return; |
443 | #ifndef DESKTOP_VERSION | 444 | #ifndef DESKTOP_VERSION |
444 | if ( infrared ) { | 445 | if ( infrared ) { |
445 | qDebug("KA: AB disable BeamReceive "); | 446 | qDebug("KA: AB disable BeamReceive "); |
446 | delete infrared; | 447 | delete infrared; |
447 | infrared = 0; | 448 | infrared = 0; |
448 | mActionBR->setChecked(false); | 449 | mActionBR->setChecked(false); |
449 | return; | 450 | return; |
450 | } | 451 | } |
451 | qDebug("KA: AB enable BeamReceive "); | 452 | qDebug("KA: AB enable BeamReceive "); |
452 | mActionBR->setChecked(true); | 453 | mActionBR->setChecked(true); |
453 | 454 | ||
454 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 455 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
455 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 456 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
456 | #endif | 457 | #endif |
457 | } | 458 | } |
458 | 459 | ||
459 | 460 | ||
460 | void KABCore::disableBR(bool b) | 461 | void KABCore::disableBR(bool b) |
461 | { | 462 | { |
462 | #ifndef DESKTOP_VERSION | 463 | #ifndef DESKTOP_VERSION |
463 | if ( b ) { | 464 | if ( b ) { |
464 | if ( infrared ) { | 465 | if ( infrared ) { |
465 | toggleBeamReceive( ); | 466 | toggleBeamReceive( ); |
466 | } | 467 | } |
467 | mBRdisabled = true; | 468 | mBRdisabled = true; |
468 | } else { | 469 | } else { |
469 | if ( mBRdisabled ) { | 470 | if ( mBRdisabled ) { |
470 | mBRdisabled = false; | 471 | mBRdisabled = false; |
471 | //toggleBeamReceive( ); | 472 | //toggleBeamReceive( ); |
472 | } | 473 | } |
473 | } | 474 | } |
474 | #endif | 475 | #endif |
475 | 476 | ||
476 | } | 477 | } |
477 | void KABCore::recieve( QString fn ) | 478 | void KABCore::recieve( QString fn ) |
478 | { | 479 | { |
479 | //qDebug("KABCore::recieve "); | 480 | //qDebug("KABCore::recieve "); |
480 | int count = mAddressBook->importFromFile( fn, true ); | 481 | int count = mAddressBook->importFromFile( fn, true ); |
481 | if ( count ) | 482 | if ( count ) |
482 | setModified( true ); | 483 | setModified( true ); |
483 | mViewManager->refreshView(); | 484 | mViewManager->refreshView(); |
484 | message(i18n("%1 contact(s) received!").arg( count )); | 485 | message(i18n("%1 contact(s) received!").arg( count )); |
485 | topLevelWidget()->showMaximized(); | 486 | topLevelWidget()->showMaximized(); |
486 | topLevelWidget()->raise(); | 487 | topLevelWidget()->raise(); |
487 | } | 488 | } |
488 | void KABCore::restoreSettings() | 489 | void KABCore::restoreSettings() |
489 | { | 490 | { |
490 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 491 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
491 | 492 | ||
492 | bool state; | 493 | bool state; |
493 | 494 | ||
494 | if (mMultipleViewsAtOnce) | 495 | if (mMultipleViewsAtOnce) |
495 | state = KABPrefs::instance()->mDetailsPageVisible; | 496 | state = KABPrefs::instance()->mDetailsPageVisible; |
496 | else | 497 | else |
497 | state = false; | 498 | state = false; |
498 | 499 | ||
499 | mActionDetails->setChecked( state ); | 500 | mActionDetails->setChecked( state ); |
500 | setDetailsVisible( state ); | 501 | setDetailsVisible( state ); |
501 | 502 | ||
502 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 503 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
503 | 504 | ||
504 | mActionJumpBar->setChecked( state ); | 505 | mActionJumpBar->setChecked( state ); |
505 | setJumpButtonBarVisible( state ); | 506 | setJumpButtonBarVisible( state ); |
506 | /*US | 507 | /*US |
507 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 508 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
508 | if ( splitterSize.count() == 0 ) { | 509 | if ( splitterSize.count() == 0 ) { |
509 | splitterSize.append( width() / 2 ); | 510 | splitterSize.append( width() / 2 ); |
510 | splitterSize.append( width() / 2 ); | 511 | splitterSize.append( width() / 2 ); |
511 | } | 512 | } |
512 | mMiniSplitter->setSizes( splitterSize ); | 513 | mMiniSplitter->setSizes( splitterSize ); |
513 | if ( mExtensionBarSplitter ) { | 514 | if ( mExtensionBarSplitter ) { |
514 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 515 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
515 | if ( splitterSize.count() == 0 ) { | 516 | if ( splitterSize.count() == 0 ) { |
516 | splitterSize.append( width() / 2 ); | 517 | splitterSize.append( width() / 2 ); |
517 | splitterSize.append( width() / 2 ); | 518 | splitterSize.append( width() / 2 ); |
518 | } | 519 | } |
519 | mExtensionBarSplitter->setSizes( splitterSize ); | 520 | mExtensionBarSplitter->setSizes( splitterSize ); |
520 | 521 | ||
521 | } | 522 | } |
522 | */ | 523 | */ |
523 | mViewManager->restoreSettings(); | 524 | mViewManager->restoreSettings(); |
524 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 525 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
525 | mExtensionManager->restoreSettings(); | 526 | mExtensionManager->restoreSettings(); |
526 | #ifdef DESKTOP_VERSION | 527 | #ifdef DESKTOP_VERSION |
527 | int wid = width(); | 528 | int wid = width(); |
528 | if ( wid < 10 ) | 529 | if ( wid < 10 ) |
529 | wid = 400; | 530 | wid = 400; |
530 | #else | 531 | #else |
531 | int wid = QApplication::desktop()->width(); | 532 | int wid = QApplication::desktop()->width(); |
532 | if ( wid < 640 ) | 533 | if ( wid < 640 ) |
533 | wid = QApplication::desktop()->height(); | 534 | wid = QApplication::desktop()->height(); |
534 | #endif | 535 | #endif |
535 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 536 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
536 | if ( true /*splitterSize.count() == 0*/ ) { | 537 | if ( true /*splitterSize.count() == 0*/ ) { |
537 | splitterSize.append( wid / 2 ); | 538 | splitterSize.append( wid / 2 ); |
538 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
539 | } | 540 | } |
540 | mMiniSplitter->setSizes( splitterSize ); | 541 | mMiniSplitter->setSizes( splitterSize ); |
541 | if ( mExtensionBarSplitter ) { | 542 | if ( mExtensionBarSplitter ) { |
542 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 543 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
543 | if ( true /*splitterSize.count() == 0*/ ) { | 544 | if ( true /*splitterSize.count() == 0*/ ) { |
544 | splitterSize.append( wid / 2 ); | 545 | splitterSize.append( wid / 2 ); |
545 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
546 | } | 547 | } |
547 | mExtensionBarSplitter->setSizes( splitterSize ); | 548 | mExtensionBarSplitter->setSizes( splitterSize ); |
548 | 549 | ||
549 | } | 550 | } |
550 | 551 | ||
551 | 552 | ||
552 | } | 553 | } |
553 | 554 | ||
554 | void KABCore::saveSettings() | 555 | void KABCore::saveSettings() |
555 | { | 556 | { |
556 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 557 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
557 | if ( mExtensionBarSplitter ) | 558 | if ( mExtensionBarSplitter ) |
558 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 559 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
559 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 560 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
560 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 561 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
561 | #ifndef KAB_EMBEDDED | 562 | #ifndef KAB_EMBEDDED |
562 | 563 | ||
563 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 564 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
564 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 565 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
565 | #endif //KAB_EMBEDDED | 566 | #endif //KAB_EMBEDDED |
566 | mExtensionManager->saveSettings(); | 567 | mExtensionManager->saveSettings(); |
567 | mViewManager->saveSettings(); | 568 | mViewManager->saveSettings(); |
568 | 569 | ||
569 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 570 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
570 | KABPrefs::instance()->writeConfig(); | 571 | KABPrefs::instance()->writeConfig(); |
571 | qDebug("KA: KABCore::saveSettings() "); | 572 | qDebug("KA: KABCore::saveSettings() "); |
572 | } | 573 | } |
573 | 574 | ||
574 | KABC::AddressBook *KABCore::addressBook() const | 575 | KABC::AddressBook *KABCore::addressBook() const |
575 | { | 576 | { |
576 | return mAddressBook; | 577 | return mAddressBook; |
577 | } | 578 | } |
578 | 579 | ||
579 | KConfig *KABCore::config() | 580 | KConfig *KABCore::config() |
580 | { | 581 | { |
581 | #ifndef KAB_EMBEDDED | 582 | #ifndef KAB_EMBEDDED |
582 | return KABPrefs::instance()->config(); | 583 | return KABPrefs::instance()->config(); |
583 | #else //KAB_EMBEDDED | 584 | #else //KAB_EMBEDDED |
584 | return KABPrefs::instance()->getConfig(); | 585 | return KABPrefs::instance()->getConfig(); |
585 | #endif //KAB_EMBEDDED | 586 | #endif //KAB_EMBEDDED |
586 | } | 587 | } |
587 | 588 | ||
588 | KActionCollection *KABCore::actionCollection() const | 589 | KActionCollection *KABCore::actionCollection() const |
589 | { | 590 | { |
590 | return mGUIClient->actionCollection(); | 591 | return mGUIClient->actionCollection(); |
591 | } | 592 | } |
592 | 593 | ||
593 | KABC::Field *KABCore::currentSearchField() const | 594 | KABC::Field *KABCore::currentSearchField() const |
594 | { | 595 | { |
595 | if (mIncSearchWidget) | 596 | if (mIncSearchWidget) |
596 | return mIncSearchWidget->currentField(); | 597 | return mIncSearchWidget->currentField(); |
597 | else | 598 | else |
598 | return 0; | 599 | return 0; |
599 | } | 600 | } |
600 | 601 | ||
601 | QStringList KABCore::selectedUIDs() const | 602 | QStringList KABCore::selectedUIDs() const |
602 | { | 603 | { |
603 | return mViewManager->selectedUids(); | 604 | return mViewManager->selectedUids(); |
604 | } | 605 | } |
605 | 606 | ||
606 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 607 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
607 | { | 608 | { |
608 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 609 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
609 | 610 | ||
610 | QPtrList<KRES::Resource> kresResources; | 611 | QPtrList<KRES::Resource> kresResources; |
611 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 612 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
612 | KABC::Resource *resource; | 613 | KABC::Resource *resource; |
613 | while ( ( resource = resIt.current() ) != 0 ) { | 614 | while ( ( resource = resIt.current() ) != 0 ) { |
614 | ++resIt; | 615 | ++resIt; |
615 | if ( !resource->readOnly() ) { | 616 | if ( !resource->readOnly() ) { |
616 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 617 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
617 | if ( res ) | 618 | if ( res ) |
618 | kresResources.append( res ); | 619 | kresResources.append( res ); |
619 | } | 620 | } |
620 | } | 621 | } |
621 | 622 | ||
622 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 623 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
623 | return static_cast<KABC::Resource*>( res ); | 624 | return static_cast<KABC::Resource*>( res ); |
624 | } | 625 | } |
625 | 626 | ||
626 | #ifndef KAB_EMBEDDED | 627 | #ifndef KAB_EMBEDDED |
627 | KAboutData *KABCore::createAboutData() | 628 | KAboutData *KABCore::createAboutData() |
628 | #else //KAB_EMBEDDED | 629 | #else //KAB_EMBEDDED |
629 | void KABCore::createAboutData() | 630 | void KABCore::createAboutData() |
630 | #endif //KAB_EMBEDDED | 631 | #endif //KAB_EMBEDDED |
631 | { | 632 | { |
632 | #ifndef KAB_EMBEDDED | 633 | #ifndef KAB_EMBEDDED |
633 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 634 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
634 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 635 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
635 | KAboutData::License_GPL_V2, | 636 | KAboutData::License_GPL_V2, |
636 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 637 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
637 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 638 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
638 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 639 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
639 | about->addAuthor( "Cornelius Schumacher", | 640 | about->addAuthor( "Cornelius Schumacher", |
640 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 641 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
641 | "schumacher@kde.org" ); | 642 | "schumacher@kde.org" ); |
642 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 643 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
643 | "mpilone@slac.com" ); | 644 | "mpilone@slac.com" ); |
644 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 645 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
645 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 646 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
646 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 647 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
647 | "michel@klaralvdalens-datakonsult.se" ); | 648 | "michel@klaralvdalens-datakonsult.se" ); |
648 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 649 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
649 | "hansen@kde.org" ); | 650 | "hansen@kde.org" ); |
650 | 651 | ||
651 | return about; | 652 | return about; |
652 | #endif //KAB_EMBEDDED | 653 | #endif //KAB_EMBEDDED |
653 | 654 | ||
654 | QString version; | 655 | QString version; |
655 | #include <../version> | 656 | #include <../version> |
656 | QMessageBox::about( this, "About KAddressbook/Pi", | 657 | QMessageBox::about( this, "About KAddressbook/Pi", |
657 | "KAddressbook/Platform-independent\n" | 658 | "KAddressbook/Platform-independent\n" |
658 | "(KA/Pi) " +version + " - " + | 659 | "(KA/Pi) " +version + " - " + |
659 | #ifdef DESKTOP_VERSION | 660 | #ifdef DESKTOP_VERSION |
660 | "Desktop Edition\n" | 661 | "Desktop Edition\n" |
661 | #else | 662 | #else |
662 | "PDA-Edition\n" | 663 | "PDA-Edition\n" |
663 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 664 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
664 | #endif | 665 | #endif |
665 | 666 | ||
666 | "(c) 2004 Ulf Schenk\n" | 667 | "(c) 2004 Ulf Schenk\n" |
667 | "(c) 2004 Lutz Rogowski\n" | 668 | "(c) 2004 Lutz Rogowski\n" |
668 | "(c) 1997-2003, The KDE PIM Team\n" | 669 | "(c) 1997-2003, The KDE PIM Team\n" |
669 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 670 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
670 | "Don Sanders Original author\n" | 671 | "Don Sanders Original author\n" |
671 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 672 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
672 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 673 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
673 | "Greg Stern DCOP interface\n" | 674 | "Greg Stern DCOP interface\n" |
674 | "Mark Westcot Contact pinning\n" | 675 | "Mark Westcot Contact pinning\n" |
675 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 676 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
676 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 677 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
677 | #ifdef _WIN32_ | 678 | #ifdef _WIN32_ |
678 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 679 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
679 | #endif | 680 | #endif |
680 | ); | 681 | ); |
681 | } | 682 | } |
682 | 683 | ||
683 | void KABCore::setContactSelected( const QString &uid ) | 684 | void KABCore::setContactSelected( const QString &uid ) |
684 | { | 685 | { |
685 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 686 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
686 | if ( !mDetails->isHidden() ) | 687 | if ( !mDetails->isHidden() ) |
687 | mDetails->setAddressee( addr ); | 688 | mDetails->setAddressee( addr ); |
688 | 689 | ||
689 | if ( !addr.isEmpty() ) { | 690 | if ( !addr.isEmpty() ) { |
690 | emit contactSelected( addr.formattedName() ); | 691 | emit contactSelected( addr.formattedName() ); |
691 | KABC::Picture pic = addr.photo(); | 692 | KABC::Picture pic = addr.photo(); |
692 | if ( pic.isIntern() ) { | 693 | if ( pic.isIntern() ) { |
693 | //US emit contactSelected( pic.data() ); | 694 | //US emit contactSelected( pic.data() ); |
694 | //US instead use: | 695 | //US instead use: |
695 | QPixmap px; | 696 | QPixmap px; |
696 | if (pic.data().isNull() != true) | 697 | if (pic.data().isNull() != true) |
697 | { | 698 | { |
698 | px.convertFromImage(pic.data()); | 699 | px.convertFromImage(pic.data()); |
699 | } | 700 | } |
700 | 701 | ||
701 | emit contactSelected( px ); | 702 | emit contactSelected( px ); |
702 | } | 703 | } |
703 | } | 704 | } |
704 | 705 | ||
705 | 706 | ||
706 | mExtensionManager->setSelectionChanged(); | 707 | mExtensionManager->setSelectionChanged(); |
707 | 708 | ||
708 | // update the actions | 709 | // update the actions |
709 | bool selected = !uid.isEmpty(); | 710 | bool selected = !uid.isEmpty(); |
710 | 711 | ||
711 | if ( mReadWrite ) { | 712 | if ( mReadWrite ) { |
712 | mActionCut->setEnabled( selected ); | 713 | mActionCut->setEnabled( selected ); |
713 | mActionPaste->setEnabled( selected ); | 714 | mActionPaste->setEnabled( selected ); |
714 | } | 715 | } |
715 | 716 | ||
716 | mActionCopy->setEnabled( selected ); | 717 | mActionCopy->setEnabled( selected ); |
717 | mActionDelete->setEnabled( selected ); | 718 | mActionDelete->setEnabled( selected ); |
718 | mActionEditAddressee->setEnabled( selected ); | 719 | mActionEditAddressee->setEnabled( selected ); |
719 | mActionMail->setEnabled( selected ); | 720 | mActionMail->setEnabled( selected ); |
720 | mActionMailVCard->setEnabled( selected ); | 721 | mActionMailVCard->setEnabled( selected ); |
721 | //if (mActionBeam) | 722 | //if (mActionBeam) |
722 | //mActionBeam->setEnabled( selected ); | 723 | //mActionBeam->setEnabled( selected ); |
723 | mActionWhoAmI->setEnabled( selected ); | 724 | mActionWhoAmI->setEnabled( selected ); |
724 | } | 725 | } |
725 | 726 | ||
726 | void KABCore::sendMail() | 727 | void KABCore::sendMail() |
727 | { | 728 | { |
728 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 729 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
729 | } | 730 | } |
730 | 731 | ||
731 | void KABCore::sendMail( const QString& emaillist ) | 732 | void KABCore::sendMail( const QString& emaillist ) |
732 | { | 733 | { |
733 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 734 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
734 | if (emaillist.contains(",") > 0) | 735 | if (emaillist.contains(",") > 0) |
735 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 736 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
736 | else | 737 | else |
737 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 738 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
738 | } | 739 | } |
739 | 740 | ||
740 | 741 | ||
741 | 742 | ||
742 | void KABCore::mailVCard() | 743 | void KABCore::mailVCard() |
743 | { | 744 | { |
744 | QStringList uids = mViewManager->selectedUids(); | 745 | QStringList uids = mViewManager->selectedUids(); |
745 | if ( !uids.isEmpty() ) | 746 | if ( !uids.isEmpty() ) |
746 | mailVCard( uids ); | 747 | mailVCard( uids ); |
747 | } | 748 | } |
748 | 749 | ||
749 | void KABCore::mailVCard( const QStringList& uids ) | 750 | void KABCore::mailVCard( const QStringList& uids ) |
750 | { | 751 | { |
751 | QStringList urls; | 752 | QStringList urls; |
752 | 753 | ||
753 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 754 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
754 | 755 | ||
755 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 756 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
756 | 757 | ||
757 | 758 | ||
758 | 759 | ||
759 | QDir().mkdir( dirName, true ); | 760 | QDir().mkdir( dirName, true ); |
760 | 761 | ||
761 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 762 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
762 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 763 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
763 | 764 | ||
764 | if ( a.isEmpty() ) | 765 | if ( a.isEmpty() ) |
765 | continue; | 766 | continue; |
766 | 767 | ||
767 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 768 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
768 | 769 | ||
769 | QString fileName = dirName + "/" + name; | 770 | QString fileName = dirName + "/" + name; |
770 | 771 | ||
771 | QFile outFile(fileName); | 772 | QFile outFile(fileName); |
772 | 773 | ||
773 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 774 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
774 | KABC::VCardConverter converter; | 775 | KABC::VCardConverter converter; |
775 | QString vcard; | 776 | QString vcard; |
776 | 777 | ||
777 | converter.addresseeToVCard( a, vcard ); | 778 | converter.addresseeToVCard( a, vcard ); |
778 | 779 | ||
779 | QTextStream t( &outFile ); // use a text stream | 780 | QTextStream t( &outFile ); // use a text stream |
780 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 781 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
781 | t << vcard; | 782 | t << vcard; |
782 | 783 | ||
783 | outFile.close(); | 784 | outFile.close(); |
784 | 785 | ||
785 | urls.append( fileName ); | 786 | urls.append( fileName ); |
786 | } | 787 | } |
787 | } | 788 | } |
788 | 789 | ||
789 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 790 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
790 | 791 | ||
791 | 792 | ||
792 | /*US | 793 | /*US |
793 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 794 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
794 | QString::null, // subject | 795 | QString::null, // subject |
795 | QString::null, // body | 796 | QString::null, // body |
796 | QString::null, | 797 | QString::null, |
797 | urls ); // attachments | 798 | urls ); // attachments |
798 | */ | 799 | */ |
799 | 800 | ||
800 | } | 801 | } |
801 | 802 | ||
802 | /** | 803 | /** |
803 | Beams the "WhoAmI contact. | 804 | Beams the "WhoAmI contact. |
804 | */ | 805 | */ |
805 | void KABCore::beamMySelf() | 806 | void KABCore::beamMySelf() |
806 | { | 807 | { |
807 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 808 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
808 | if (!a.isEmpty()) | 809 | if (!a.isEmpty()) |
809 | { | 810 | { |
810 | QStringList uids; | 811 | QStringList uids; |
811 | uids << a.uid(); | 812 | uids << a.uid(); |
812 | 813 | ||
813 | beamVCard(uids); | 814 | beamVCard(uids); |
814 | } else { | 815 | } else { |
815 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 816 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
816 | 817 | ||
817 | 818 | ||
818 | } | 819 | } |
819 | } | 820 | } |
820 | void KABCore::updateMainWindow() | 821 | void KABCore::updateMainWindow() |
821 | { | 822 | { |
822 | |||
823 | mMainWindow->showMaximized(); | 823 | mMainWindow->showMaximized(); |
824 | mMainWindow->update(); | 824 | mMainWindow->update(); |
825 | } | 825 | } |
826 | void KABCore::resizeEvent(QResizeEvent* e ) | 826 | void KABCore::resizeEvent(QResizeEvent* e ) |
827 | { | 827 | { |
828 | if ( !mMiniSplitter ) | 828 | if ( !mMiniSplitter ) |
829 | return; | 829 | return; |
830 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 830 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); |
831 | if ( QApplication::desktop()->width() >= 480 ) { | 831 | if ( QApplication::desktop()->width() >= 480 ) { |
832 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 832 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 833 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
834 | mMiniSplitter->setOrientation( Qt::Horizontal); | 834 | mMiniSplitter->setOrientation( Qt::Horizontal); |
835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 835 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
836 | if ( QApplication::desktop()->width() <= 640 ) { | ||
837 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | ||
838 | mViewManager->getFilterAction()->setComboWidth( 150 ); | ||
839 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
840 | } | ||
841 | } | 836 | } |
837 | if ( QApplication::desktop()->width() <= 640 ) { | ||
838 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | ||
839 | mViewManager->getFilterAction()->setComboWidth( 150 ); | ||
840 | if ( mIncSearchWidget ) | ||
841 | mIncSearchWidget->setSize(); | ||
842 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
843 | } | ||
844 | |||
842 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 845 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
843 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 846 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
844 | mMiniSplitter->setOrientation( Qt::Vertical ); | 847 | mMiniSplitter->setOrientation( Qt::Vertical ); |
845 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 848 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
846 | if ( QApplication::desktop()->width() <= 640 ) { | 849 | } |
847 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 850 | if ( QApplication::desktop()->width() <= 640 ) { |
848 | mMainWindow->showMinimized(); | 851 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
852 | mMainWindow->showMinimized(); | ||
853 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | ||
854 | if ( mIncSearchWidget ) { | ||
855 | mIncSearchWidget->setSize(); | ||
856 | } | ||
857 | } else { | ||
849 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 858 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
850 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
851 | } | 859 | } |
860 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
852 | } | 861 | } |
853 | } | 862 | } |
854 | } | 863 | } |
855 | 864 | ||
856 | } | 865 | } |
857 | void KABCore::export2phone() | 866 | void KABCore::export2phone() |
858 | { | 867 | { |
859 | 868 | ||
860 | QStringList uids; | 869 | QStringList uids; |
861 | XXPortSelectDialog dlg( this, false, this ); | 870 | XXPortSelectDialog dlg( this, false, this ); |
862 | if ( dlg.exec() ) | 871 | if ( dlg.exec() ) |
863 | uids = dlg.uids(); | 872 | uids = dlg.uids(); |
864 | else | 873 | else |
865 | return; | 874 | return; |
866 | if ( uids.isEmpty() ) | 875 | if ( uids.isEmpty() ) |
867 | return; | 876 | return; |
868 | // qDebug("count %d ", uids.count()); | 877 | // qDebug("count %d ", uids.count()); |
869 | 878 | ||
870 | KAex2phonePrefs ex2phone; | 879 | KAex2phonePrefs ex2phone; |
871 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 880 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
872 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 881 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
873 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 882 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
874 | 883 | ||
875 | if ( !ex2phone.exec() ) { | 884 | if ( !ex2phone.exec() ) { |
876 | return; | 885 | return; |
877 | } | 886 | } |
878 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 887 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
879 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 888 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
880 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 889 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
881 | 890 | ||
882 | 891 | ||
883 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 892 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
884 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 893 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
885 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 894 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
886 | 895 | ||
887 | QString fileName = getPhoneFile(); | 896 | QString fileName = getPhoneFile(); |
888 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 897 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
889 | return; | 898 | return; |
890 | 899 | ||
891 | message(i18n("Exporting to phone...")); | 900 | message(i18n("Exporting to phone...")); |
892 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 901 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
893 | 902 | ||
894 | } | 903 | } |
895 | QString KABCore::getPhoneFile() | 904 | QString KABCore::getPhoneFile() |
896 | { | 905 | { |
897 | #ifdef DESKTOP_VERSION | 906 | #ifdef DESKTOP_VERSION |
898 | return locateLocal("tmp", "phonefile.vcf"); | 907 | return locateLocal("tmp", "phonefile.vcf"); |
899 | #else | 908 | #else |
900 | return "/tmp/phonefile.vcf"; | 909 | return "/tmp/phonefile.vcf"; |
901 | #endif | 910 | #endif |
902 | 911 | ||
903 | } | 912 | } |
904 | void KABCore::writeToPhone( ) | 913 | void KABCore::writeToPhone( ) |
905 | { | 914 | { |
906 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 915 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
907 | message(i18n("Export to phone finished!")); | 916 | message(i18n("Export to phone finished!")); |
908 | else | 917 | else |
909 | qDebug(i18n("KA: Error exporting to phone")); | 918 | qDebug(i18n("KA: Error exporting to phone")); |
910 | } | 919 | } |
911 | void KABCore::beamVCard() | 920 | void KABCore::beamVCard() |
912 | { | 921 | { |
913 | QStringList uids; | 922 | QStringList uids; |
914 | XXPortSelectDialog dlg( this, false, this ); | 923 | XXPortSelectDialog dlg( this, false, this ); |
915 | if ( dlg.exec() ) | 924 | if ( dlg.exec() ) |
916 | uids = dlg.uids(); | 925 | uids = dlg.uids(); |
917 | else | 926 | else |
918 | return; | 927 | return; |
919 | if ( uids.isEmpty() ) | 928 | if ( uids.isEmpty() ) |
920 | return; | 929 | return; |
921 | beamVCard( uids ); | 930 | beamVCard( uids ); |
922 | } | 931 | } |
923 | 932 | ||
924 | 933 | ||
925 | void KABCore::beamVCard(const QStringList& uids) | 934 | void KABCore::beamVCard(const QStringList& uids) |
926 | { | 935 | { |
927 | 936 | ||
928 | // LR: we should use the /tmp dir on the Zaurus, | 937 | // LR: we should use the /tmp dir on the Zaurus, |
929 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 938 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
930 | 939 | ||
931 | #ifdef DESKTOP_VERSION | 940 | #ifdef DESKTOP_VERSION |
932 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 941 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
933 | #else | 942 | #else |
934 | QString fileName = "/tmp/kapibeamfile.vcf"; | 943 | QString fileName = "/tmp/kapibeamfile.vcf"; |
935 | #endif | 944 | #endif |
936 | 945 | ||
937 | KABC::VCardConverter converter; | 946 | KABC::VCardConverter converter; |
938 | QString description; | 947 | QString description; |
939 | QString datastream; | 948 | QString datastream; |
940 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 949 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
941 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 950 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
942 | 951 | ||
943 | if ( a.isEmpty() ) | 952 | if ( a.isEmpty() ) |
944 | continue; | 953 | continue; |
945 | 954 | ||
946 | if (description.isEmpty()) | 955 | if (description.isEmpty()) |
947 | description = a.formattedName(); | 956 | description = a.formattedName(); |
948 | 957 | ||
949 | QString vcard; | 958 | QString vcard; |
950 | converter.addresseeToVCard( a, vcard ); | 959 | converter.addresseeToVCard( a, vcard ); |
951 | int start = 0; | 960 | int start = 0; |
952 | int next; | 961 | int next; |
953 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 962 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
954 | int semi = vcard.find(";", next); | 963 | int semi = vcard.find(";", next); |
955 | int dopp = vcard.find(":", next); | 964 | int dopp = vcard.find(":", next); |
956 | int sep; | 965 | int sep; |
957 | if ( semi < dopp && semi >= 0 ) | 966 | if ( semi < dopp && semi >= 0 ) |
958 | sep = semi ; | 967 | sep = semi ; |
959 | else | 968 | else |
960 | sep = dopp; | 969 | sep = dopp; |
961 | datastream +=vcard.mid( start, next - start); | 970 | datastream +=vcard.mid( start, next - start); |
962 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 971 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
963 | start = sep; | 972 | start = sep; |
964 | } | 973 | } |
965 | datastream += vcard.mid( start,vcard.length() ); | 974 | datastream += vcard.mid( start,vcard.length() ); |
966 | } | 975 | } |
967 | #ifndef DESKTOP_VERSION | 976 | #ifndef DESKTOP_VERSION |
968 | QFile outFile(fileName); | 977 | QFile outFile(fileName); |
969 | if ( outFile.open(IO_WriteOnly) ) { | 978 | if ( outFile.open(IO_WriteOnly) ) { |
970 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 979 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
971 | QTextStream t( &outFile ); // use a text stream | 980 | QTextStream t( &outFile ); // use a text stream |
972 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 981 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
973 | t.setEncoding( QTextStream::Latin1 ); | 982 | t.setEncoding( QTextStream::Latin1 ); |
974 | t <<datastream.latin1(); | 983 | t <<datastream.latin1(); |
975 | outFile.close(); | 984 | outFile.close(); |
976 | Ir *ir = new Ir( this ); | 985 | Ir *ir = new Ir( this ); |
977 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 986 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
978 | ir->send( fileName, description, "text/x-vCard" ); | 987 | ir->send( fileName, description, "text/x-vCard" ); |
979 | } else { | 988 | } else { |
980 | qDebug("KA: Error open temp beam file "); | 989 | qDebug("KA: Error open temp beam file "); |
981 | return; | 990 | return; |
982 | } | 991 | } |
983 | #endif | 992 | #endif |
984 | 993 | ||
985 | } | 994 | } |
986 | 995 | ||
987 | void KABCore::beamDone( Ir *ir ) | 996 | void KABCore::beamDone( Ir *ir ) |
988 | { | 997 | { |
989 | #ifndef DESKTOP_VERSION | 998 | #ifndef DESKTOP_VERSION |
990 | delete ir; | 999 | delete ir; |
991 | #endif | 1000 | #endif |
992 | topLevelWidget()->raise(); | 1001 | topLevelWidget()->raise(); |
993 | message( i18n("Beaming finished!") ); | 1002 | message( i18n("Beaming finished!") ); |
994 | } | 1003 | } |
995 | 1004 | ||
996 | 1005 | ||
997 | void KABCore::browse( const QString& url ) | 1006 | void KABCore::browse( const QString& url ) |
998 | { | 1007 | { |
999 | #ifndef KAB_EMBEDDED | 1008 | #ifndef KAB_EMBEDDED |
1000 | kapp->invokeBrowser( url ); | 1009 | kapp->invokeBrowser( url ); |
1001 | #else //KAB_EMBEDDED | 1010 | #else //KAB_EMBEDDED |
1002 | qDebug("KABCore::browse must be fixed"); | 1011 | qDebug("KABCore::browse must be fixed"); |
1003 | #endif //KAB_EMBEDDED | 1012 | #endif //KAB_EMBEDDED |
1004 | } | 1013 | } |
1005 | 1014 | ||
1006 | void KABCore::selectAllContacts() | 1015 | void KABCore::selectAllContacts() |
1007 | { | 1016 | { |
1008 | mViewManager->setSelected( QString::null, true ); | 1017 | mViewManager->setSelected( QString::null, true ); |
1009 | } | 1018 | } |
1010 | 1019 | ||
1011 | void KABCore::deleteContacts() | 1020 | void KABCore::deleteContacts() |
1012 | { | 1021 | { |
1013 | QStringList uidList = mViewManager->selectedUids(); | 1022 | QStringList uidList = mViewManager->selectedUids(); |
1014 | deleteContacts( uidList ); | 1023 | deleteContacts( uidList ); |
1015 | } | 1024 | } |
1016 | 1025 | ||
1017 | void KABCore::deleteContacts( const QStringList &uids ) | 1026 | void KABCore::deleteContacts( const QStringList &uids ) |
1018 | { | 1027 | { |
1019 | if ( uids.count() > 0 ) { | 1028 | if ( uids.count() > 0 ) { |
1020 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1029 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1021 | UndoStack::instance()->push( command ); | 1030 | UndoStack::instance()->push( command ); |
1022 | RedoStack::instance()->clear(); | 1031 | RedoStack::instance()->clear(); |
1023 | 1032 | ||
1024 | // now if we deleted anything, refresh | 1033 | // now if we deleted anything, refresh |
1025 | setContactSelected( QString::null ); | 1034 | setContactSelected( QString::null ); |
1026 | setModified( true ); | 1035 | setModified( true ); |
1027 | } | 1036 | } |
1028 | } | 1037 | } |
1029 | 1038 | ||
1030 | void KABCore::copyContacts() | 1039 | void KABCore::copyContacts() |
1031 | { | 1040 | { |
1032 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1041 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1033 | 1042 | ||
1034 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1043 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1035 | 1044 | ||
1036 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1045 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1037 | 1046 | ||
1038 | QClipboard *cb = QApplication::clipboard(); | 1047 | QClipboard *cb = QApplication::clipboard(); |
1039 | cb->setText( clipText ); | 1048 | cb->setText( clipText ); |
1040 | } | 1049 | } |
1041 | 1050 | ||
1042 | void KABCore::cutContacts() | 1051 | void KABCore::cutContacts() |
1043 | { | 1052 | { |
1044 | QStringList uidList = mViewManager->selectedUids(); | 1053 | QStringList uidList = mViewManager->selectedUids(); |
1045 | 1054 | ||
1046 | //US if ( uidList.size() > 0 ) { | 1055 | //US if ( uidList.size() > 0 ) { |
1047 | if ( uidList.count() > 0 ) { | 1056 | if ( uidList.count() > 0 ) { |
1048 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1057 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1049 | UndoStack::instance()->push( command ); | 1058 | UndoStack::instance()->push( command ); |
1050 | RedoStack::instance()->clear(); | 1059 | RedoStack::instance()->clear(); |
1051 | 1060 | ||
1052 | setModified( true ); | 1061 | setModified( true ); |
1053 | } | 1062 | } |
1054 | } | 1063 | } |
1055 | 1064 | ||
1056 | void KABCore::pasteContacts() | 1065 | void KABCore::pasteContacts() |
1057 | { | 1066 | { |
1058 | QClipboard *cb = QApplication::clipboard(); | 1067 | QClipboard *cb = QApplication::clipboard(); |
1059 | 1068 | ||
1060 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1069 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1061 | 1070 | ||
1062 | pasteContacts( list ); | 1071 | pasteContacts( list ); |
1063 | } | 1072 | } |
1064 | 1073 | ||
1065 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1074 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1066 | { | 1075 | { |
1067 | KABC::Resource *resource = requestResource( this ); | 1076 | KABC::Resource *resource = requestResource( this ); |
1068 | KABC::Addressee::List::Iterator it; | 1077 | KABC::Addressee::List::Iterator it; |
1069 | for ( it = list.begin(); it != list.end(); ++it ) | 1078 | for ( it = list.begin(); it != list.end(); ++it ) |
1070 | (*it).setResource( resource ); | 1079 | (*it).setResource( resource ); |
1071 | 1080 | ||
1072 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1081 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1073 | UndoStack::instance()->push( command ); | 1082 | UndoStack::instance()->push( command ); |
1074 | RedoStack::instance()->clear(); | 1083 | RedoStack::instance()->clear(); |
1075 | 1084 | ||
1076 | setModified( true ); | 1085 | setModified( true ); |
1077 | } | 1086 | } |
1078 | 1087 | ||
1079 | void KABCore::setWhoAmI() | 1088 | void KABCore::setWhoAmI() |
1080 | { | 1089 | { |
1081 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1090 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1082 | 1091 | ||
1083 | if ( addrList.count() > 1 ) { | 1092 | if ( addrList.count() > 1 ) { |
1084 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1093 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1085 | return; | 1094 | return; |
1086 | } | 1095 | } |
1087 | 1096 | ||
1088 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1097 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1089 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1098 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1090 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1099 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1091 | } | 1100 | } |
1092 | void KABCore::editCategories() | 1101 | void KABCore::editCategories() |
1093 | { | 1102 | { |
1094 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1103 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1095 | dlg.exec(); | 1104 | dlg.exec(); |
1096 | } | 1105 | } |
1097 | void KABCore::setCategories() | 1106 | void KABCore::setCategories() |
1098 | { | 1107 | { |
1099 | 1108 | ||
1100 | QStringList uids; | 1109 | QStringList uids; |
1101 | XXPortSelectDialog dlgx( this, false, this ); | 1110 | XXPortSelectDialog dlgx( this, false, this ); |
1102 | if ( dlgx.exec() ) | 1111 | if ( dlgx.exec() ) |
1103 | uids = dlgx.uids(); | 1112 | uids = dlgx.uids(); |
1104 | else | 1113 | else |
1105 | return; | 1114 | return; |
1106 | if ( uids.isEmpty() ) | 1115 | if ( uids.isEmpty() ) |
1107 | return; | 1116 | return; |
1108 | // qDebug("count %d ", uids.count()); | 1117 | // qDebug("count %d ", uids.count()); |
1109 | 1118 | ||
1110 | 1119 | ||
1111 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1120 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1112 | if ( !dlg.exec() ) { | 1121 | if ( !dlg.exec() ) { |
1113 | message( i18n("Setting categories cancelled") ); | 1122 | message( i18n("Setting categories cancelled") ); |
1114 | return; | 1123 | return; |
1115 | } | 1124 | } |
1116 | bool merge = false; | 1125 | bool merge = false; |
1117 | QString msg = i18n( "Merge with existing categories?" ); | 1126 | QString msg = i18n( "Merge with existing categories?" ); |
1118 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1127 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1119 | merge = true; | 1128 | merge = true; |
1120 | 1129 | ||
1121 | message( i18n("Setting categories ... please wait!") ); | 1130 | message( i18n("Setting categories ... please wait!") ); |
1122 | QStringList categories = dlg.selectedCategories(); | 1131 | QStringList categories = dlg.selectedCategories(); |
1123 | 1132 | ||
1124 | //QStringList uids = mViewManager->selectedUids(); | 1133 | //QStringList uids = mViewManager->selectedUids(); |
1125 | QStringList::Iterator it; | 1134 | QStringList::Iterator it; |
1126 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1135 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1127 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1136 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1128 | if ( !addr.isEmpty() ) { | 1137 | if ( !addr.isEmpty() ) { |
1129 | if ( !merge ) | 1138 | if ( !merge ) |
1130 | addr.setCategories( categories ); | 1139 | addr.setCategories( categories ); |
1131 | else { | 1140 | else { |
1132 | QStringList addrCategories = addr.categories(); | 1141 | QStringList addrCategories = addr.categories(); |
1133 | QStringList::Iterator catIt; | 1142 | QStringList::Iterator catIt; |
1134 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1143 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1135 | if ( !addrCategories.contains( *catIt ) ) | 1144 | if ( !addrCategories.contains( *catIt ) ) |
1136 | addrCategories.append( *catIt ); | 1145 | addrCategories.append( *catIt ); |
1137 | } | 1146 | } |
1138 | addr.setCategories( addrCategories ); | 1147 | addr.setCategories( addrCategories ); |
1139 | } | 1148 | } |
1140 | mAddressBook->insertAddressee( addr ); | 1149 | mAddressBook->insertAddressee( addr ); |
1141 | } | 1150 | } |
1142 | } | 1151 | } |
1143 | 1152 | ||
1144 | if ( uids.count() > 0 ) | 1153 | if ( uids.count() > 0 ) |
1145 | setModified( true ); | 1154 | setModified( true ); |
1146 | message( i18n("Setting categories completed!") ); | 1155 | message( i18n("Setting categories completed!") ); |
1147 | } | 1156 | } |
1148 | 1157 | ||
1149 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1158 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1150 | { | 1159 | { |
1151 | mIncSearchWidget->setFields( fields ); | 1160 | mIncSearchWidget->setFields( fields ); |
1152 | } | 1161 | } |
1153 | 1162 | ||
1154 | void KABCore::incrementalSearch( const QString& text ) | 1163 | void KABCore::incrementalSearch( const QString& text ) |
1155 | { | 1164 | { |
1156 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1165 | QString stext; |
1166 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | ||
1167 | stext = "*" + text; | ||
1168 | } else { | ||
1169 | stext = text; | ||
1170 | } | ||
1171 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | ||
1157 | } | 1172 | } |
1158 | 1173 | ||
1159 | void KABCore::setModified() | 1174 | void KABCore::setModified() |
1160 | { | 1175 | { |
1161 | setModified( true ); | 1176 | setModified( true ); |
1162 | } | 1177 | } |
1163 | 1178 | ||
1164 | void KABCore::setModifiedWOrefresh() | 1179 | void KABCore::setModifiedWOrefresh() |
1165 | { | 1180 | { |
1166 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1181 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1167 | mModified = true; | 1182 | mModified = true; |
1168 | mActionSave->setEnabled( mModified ); | 1183 | mActionSave->setEnabled( mModified ); |
1169 | 1184 | ||
1170 | 1185 | ||
1171 | } | 1186 | } |
1172 | void KABCore::setModified( bool modified ) | 1187 | void KABCore::setModified( bool modified ) |
1173 | { | 1188 | { |
1174 | mModified = modified; | 1189 | mModified = modified; |
1175 | mActionSave->setEnabled( mModified ); | 1190 | mActionSave->setEnabled( mModified ); |
1176 | 1191 | ||
1177 | if ( modified ) | 1192 | if ( modified ) |
1178 | mJumpButtonBar->recreateButtons(); | 1193 | mJumpButtonBar->recreateButtons(); |
1179 | 1194 | ||
1180 | mViewManager->refreshView(); | 1195 | mViewManager->refreshView(); |
1181 | 1196 | ||
1182 | } | 1197 | } |
1183 | 1198 | ||
1184 | bool KABCore::modified() const | 1199 | bool KABCore::modified() const |
1185 | { | 1200 | { |
1186 | return mModified; | 1201 | return mModified; |
1187 | } | 1202 | } |
1188 | 1203 | ||
1189 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1204 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1190 | { | 1205 | { |
1191 | addrModified( addr ); | 1206 | addrModified( addr ); |
1192 | #if 0 // debug only | 1207 | #if 0 // debug only |
1193 | KABC::Addressee ad = addr; | 1208 | KABC::Addressee ad = addr; |
1194 | ad.computeCsum( "123"); | 1209 | ad.computeCsum( "123"); |
1195 | #endif | 1210 | #endif |
1196 | } | 1211 | } |
1197 | 1212 | ||
1198 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1213 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1199 | { | 1214 | { |
1200 | 1215 | ||
1201 | Command *command = 0; | 1216 | Command *command = 0; |
1202 | QString uid; | 1217 | QString uid; |
1203 | 1218 | ||
1204 | // check if it exists already | 1219 | // check if it exists already |
1205 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1220 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1206 | if ( origAddr.isEmpty() ) | 1221 | if ( origAddr.isEmpty() ) |
1207 | command = new PwNewCommand( mAddressBook, addr ); | 1222 | command = new PwNewCommand( mAddressBook, addr ); |
1208 | else { | 1223 | else { |
1209 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1224 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1210 | uid = addr.uid(); | 1225 | uid = addr.uid(); |
1211 | } | 1226 | } |
1212 | 1227 | ||
1213 | UndoStack::instance()->push( command ); | 1228 | UndoStack::instance()->push( command ); |
1214 | RedoStack::instance()->clear(); | 1229 | RedoStack::instance()->clear(); |
1215 | if ( updateDetails ) | 1230 | if ( updateDetails ) |
1216 | mDetails->setAddressee( addr ); | 1231 | mDetails->setAddressee( addr ); |
1217 | setModified( true ); | 1232 | setModified( true ); |
1218 | } | 1233 | } |
1219 | 1234 | ||
1220 | void KABCore::newContact() | 1235 | void KABCore::newContact() |
1221 | { | 1236 | { |
1222 | 1237 | ||
1223 | 1238 | ||
1224 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1239 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1225 | 1240 | ||
1226 | QPtrList<KRES::Resource> kresResources; | 1241 | QPtrList<KRES::Resource> kresResources; |
1227 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1242 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1228 | KABC::Resource *resource; | 1243 | KABC::Resource *resource; |
1229 | while ( ( resource = it.current() ) != 0 ) { | 1244 | while ( ( resource = it.current() ) != 0 ) { |
1230 | ++it; | 1245 | ++it; |
1231 | if ( !resource->readOnly() ) { | 1246 | if ( !resource->readOnly() ) { |
1232 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1247 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1233 | if ( res ) | 1248 | if ( res ) |
1234 | kresResources.append( res ); | 1249 | kresResources.append( res ); |
1235 | } | 1250 | } |
1236 | } | 1251 | } |
1237 | 1252 | ||
1238 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1253 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1239 | resource = static_cast<KABC::Resource*>( res ); | 1254 | resource = static_cast<KABC::Resource*>( res ); |
1240 | 1255 | ||
1241 | if ( resource ) { | 1256 | if ( resource ) { |
1242 | KABC::Addressee addr; | 1257 | KABC::Addressee addr; |
1243 | addr.setResource( resource ); | 1258 | addr.setResource( resource ); |
1244 | mEditorDialog->setAddressee( addr ); | 1259 | mEditorDialog->setAddressee( addr ); |
1245 | KApplication::execDialog ( mEditorDialog ); | 1260 | KApplication::execDialog ( mEditorDialog ); |
1246 | 1261 | ||
1247 | } else | 1262 | } else |
1248 | return; | 1263 | return; |
1249 | 1264 | ||
1250 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1265 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1251 | 1266 | ||
1252 | 1267 | ||
1253 | } | 1268 | } |
1254 | 1269 | ||
1255 | void KABCore::addEmail( QString aStr ) | 1270 | void KABCore::addEmail( QString aStr ) |
1256 | { | 1271 | { |
1257 | #ifndef KAB_EMBEDDED | 1272 | #ifndef KAB_EMBEDDED |
1258 | QString fullName, email; | 1273 | QString fullName, email; |
1259 | 1274 | ||
1260 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1275 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1261 | 1276 | ||
1262 | // Try to lookup the addressee matching the email address | 1277 | // Try to lookup the addressee matching the email address |
1263 | bool found = false; | 1278 | bool found = false; |
1264 | QStringList emailList; | 1279 | QStringList emailList; |
1265 | KABC::AddressBook::Iterator it; | 1280 | KABC::AddressBook::Iterator it; |
1266 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1281 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1267 | emailList = (*it).emails(); | 1282 | emailList = (*it).emails(); |
1268 | if ( emailList.contains( email ) > 0 ) { | 1283 | if ( emailList.contains( email ) > 0 ) { |
1269 | found = true; | 1284 | found = true; |
1270 | (*it).setNameFromString( fullName ); | 1285 | (*it).setNameFromString( fullName ); |
1271 | editContact( (*it).uid() ); | 1286 | editContact( (*it).uid() ); |
1272 | } | 1287 | } |
1273 | } | 1288 | } |
1274 | 1289 | ||
1275 | if ( !found ) { | 1290 | if ( !found ) { |
1276 | KABC::Addressee addr; | 1291 | KABC::Addressee addr; |
1277 | addr.setNameFromString( fullName ); | 1292 | addr.setNameFromString( fullName ); |
1278 | addr.insertEmail( email, true ); | 1293 | addr.insertEmail( email, true ); |
1279 | 1294 | ||
1280 | mAddressBook->insertAddressee( addr ); | 1295 | mAddressBook->insertAddressee( addr ); |
1281 | mViewManager->refreshView( addr.uid() ); | 1296 | mViewManager->refreshView( addr.uid() ); |
1282 | editContact( addr.uid() ); | 1297 | editContact( addr.uid() ); |
1283 | } | 1298 | } |
1284 | #else //KAB_EMBEDDED | 1299 | #else //KAB_EMBEDDED |
1285 | qDebug("KABCore::addEmail finsih method"); | 1300 | qDebug("KABCore::addEmail finsih method"); |
1286 | #endif //KAB_EMBEDDED | 1301 | #endif //KAB_EMBEDDED |
1287 | } | 1302 | } |
1288 | 1303 | ||
1289 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1304 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1290 | { | 1305 | { |
1291 | mXXPortManager->importVCard( url, showPreview ); | 1306 | mXXPortManager->importVCard( url, showPreview ); |
1292 | } | 1307 | } |
1293 | void KABCore::importFromOL() | 1308 | void KABCore::importFromOL() |
1294 | { | 1309 | { |
1295 | #ifdef _OL_IMPORT_ | 1310 | #ifdef _OL_IMPORT_ |
1296 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1311 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1297 | idgl->exec(); | 1312 | idgl->exec(); |
1298 | KABC::Addressee::List list = idgl->getAddressList(); | 1313 | KABC::Addressee::List list = idgl->getAddressList(); |
1299 | if ( list.count() > 0 ) { | 1314 | if ( list.count() > 0 ) { |
1300 | KABC::Addressee::List listNew; | 1315 | KABC::Addressee::List listNew; |
1301 | KABC::Addressee::List listExisting; | 1316 | KABC::Addressee::List listExisting; |
1302 | KABC::Addressee::List::Iterator it; | 1317 | KABC::Addressee::List::Iterator it; |
1303 | KABC::AddressBook::Iterator iter; | 1318 | KABC::AddressBook::Iterator iter; |
1304 | for ( it = list.begin(); it != list.end(); ++it ) { | 1319 | for ( it = list.begin(); it != list.end(); ++it ) { |
1305 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1320 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1306 | listNew.append( (*it) ); | 1321 | listNew.append( (*it) ); |
1307 | else | 1322 | else |
1308 | listExisting.append( (*it) ); | 1323 | listExisting.append( (*it) ); |
1309 | } | 1324 | } |
1310 | if ( listExisting.count() > 0 ) | 1325 | if ( listExisting.count() > 0 ) |
1311 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1326 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1312 | if ( listNew.count() > 0 ) { | 1327 | if ( listNew.count() > 0 ) { |
1313 | pasteWithNewUid = false; | 1328 | pasteWithNewUid = false; |
1314 | pasteContacts( listNew ); | 1329 | pasteContacts( listNew ); |
1315 | pasteWithNewUid = true; | 1330 | pasteWithNewUid = true; |
1316 | } | 1331 | } |
1317 | } | 1332 | } |
1318 | delete idgl; | 1333 | delete idgl; |
1319 | #endif | 1334 | #endif |
1320 | } | 1335 | } |
1321 | 1336 | ||
1322 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1337 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1323 | { | 1338 | { |
1324 | mXXPortManager->importVCard( vCard, showPreview ); | 1339 | mXXPortManager->importVCard( vCard, showPreview ); |
1325 | } | 1340 | } |
1326 | 1341 | ||
1327 | //US added a second method without defaultparameter | 1342 | //US added a second method without defaultparameter |
1328 | void KABCore::editContact2() { | 1343 | void KABCore::editContact2() { |
1329 | editContact( QString::null ); | 1344 | editContact( QString::null ); |
1330 | } | 1345 | } |
1331 | 1346 | ||
1332 | void KABCore::editContact( const QString &uid ) | 1347 | void KABCore::editContact( const QString &uid ) |
1333 | { | 1348 | { |
1334 | 1349 | ||
1335 | if ( mExtensionManager->isQuickEditVisible() ) | 1350 | if ( mExtensionManager->isQuickEditVisible() ) |
1336 | return; | 1351 | return; |
1337 | 1352 | ||
1338 | // First, locate the contact entry | 1353 | // First, locate the contact entry |
1339 | QString localUID = uid; | 1354 | QString localUID = uid; |
1340 | if ( localUID.isNull() ) { | 1355 | if ( localUID.isNull() ) { |
1341 | QStringList uidList = mViewManager->selectedUids(); | 1356 | QStringList uidList = mViewManager->selectedUids(); |
1342 | if ( uidList.count() > 0 ) | 1357 | if ( uidList.count() > 0 ) |
1343 | localUID = *( uidList.at( 0 ) ); | 1358 | localUID = *( uidList.at( 0 ) ); |
1344 | } | 1359 | } |
1345 | 1360 | ||
1346 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1361 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1347 | if ( !addr.isEmpty() ) { | 1362 | if ( !addr.isEmpty() ) { |
1348 | mEditorDialog->setAddressee( addr ); | 1363 | mEditorDialog->setAddressee( addr ); |
1349 | KApplication::execDialog ( mEditorDialog ); | 1364 | KApplication::execDialog ( mEditorDialog ); |
1350 | } | 1365 | } |
1351 | } | 1366 | } |
1352 | 1367 | ||
1353 | /** | 1368 | /** |
1354 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1369 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1355 | the method will try to find a selected addressee in the view. | 1370 | the method will try to find a selected addressee in the view. |
1356 | */ | 1371 | */ |
1357 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1372 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1358 | { | 1373 | { |
1359 | if ( mMultipleViewsAtOnce ) | 1374 | if ( mMultipleViewsAtOnce ) |
1360 | { | 1375 | { |
1361 | editContact( uid ); | 1376 | editContact( uid ); |
1362 | } | 1377 | } |
1363 | else | 1378 | else |
1364 | { | 1379 | { |
1365 | setDetailsVisible( true ); | 1380 | setDetailsVisible( true ); |
1366 | mActionDetails->setChecked(true); | 1381 | mActionDetails->setChecked(true); |
1367 | } | 1382 | } |
1368 | 1383 | ||
1369 | } | 1384 | } |
1370 | 1385 | ||
1371 | void KABCore::save() | 1386 | void KABCore::save() |
1372 | { | 1387 | { |
1373 | if (syncManager->blockSave()) | 1388 | if (syncManager->blockSave()) |
1374 | return; | 1389 | return; |
1375 | if ( !mModified ) | 1390 | if ( !mModified ) |
1376 | return; | 1391 | return; |
1377 | 1392 | ||
1378 | syncManager->setBlockSave(true); | 1393 | syncManager->setBlockSave(true); |
1379 | QString text = i18n( "There was an error while attempting to save\n the " | 1394 | QString text = i18n( "There was an error while attempting to save\n the " |
1380 | "address book. Please check that some \nother application is " | 1395 | "address book. Please check that some \nother application is " |
1381 | "not using it. " ); | 1396 | "not using it. " ); |
1382 | message(i18n("Saving ... please wait! "), false); | 1397 | message(i18n("Saving ... please wait! "), false); |
1383 | //qApp->processEvents(); | 1398 | //qApp->processEvents(); |
1384 | #ifndef KAB_EMBEDDED | 1399 | #ifndef KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1400 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1401 | if ( !b || !b->save() ) { |
1387 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1402 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1388 | } | 1403 | } |
1389 | #else //KAB_EMBEDDED | 1404 | #else //KAB_EMBEDDED |
1390 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1405 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1391 | if ( !b || !b->save() ) { | 1406 | if ( !b || !b->save() ) { |
1392 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1407 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1393 | } | 1408 | } |
1394 | #endif //KAB_EMBEDDED | 1409 | #endif //KAB_EMBEDDED |
1395 | 1410 | ||
1396 | message(i18n("Addressbook saved!")); | 1411 | message(i18n("Addressbook saved!")); |
1397 | setModified( false ); | 1412 | setModified( false ); |
1398 | syncManager->setBlockSave(false); | 1413 | syncManager->setBlockSave(false); |
1399 | } | 1414 | } |
1400 | 1415 | ||
1401 | 1416 | ||
1402 | void KABCore::undo() | 1417 | void KABCore::undo() |
1403 | { | 1418 | { |
1404 | UndoStack::instance()->undo(); | 1419 | UndoStack::instance()->undo(); |
1405 | 1420 | ||
1406 | // Refresh the view | 1421 | // Refresh the view |
1407 | mViewManager->refreshView(); | 1422 | mViewManager->refreshView(); |
1408 | } | 1423 | } |
1409 | 1424 | ||
1410 | void KABCore::redo() | 1425 | void KABCore::redo() |
1411 | { | 1426 | { |
1412 | RedoStack::instance()->redo(); | 1427 | RedoStack::instance()->redo(); |
1413 | 1428 | ||
1414 | // Refresh the view | 1429 | // Refresh the view |
1415 | mViewManager->refreshView(); | 1430 | mViewManager->refreshView(); |
1416 | } | 1431 | } |
1417 | void KABCore::setJumpButtonBar( bool visible ) | 1432 | void KABCore::setJumpButtonBar( bool visible ) |
1418 | { | 1433 | { |
1419 | setJumpButtonBarVisible(visible ); | 1434 | setJumpButtonBarVisible(visible ); |
1420 | saveSettings(); | 1435 | saveSettings(); |
1421 | } | 1436 | } |
1422 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1437 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1423 | { | 1438 | { |
1424 | if (mMultipleViewsAtOnce) | 1439 | if (mMultipleViewsAtOnce) |
1425 | { | 1440 | { |
1426 | if ( visible ) | 1441 | if ( visible ) |
1427 | mJumpButtonBar->show(); | 1442 | mJumpButtonBar->show(); |
1428 | else | 1443 | else |
1429 | mJumpButtonBar->hide(); | 1444 | mJumpButtonBar->hide(); |
1430 | } | 1445 | } |
1431 | else | 1446 | else |
1432 | { | 1447 | { |
1433 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1448 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1434 | if (mViewManager->isVisible()) | 1449 | if (mViewManager->isVisible()) |
1435 | { | 1450 | { |
1436 | if ( visible ) | 1451 | if ( visible ) |
1437 | mJumpButtonBar->show(); | 1452 | mJumpButtonBar->show(); |
1438 | else | 1453 | else |
1439 | mJumpButtonBar->hide(); | 1454 | mJumpButtonBar->hide(); |
1440 | } | 1455 | } |
1441 | else | 1456 | else |
1442 | { | 1457 | { |
1443 | mJumpButtonBar->hide(); | 1458 | mJumpButtonBar->hide(); |
1444 | } | 1459 | } |
1445 | } | 1460 | } |
1446 | if ( visible ) { | 1461 | if ( visible ) { |
1447 | if ( mIncSearchWidget->currentItem() == 0 ) { | 1462 | if ( mIncSearchWidget->currentItem() == 0 ) { |
1448 | message( i18n("Change search field enable jump bar") ); | 1463 | message( i18n("Change search field enable jump bar") ); |
1449 | } | 1464 | } |
1450 | } | 1465 | } |
1451 | } | 1466 | } |
1452 | 1467 | ||
1453 | 1468 | ||
1454 | void KABCore::setDetailsToState() | 1469 | void KABCore::setDetailsToState() |
1455 | { | 1470 | { |
1456 | setDetailsVisible( mActionDetails->isChecked() ); | 1471 | setDetailsVisible( mActionDetails->isChecked() ); |
1457 | } | 1472 | } |
1458 | void KABCore::setDetailsToggle() | 1473 | void KABCore::setDetailsToggle() |
1459 | { | 1474 | { |
1460 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1475 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1461 | setDetailsToState(); | 1476 | setDetailsToState(); |
1462 | } | 1477 | } |
1463 | 1478 | ||
1464 | 1479 | ||
1465 | 1480 | ||
1466 | void KABCore::setDetailsVisible( bool visible ) | 1481 | void KABCore::setDetailsVisible( bool visible ) |
1467 | { | 1482 | { |
1468 | if (visible && mDetails->isHidden()) | 1483 | if (visible && mDetails->isHidden()) |
1469 | { | 1484 | { |
1470 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1485 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1471 | if ( addrList.count() > 0 ) | 1486 | if ( addrList.count() > 0 ) |
1472 | mDetails->setAddressee( addrList[ 0 ] ); | 1487 | mDetails->setAddressee( addrList[ 0 ] ); |
1473 | } | 1488 | } |
1474 | 1489 | ||
1475 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1490 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1476 | // the listview and the detailview. We do that by changing the splitbar size. | 1491 | // the listview and the detailview. We do that by changing the splitbar size. |
1477 | if (mMultipleViewsAtOnce) | 1492 | if (mMultipleViewsAtOnce) |
1478 | { | 1493 | { |
1479 | if ( visible ) | 1494 | if ( visible ) |
1480 | mDetails->show(); | 1495 | mDetails->show(); |
1481 | else | 1496 | else |
1482 | mDetails->hide(); | 1497 | mDetails->hide(); |
1483 | } | 1498 | } |
1484 | else | 1499 | else |
1485 | { | 1500 | { |
1486 | if ( visible ) { | 1501 | if ( visible ) { |
1487 | mViewManager->hide(); | 1502 | mViewManager->hide(); |
1488 | mDetails->show(); | 1503 | mDetails->show(); |
1489 | mIncSearchWidget->setFocus(); | 1504 | mIncSearchWidget->setFocus(); |
1490 | } | 1505 | } |
1491 | else { | 1506 | else { |
1492 | mViewManager->show(); | 1507 | mViewManager->show(); |
1493 | mDetails->hide(); | 1508 | mDetails->hide(); |
1494 | mViewManager->setFocusAV(); | 1509 | mViewManager->setFocusAV(); |
1495 | } | 1510 | } |
1496 | setJumpButtonBarVisible( !visible ); | 1511 | setJumpButtonBarVisible( !visible ); |
1497 | } | 1512 | } |
1498 | 1513 | ||
1499 | } | 1514 | } |
1500 | 1515 | ||
1501 | void KABCore::extensionChanged( int id ) | 1516 | void KABCore::extensionChanged( int id ) |
1502 | { | 1517 | { |
1503 | //change the details view only for non desktop systems | 1518 | //change the details view only for non desktop systems |
1504 | #ifndef DESKTOP_VERSION | 1519 | #ifndef DESKTOP_VERSION |
1505 | 1520 | ||
1506 | if (id == 0) | 1521 | if (id == 0) |
1507 | { | 1522 | { |
1508 | //the user disabled the extension. | 1523 | //the user disabled the extension. |
1509 | 1524 | ||
1510 | if (mMultipleViewsAtOnce) | 1525 | if (mMultipleViewsAtOnce) |
1511 | { // enable detailsview again | 1526 | { // enable detailsview again |
1512 | setDetailsVisible( true ); | 1527 | setDetailsVisible( true ); |
1513 | mActionDetails->setChecked( true ); | 1528 | mActionDetails->setChecked( true ); |
1514 | } | 1529 | } |
1515 | else | 1530 | else |
1516 | { //go back to the listview | 1531 | { //go back to the listview |
1517 | setDetailsVisible( false ); | 1532 | setDetailsVisible( false ); |
1518 | mActionDetails->setChecked( false ); | 1533 | mActionDetails->setChecked( false ); |
1519 | mActionDetails->setEnabled(true); | 1534 | mActionDetails->setEnabled(true); |
1520 | } | 1535 | } |
1521 | 1536 | ||
1522 | } | 1537 | } |
1523 | else | 1538 | else |
1524 | { | 1539 | { |
1525 | //the user enabled the extension. | 1540 | //the user enabled the extension. |
1526 | setDetailsVisible( false ); | 1541 | setDetailsVisible( false ); |
1527 | mActionDetails->setChecked( false ); | 1542 | mActionDetails->setChecked( false ); |
1528 | 1543 | ||
1529 | if (!mMultipleViewsAtOnce) | 1544 | if (!mMultipleViewsAtOnce) |
1530 | { | 1545 | { |
1531 | mActionDetails->setEnabled(false); | 1546 | mActionDetails->setEnabled(false); |
1532 | } | 1547 | } |
1533 | 1548 | ||
1534 | mExtensionManager->setSelectionChanged(); | 1549 | mExtensionManager->setSelectionChanged(); |
1535 | 1550 | ||
1536 | } | 1551 | } |
1537 | 1552 | ||
1538 | #endif// DESKTOP_VERSION | 1553 | #endif// DESKTOP_VERSION |
1539 | 1554 | ||
1540 | } | 1555 | } |
1541 | 1556 | ||
1542 | 1557 | ||
1543 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1558 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1544 | { | 1559 | { |
1545 | 1560 | ||
1546 | if ( list.count() != 0 ) { | 1561 | if ( list.count() != 0 ) { |
1547 | KABC::Addressee::List::ConstIterator it; | 1562 | KABC::Addressee::List::ConstIterator it; |
1548 | for ( it = list.begin(); it != list.end(); ++it ) | 1563 | for ( it = list.begin(); it != list.end(); ++it ) |
1549 | mAddressBook->insertAddressee( *it ); | 1564 | mAddressBook->insertAddressee( *it ); |
1550 | if ( list.count() > 1 ) | 1565 | if ( list.count() > 1 ) |
1551 | setModified(); | 1566 | setModified(); |
1552 | else | 1567 | else |
1553 | setModifiedWOrefresh(); | 1568 | setModifiedWOrefresh(); |
1554 | } | 1569 | } |
1555 | if ( list.count() == 0 ) | 1570 | if ( list.count() == 0 ) |
1556 | mViewManager->refreshView(); | 1571 | mViewManager->refreshView(); |
1557 | else | 1572 | else |
1558 | mViewManager->refreshView( list[ 0 ].uid() ); | 1573 | mViewManager->refreshView( list[ 0 ].uid() ); |
1559 | 1574 | ||
1560 | 1575 | ||
1561 | 1576 | ||
1562 | } | 1577 | } |
1563 | 1578 | ||
1564 | QString KABCore::getNameByPhone( const QString &phone ) | 1579 | QString KABCore::getNameByPhone( const QString &phone ) |
1565 | { | 1580 | { |
1566 | #ifndef KAB_EMBEDDED | 1581 | #ifndef KAB_EMBEDDED |
1567 | QRegExp r( "[/*/-/ ]" ); | 1582 | QRegExp r( "[/*/-/ ]" ); |
1568 | QString localPhone( phone ); | 1583 | QString localPhone( phone ); |
1569 | 1584 | ||
1570 | bool found = false; | 1585 | bool found = false; |
1571 | QString ownerName = ""; | 1586 | QString ownerName = ""; |
1572 | KABC::AddressBook::Iterator iter; | 1587 | KABC::AddressBook::Iterator iter; |
1573 | KABC::PhoneNumber::List::Iterator phoneIter; | 1588 | KABC::PhoneNumber::List::Iterator phoneIter; |
1574 | KABC::PhoneNumber::List phoneList; | 1589 | KABC::PhoneNumber::List phoneList; |
1575 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1590 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1576 | phoneList = (*iter).phoneNumbers(); | 1591 | phoneList = (*iter).phoneNumbers(); |
1577 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1592 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1578 | ++phoneIter) { | 1593 | ++phoneIter) { |
1579 | // Get rid of separator chars so just the numbers are compared. | 1594 | // Get rid of separator chars so just the numbers are compared. |
1580 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1595 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1581 | ownerName = (*iter).formattedName(); | 1596 | ownerName = (*iter).formattedName(); |
1582 | found = true; | 1597 | found = true; |
1583 | } | 1598 | } |
1584 | } | 1599 | } |
1585 | } | 1600 | } |
1586 | 1601 | ||
1587 | return ownerName; | 1602 | return ownerName; |
1588 | #else //KAB_EMBEDDED | 1603 | #else //KAB_EMBEDDED |
1589 | qDebug("KABCore::getNameByPhone finsih method"); | 1604 | qDebug("KABCore::getNameByPhone finsih method"); |
1590 | return ""; | 1605 | return ""; |
1591 | #endif //KAB_EMBEDDED | 1606 | #endif //KAB_EMBEDDED |
1592 | 1607 | ||
1593 | } | 1608 | } |
1594 | 1609 | ||
1595 | void KABCore::openConfigDialog() | 1610 | void KABCore::openConfigDialog() |
1596 | { | 1611 | { |
1597 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1612 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1598 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1613 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1599 | ConfigureDialog->addModule(kabcfg ); | 1614 | ConfigureDialog->addModule(kabcfg ); |
1600 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1615 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1601 | ConfigureDialog->addModule(kdelibcfg ); | 1616 | ConfigureDialog->addModule(kdelibcfg ); |
1602 | 1617 | ||
1603 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1618 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1604 | this, SLOT( configurationChanged() ) ); | 1619 | this, SLOT( configurationChanged() ) ); |
1605 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1620 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1606 | this, SLOT( configurationChanged() ) ); | 1621 | this, SLOT( configurationChanged() ) ); |
1607 | saveSettings(); | 1622 | saveSettings(); |
1608 | #ifndef DESKTOP_VERSION | 1623 | #ifndef DESKTOP_VERSION |
1609 | ConfigureDialog->showMaximized(); | 1624 | ConfigureDialog->showMaximized(); |
1610 | #endif | 1625 | #endif |
1611 | if ( ConfigureDialog->exec() ) | 1626 | if ( ConfigureDialog->exec() ) |
1612 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1627 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1613 | delete ConfigureDialog; | 1628 | delete ConfigureDialog; |
1614 | } | 1629 | } |
1615 | 1630 | ||
1616 | void KABCore::openLDAPDialog() | 1631 | void KABCore::openLDAPDialog() |
1617 | { | 1632 | { |
1618 | #ifndef KAB_EMBEDDED | 1633 | #ifndef KAB_EMBEDDED |
1619 | if ( !mLdapSearchDialog ) { | 1634 | if ( !mLdapSearchDialog ) { |
1620 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1635 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1621 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1636 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1622 | SLOT( refreshView() ) ); | 1637 | SLOT( refreshView() ) ); |
1623 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1638 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1624 | SLOT( setModified() ) ); | 1639 | SLOT( setModified() ) ); |
1625 | } else | 1640 | } else |
1626 | mLdapSearchDialog->restoreSettings(); | 1641 | mLdapSearchDialog->restoreSettings(); |
1627 | 1642 | ||
1628 | if ( mLdapSearchDialog->isOK() ) | 1643 | if ( mLdapSearchDialog->isOK() ) |
1629 | mLdapSearchDialog->exec(); | 1644 | mLdapSearchDialog->exec(); |
1630 | #else //KAB_EMBEDDED | 1645 | #else //KAB_EMBEDDED |
1631 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1646 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1632 | #endif //KAB_EMBEDDED | 1647 | #endif //KAB_EMBEDDED |
1633 | } | 1648 | } |
1634 | 1649 | ||
1635 | void KABCore::print() | 1650 | void KABCore::print() |
1636 | { | 1651 | { |
1637 | #ifndef KAB_EMBEDDED | 1652 | #ifndef KAB_EMBEDDED |
1638 | KPrinter printer; | 1653 | KPrinter printer; |
1639 | if ( !printer.setup( this ) ) | 1654 | if ( !printer.setup( this ) ) |
1640 | return; | 1655 | return; |
1641 | 1656 | ||
1642 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1657 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1643 | mViewManager->selectedUids(), this ); | 1658 | mViewManager->selectedUids(), this ); |
1644 | 1659 | ||
1645 | wizard.exec(); | 1660 | wizard.exec(); |
1646 | #else //KAB_EMBEDDED | 1661 | #else //KAB_EMBEDDED |
1647 | qDebug("KABCore::print() finsih method"); | 1662 | qDebug("KABCore::print() finsih method"); |
1648 | #endif //KAB_EMBEDDED | 1663 | #endif //KAB_EMBEDDED |
1649 | 1664 | ||
1650 | } | 1665 | } |
1651 | 1666 | ||
1652 | 1667 | ||
1653 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1668 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1654 | { | 1669 | { |
1655 | if ( mGUIClient ) | 1670 | if ( mGUIClient ) |
1656 | mGUIClient->insertChildClient( client ); | 1671 | mGUIClient->insertChildClient( client ); |
1657 | else | 1672 | else |
1658 | KMessageBox::error( this, "no KXMLGUICLient"); | 1673 | KMessageBox::error( this, "no KXMLGUICLient"); |
1659 | } | 1674 | } |
1660 | 1675 | ||
1661 | 1676 | ||
1662 | void KABCore::configurationChanged() | 1677 | void KABCore::configurationChanged() |
1663 | { | 1678 | { |
1664 | mExtensionManager->reconfigure(); | 1679 | mExtensionManager->reconfigure(); |
1665 | } | 1680 | } |
1666 | 1681 | ||
1667 | void KABCore::addressBookChanged() | 1682 | void KABCore::addressBookChanged() |
1668 | { | 1683 | { |
1669 | /*US | 1684 | /*US |
1670 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1685 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1671 | while ( it.current() ) { | 1686 | while ( it.current() ) { |
1672 | if ( it.current()->dirty() ) { | 1687 | if ( it.current()->dirty() ) { |
1673 | QString text = i18n( "Data has been changed externally. Unsaved " | 1688 | QString text = i18n( "Data has been changed externally. Unsaved " |
1674 | "changes will be lost." ); | 1689 | "changes will be lost." ); |
1675 | KMessageBox::information( this, text ); | 1690 | KMessageBox::information( this, text ); |
1676 | } | 1691 | } |
1677 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1692 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1678 | ++it; | 1693 | ++it; |
1679 | } | 1694 | } |
1680 | */ | 1695 | */ |
1681 | if (mEditorDialog) | 1696 | if (mEditorDialog) |
1682 | { | 1697 | { |
1683 | if (mEditorDialog->dirty()) | 1698 | if (mEditorDialog->dirty()) |
1684 | { | 1699 | { |
1685 | QString text = i18n( "Data has been changed externally. Unsaved " | 1700 | QString text = i18n( "Data has been changed externally. Unsaved " |
1686 | "changes will be lost." ); | 1701 | "changes will be lost." ); |
1687 | KMessageBox::information( this, text ); | 1702 | KMessageBox::information( this, text ); |
1688 | } | 1703 | } |
1689 | QString currentuid = mEditorDialog->addressee().uid(); | 1704 | QString currentuid = mEditorDialog->addressee().uid(); |
1690 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1705 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1691 | } | 1706 | } |
1692 | mViewManager->refreshView(); | 1707 | mViewManager->refreshView(); |
1693 | 1708 | ||
1694 | 1709 | ||
1695 | } | 1710 | } |
1696 | 1711 | ||
1697 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1712 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1698 | const char *name ) | 1713 | const char *name ) |
1699 | { | 1714 | { |
1700 | 1715 | ||
1701 | if ( mEditorDialog == 0 ) { | 1716 | if ( mEditorDialog == 0 ) { |
1702 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1717 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1703 | name ? name : "editorDialog" ); | 1718 | name ? name : "editorDialog" ); |
1704 | 1719 | ||
1705 | 1720 | ||
1706 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1721 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1707 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1722 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1708 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1723 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1709 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1724 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1710 | } | 1725 | } |
1711 | 1726 | ||
1712 | return mEditorDialog; | 1727 | return mEditorDialog; |
1713 | } | 1728 | } |
1714 | 1729 | ||
1715 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1730 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1716 | { | 1731 | { |
1717 | //mEditorDict.remove( uid ); | 1732 | //mEditorDict.remove( uid ); |
1718 | } | 1733 | } |
1719 | 1734 | ||
1720 | void KABCore::initGUI() | 1735 | void KABCore::initGUI() |
1721 | { | 1736 | { |
1722 | #ifndef KAB_EMBEDDED | 1737 | #ifndef KAB_EMBEDDED |
1723 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1738 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1724 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1739 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1725 | 1740 | ||
1726 | mExtensionBarSplitter = new QSplitter( this ); | 1741 | mExtensionBarSplitter = new QSplitter( this ); |
1727 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1742 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1728 | 1743 | ||
1729 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1744 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1730 | 1745 | ||
1731 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1746 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1732 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1747 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1733 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1748 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1734 | SLOT( incrementalSearch( const QString& ) ) ); | 1749 | SLOT( incrementalSearch( const QString& ) ) ); |
1735 | 1750 | ||
1736 | mViewManager = new ViewManager( this, viewSpace ); | 1751 | mViewManager = new ViewManager( this, viewSpace ); |
1737 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1752 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1738 | 1753 | ||
1739 | mDetails = new ViewContainer( mDetailsSplitter ); | 1754 | mDetails = new ViewContainer( mDetailsSplitter ); |
1740 | 1755 | ||
1741 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1756 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1742 | 1757 | ||
1743 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1758 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1744 | 1759 | ||
1745 | topLayout->addWidget( mExtensionBarSplitter ); | 1760 | topLayout->addWidget( mExtensionBarSplitter ); |
1746 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1761 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1747 | topLayout->addWidget( mJumpButtonBar ); | 1762 | topLayout->addWidget( mJumpButtonBar ); |
1748 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1763 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1749 | 1764 | ||
1750 | mXXPortManager = new XXPortManager( this, this ); | 1765 | mXXPortManager = new XXPortManager( this, this ); |
1751 | 1766 | ||
1752 | #else //KAB_EMBEDDED | 1767 | #else //KAB_EMBEDDED |
1753 | //US initialize viewMenu before settingup viewmanager. | 1768 | //US initialize viewMenu before settingup viewmanager. |
1754 | // Viewmanager needs this menu to plugin submenues. | 1769 | // Viewmanager needs this menu to plugin submenues. |
1755 | viewMenu = new QPopupMenu( this ); | 1770 | viewMenu = new QPopupMenu( this ); |
1756 | settingsMenu = new QPopupMenu( this ); | 1771 | settingsMenu = new QPopupMenu( this ); |
1757 | //filterMenu = new QPopupMenu( this ); | 1772 | //filterMenu = new QPopupMenu( this ); |
1758 | ImportMenu = new QPopupMenu( this ); | 1773 | ImportMenu = new QPopupMenu( this ); |
1759 | ExportMenu = new QPopupMenu( this ); | 1774 | ExportMenu = new QPopupMenu( this ); |
1760 | syncMenu = new QPopupMenu( this ); | 1775 | syncMenu = new QPopupMenu( this ); |
1761 | changeMenu= new QPopupMenu( this ); | 1776 | changeMenu= new QPopupMenu( this ); |
1762 | beamMenu= new QPopupMenu( this ); | 1777 | beamMenu= new QPopupMenu( this ); |
1763 | 1778 | ||
1764 | //US since we have no splitter for the embedded system, setup | 1779 | //US since we have no splitter for the embedded system, setup |
1765 | // a layout with two frames. One left and one right. | 1780 | // a layout with two frames. One left and one right. |
1766 | 1781 | ||
1767 | QBoxLayout *topLayout; | 1782 | QBoxLayout *topLayout; |
1768 | 1783 | ||
1769 | // = new QHBoxLayout( this ); | 1784 | // = new QHBoxLayout( this ); |
1770 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1785 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1771 | 1786 | ||
1772 | // QWidget *mainBox = new QWidget( this ); | 1787 | // QWidget *mainBox = new QWidget( this ); |
1773 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1788 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1774 | 1789 | ||
1775 | #ifdef DESKTOP_VERSION | 1790 | #ifdef DESKTOP_VERSION |
1776 | topLayout = new QHBoxLayout( this ); | 1791 | topLayout = new QHBoxLayout( this ); |
1777 | 1792 | ||
1778 | 1793 | ||
1779 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1794 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1780 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1795 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1781 | 1796 | ||
1782 | topLayout->addWidget(mMiniSplitter ); | 1797 | topLayout->addWidget(mMiniSplitter ); |
1783 | 1798 | ||
1784 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1799 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1785 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1800 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1786 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1801 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1787 | mDetails = new ViewContainer( mMiniSplitter ); | 1802 | mDetails = new ViewContainer( mMiniSplitter ); |
1788 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1803 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1789 | #else | 1804 | #else |
1790 | if ( QApplication::desktop()->width() > 480 ) { | 1805 | if ( QApplication::desktop()->width() > 480 ) { |
1791 | topLayout = new QHBoxLayout( this ); | 1806 | topLayout = new QHBoxLayout( this ); |
1792 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1807 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1793 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1808 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1794 | } else { | 1809 | } else { |
1795 | 1810 | ||
1796 | topLayout = new QHBoxLayout( this ); | 1811 | topLayout = new QHBoxLayout( this ); |
1797 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1812 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1798 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1813 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1799 | } | 1814 | } |
1800 | 1815 | ||
1801 | topLayout->addWidget(mMiniSplitter ); | 1816 | topLayout->addWidget(mMiniSplitter ); |
1802 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1817 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1803 | mDetails = new ViewContainer( mMiniSplitter ); | 1818 | mDetails = new ViewContainer( mMiniSplitter ); |
1804 | 1819 | ||
1805 | 1820 | ||
1806 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1821 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1807 | #endif | 1822 | #endif |
1808 | //eh->hide(); | 1823 | //eh->hide(); |
1809 | // topLayout->addWidget(mExtensionManager ); | 1824 | // topLayout->addWidget(mExtensionManager ); |
1810 | 1825 | ||
1811 | 1826 | ||
1812 | /*US | 1827 | /*US |
1813 | #ifndef KAB_NOSPLITTER | 1828 | #ifndef KAB_NOSPLITTER |
1814 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1829 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1815 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1830 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1816 | topLayout->setSpacing( 10 ); | 1831 | topLayout->setSpacing( 10 ); |
1817 | 1832 | ||
1818 | mDetailsSplitter = new QSplitter( this ); | 1833 | mDetailsSplitter = new QSplitter( this ); |
1819 | 1834 | ||
1820 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1835 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1821 | 1836 | ||
1822 | mViewManager = new ViewManager( this, viewSpace ); | 1837 | mViewManager = new ViewManager( this, viewSpace ); |
1823 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1838 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1824 | 1839 | ||
1825 | mDetails = new ViewContainer( mDetailsSplitter ); | 1840 | mDetails = new ViewContainer( mDetailsSplitter ); |
1826 | 1841 | ||
1827 | topLayout->addWidget( mDetailsSplitter ); | 1842 | topLayout->addWidget( mDetailsSplitter ); |
1828 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1843 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1829 | #else //KAB_NOSPLITTER | 1844 | #else //KAB_NOSPLITTER |
1830 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1845 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1831 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1846 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1832 | topLayout->setSpacing( 10 ); | 1847 | topLayout->setSpacing( 10 ); |
1833 | 1848 | ||
1834 | // mDetailsSplitter = new QSplitter( this ); | 1849 | // mDetailsSplitter = new QSplitter( this ); |
1835 | 1850 | ||
1836 | QVBox *viewSpace = new QVBox( this ); | 1851 | QVBox *viewSpace = new QVBox( this ); |
1837 | 1852 | ||
1838 | mViewManager = new ViewManager( this, viewSpace ); | 1853 | mViewManager = new ViewManager( this, viewSpace ); |
1839 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1854 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1840 | 1855 | ||
1841 | mDetails = new ViewContainer( this ); | 1856 | mDetails = new ViewContainer( this ); |
1842 | 1857 | ||
1843 | topLayout->addWidget( viewSpace ); | 1858 | topLayout->addWidget( viewSpace ); |
1844 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1859 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1845 | topLayout->addWidget( mDetails ); | 1860 | topLayout->addWidget( mDetails ); |
1846 | #endif //KAB_NOSPLITTER | 1861 | #endif //KAB_NOSPLITTER |
1847 | */ | 1862 | */ |
1848 | 1863 | ||
1849 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1864 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1850 | syncManager->setBlockSave(false); | 1865 | syncManager->setBlockSave(false); |
1851 | 1866 | ||
1852 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1867 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1853 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1868 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1854 | QString sync_file = sentSyncFile(); | 1869 | QString sync_file = sentSyncFile(); |
1855 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1870 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1856 | syncManager->setDefaultFileName( sync_file ); | 1871 | syncManager->setDefaultFileName( sync_file ); |
1857 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1872 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1858 | 1873 | ||
1859 | #endif //KAB_EMBEDDED | 1874 | #endif //KAB_EMBEDDED |
1860 | initActions(); | 1875 | initActions(); |
1861 | 1876 | ||
1862 | #ifdef KAB_EMBEDDED | 1877 | #ifdef KAB_EMBEDDED |
1863 | addActionsManually(); | 1878 | addActionsManually(); |
1864 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1879 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1865 | mXXPortManager = new XXPortManager( this, this ); | 1880 | mXXPortManager = new XXPortManager( this, this ); |
1866 | 1881 | ||
1867 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1882 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1868 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1883 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1869 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1884 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1870 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1885 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1871 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1886 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1872 | // mIncSearchWidget->hide(); | 1887 | // mIncSearchWidget->hide(); |
1873 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1888 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1874 | SLOT( incrementalSearch( const QString& ) ) ); | 1889 | SLOT( incrementalSearch( const QString& ) ) ); |
1875 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1890 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1876 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1891 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1877 | 1892 | ||
1878 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1893 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1879 | 1894 | ||
1880 | topLayout->addWidget( mJumpButtonBar ); | 1895 | topLayout->addWidget( mJumpButtonBar ); |
1881 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1896 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1882 | 1897 | ||
1883 | // mMainWindow->getIconToolBar()->raise(); | 1898 | // mMainWindow->getIconToolBar()->raise(); |
1884 | 1899 | ||
1885 | #endif //KAB_EMBEDDED | 1900 | #endif //KAB_EMBEDDED |
1886 | 1901 | ||
1887 | } | 1902 | } |
1888 | void KABCore::initActions() | 1903 | void KABCore::initActions() |
1889 | { | 1904 | { |
1890 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1905 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1891 | 1906 | ||
1892 | #ifndef KAB_EMBEDDED | 1907 | #ifndef KAB_EMBEDDED |
1893 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1908 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1894 | SLOT( clipboardDataChanged() ) ); | 1909 | SLOT( clipboardDataChanged() ) ); |
1895 | #endif //KAB_EMBEDDED | 1910 | #endif //KAB_EMBEDDED |
1896 | 1911 | ||
1897 | // file menu | 1912 | // file menu |
1898 | 1913 | ||
1899 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1914 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1900 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1915 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1901 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 1916 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1902 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 1917 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
1903 | 1918 | ||
1904 | 1919 | ||
1905 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 1920 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
1906 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 1921 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
1907 | 1922 | ||
1908 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1923 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1909 | SLOT( save() ), actionCollection(), "file_sync" ); | 1924 | SLOT( save() ), actionCollection(), "file_sync" ); |
1910 | 1925 | ||
1911 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1926 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1912 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1927 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1913 | 1928 | ||
1914 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1929 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1915 | this, SLOT( mailVCard() ), | 1930 | this, SLOT( mailVCard() ), |
1916 | actionCollection(), "file_mail_vcard"); | 1931 | actionCollection(), "file_mail_vcard"); |
1917 | 1932 | ||
1918 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1933 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1919 | SLOT( export2phone() ), actionCollection(), | 1934 | SLOT( export2phone() ), actionCollection(), |
1920 | "kaddressbook_ex2phone" ); | 1935 | "kaddressbook_ex2phone" ); |
1921 | 1936 | ||
1922 | mActionBeamVCard = 0; | 1937 | mActionBeamVCard = 0; |
1923 | mActionBeam = 0; | 1938 | mActionBeam = 0; |
1924 | 1939 | ||
1925 | #ifndef DESKTOP_VERSION | 1940 | #ifndef DESKTOP_VERSION |
1926 | if ( Ir::supported() ) { | 1941 | if ( Ir::supported() ) { |
1927 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1942 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1928 | SLOT( beamVCard() ), actionCollection(), | 1943 | SLOT( beamVCard() ), actionCollection(), |
1929 | "kaddressbook_beam_vcard" ); | 1944 | "kaddressbook_beam_vcard" ); |
1930 | 1945 | ||
1931 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1946 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1932 | SLOT( beamMySelf() ), actionCollection(), | 1947 | SLOT( beamMySelf() ), actionCollection(), |
1933 | "kaddressbook_beam_myself" ); | 1948 | "kaddressbook_beam_myself" ); |
1934 | } | 1949 | } |
1935 | #endif | 1950 | #endif |
1936 | 1951 | ||
1937 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1952 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1938 | this, SLOT( editContact2() ), | 1953 | this, SLOT( editContact2() ), |
1939 | actionCollection(), "file_properties" ); | 1954 | actionCollection(), "file_properties" ); |
1940 | 1955 | ||
1941 | #ifdef KAB_EMBEDDED | 1956 | #ifdef KAB_EMBEDDED |
1942 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1957 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1943 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1958 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1944 | mMainWindow, SLOT( exit() ), | 1959 | mMainWindow, SLOT( exit() ), |
1945 | actionCollection(), "quit" ); | 1960 | actionCollection(), "quit" ); |
1946 | #endif //KAB_EMBEDDED | 1961 | #endif //KAB_EMBEDDED |
1947 | 1962 | ||
1948 | // edit menu | 1963 | // edit menu |
1949 | if ( mIsPart ) { | 1964 | if ( mIsPart ) { |
1950 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1965 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1951 | SLOT( copyContacts() ), actionCollection(), | 1966 | SLOT( copyContacts() ), actionCollection(), |
1952 | "kaddressbook_copy" ); | 1967 | "kaddressbook_copy" ); |
1953 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1968 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1954 | SLOT( cutContacts() ), actionCollection(), | 1969 | SLOT( cutContacts() ), actionCollection(), |
1955 | "kaddressbook_cut" ); | 1970 | "kaddressbook_cut" ); |
1956 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1971 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1957 | SLOT( pasteContacts() ), actionCollection(), | 1972 | SLOT( pasteContacts() ), actionCollection(), |
1958 | "kaddressbook_paste" ); | 1973 | "kaddressbook_paste" ); |
1959 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1974 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1960 | SLOT( selectAllContacts() ), actionCollection(), | 1975 | SLOT( selectAllContacts() ), actionCollection(), |
1961 | "kaddressbook_select_all" ); | 1976 | "kaddressbook_select_all" ); |
1962 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1977 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1963 | SLOT( undo() ), actionCollection(), | 1978 | SLOT( undo() ), actionCollection(), |
1964 | "kaddressbook_undo" ); | 1979 | "kaddressbook_undo" ); |
1965 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1980 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1966 | this, SLOT( redo() ), actionCollection(), | 1981 | this, SLOT( redo() ), actionCollection(), |
1967 | "kaddressbook_redo" ); | 1982 | "kaddressbook_redo" ); |
1968 | } else { | 1983 | } else { |
1969 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1984 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1970 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1985 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1971 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1986 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1972 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1987 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1973 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1988 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1974 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1989 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1975 | } | 1990 | } |
1976 | 1991 | ||
1977 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1992 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1978 | Key_Delete, this, SLOT( deleteContacts() ), | 1993 | Key_Delete, this, SLOT( deleteContacts() ), |
1979 | actionCollection(), "edit_delete" ); | 1994 | actionCollection(), "edit_delete" ); |
1980 | 1995 | ||
1981 | mActionUndo->setEnabled( false ); | 1996 | mActionUndo->setEnabled( false ); |
1982 | mActionRedo->setEnabled( false ); | 1997 | mActionRedo->setEnabled( false ); |
1983 | 1998 | ||
1984 | // settings menu | 1999 | // settings menu |
1985 | #ifdef KAB_EMBEDDED | 2000 | #ifdef KAB_EMBEDDED |
1986 | //US special menuentry to configure the addressbook resources. On KDE | 2001 | //US special menuentry to configure the addressbook resources. On KDE |
1987 | // you do that through the control center !!! | 2002 | // you do that through the control center !!! |
1988 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2003 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1989 | SLOT( configureResources() ), actionCollection(), | 2004 | SLOT( configureResources() ), actionCollection(), |
1990 | "kaddressbook_configure_resources" ); | 2005 | "kaddressbook_configure_resources" ); |
1991 | #endif //KAB_EMBEDDED | 2006 | #endif //KAB_EMBEDDED |
1992 | 2007 | ||
1993 | if ( mIsPart ) { | 2008 | if ( mIsPart ) { |
1994 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 2009 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1995 | SLOT( openConfigDialog() ), actionCollection(), | 2010 | SLOT( openConfigDialog() ), actionCollection(), |
1996 | "kaddressbook_configure" ); | 2011 | "kaddressbook_configure" ); |
1997 | 2012 | ||
1998 | //US not implemented yet | 2013 | //US not implemented yet |
1999 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 2014 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
2000 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 2015 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
2001 | // "kaddressbook_configure_shortcuts" ); | 2016 | // "kaddressbook_configure_shortcuts" ); |
2002 | #ifdef KAB_EMBEDDED | 2017 | #ifdef KAB_EMBEDDED |
2003 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 2018 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
2004 | mActionConfigureToolbars->setEnabled( false ); | 2019 | mActionConfigureToolbars->setEnabled( false ); |
2005 | #endif //KAB_EMBEDDED | 2020 | #endif //KAB_EMBEDDED |
2006 | 2021 | ||
2007 | } else { | 2022 | } else { |
2008 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 2023 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
2009 | 2024 | ||
2010 | //US not implemented yet | 2025 | //US not implemented yet |
2011 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 2026 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
2012 | } | 2027 | } |
2013 | 2028 | ||
2014 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2029 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2015 | actionCollection(), "options_show_jump_bar" ); | 2030 | actionCollection(), "options_show_jump_bar" ); |
2016 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2031 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2017 | 2032 | ||
2018 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2033 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2019 | actionCollection(), "options_show_details" ); | 2034 | actionCollection(), "options_show_details" ); |
2020 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2035 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2021 | 2036 | ||
2022 | 2037 | ||
2023 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2038 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2024 | SLOT( toggleBeamReceive() ), actionCollection(), | 2039 | SLOT( toggleBeamReceive() ), actionCollection(), |
2025 | "kaddressbook_beam_rec" ); | 2040 | "kaddressbook_beam_rec" ); |
2026 | 2041 | ||
2027 | 2042 | ||
2028 | // misc | 2043 | // misc |
2029 | // only enable LDAP lookup if we can handle the protocol | 2044 | // only enable LDAP lookup if we can handle the protocol |
2030 | #ifndef KAB_EMBEDDED | 2045 | #ifndef KAB_EMBEDDED |
2031 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2046 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2032 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2047 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2033 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2048 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2034 | "ldap_lookup" ); | 2049 | "ldap_lookup" ); |
2035 | } | 2050 | } |
2036 | #else //KAB_EMBEDDED | 2051 | #else //KAB_EMBEDDED |
2037 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2052 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2038 | #endif //KAB_EMBEDDED | 2053 | #endif //KAB_EMBEDDED |
2039 | 2054 | ||
2040 | 2055 | ||
2041 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2056 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2042 | SLOT( setWhoAmI() ), actionCollection(), | 2057 | SLOT( setWhoAmI() ), actionCollection(), |
2043 | "set_personal" ); | 2058 | "set_personal" ); |
2044 | 2059 | ||
2045 | 2060 | ||
2046 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2061 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2047 | SLOT( setCategories() ), actionCollection(), | 2062 | SLOT( setCategories() ), actionCollection(), |
2048 | "edit_set_categories" ); | 2063 | "edit_set_categories" ); |
2049 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2064 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2050 | SLOT( editCategories() ), actionCollection(), | 2065 | SLOT( editCategories() ), actionCollection(), |
2051 | "edit__categories" ); | 2066 | "edit__categories" ); |
2052 | 2067 | ||
2053 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2068 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2054 | SLOT( removeVoice() ), actionCollection(), | 2069 | SLOT( removeVoice() ), actionCollection(), |
2055 | "remove_voice" ); | 2070 | "remove_voice" ); |
2056 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2071 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2057 | SLOT( setFormattedName() ), actionCollection(), | 2072 | SLOT( setFormattedName() ), actionCollection(), |
2058 | "set_formatted" ); | 2073 | "set_formatted" ); |
2059 | 2074 | ||
2060 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2075 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2061 | SLOT( manageCategories() ), actionCollection(), | 2076 | SLOT( manageCategories() ), actionCollection(), |
2062 | "remove_voice" ); | 2077 | "remove_voice" ); |
2063 | 2078 | ||
2064 | 2079 | ||
2065 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2080 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2066 | SLOT( importFromOL() ), actionCollection(), | 2081 | SLOT( importFromOL() ), actionCollection(), |
2067 | "import_OL" ); | 2082 | "import_OL" ); |
2068 | #ifdef KAB_EMBEDDED | 2083 | #ifdef KAB_EMBEDDED |
2069 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2084 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2070 | this, SLOT( showLicence() ), actionCollection(), | 2085 | this, SLOT( showLicence() ), actionCollection(), |
2071 | "licence_about_data" ); | 2086 | "licence_about_data" ); |
2072 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2087 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2073 | this, SLOT( faq() ), actionCollection(), | 2088 | this, SLOT( faq() ), actionCollection(), |
2074 | "faq_about_data" ); | 2089 | "faq_about_data" ); |
2075 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2090 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2076 | this, SLOT( whatsnew() ), actionCollection(), | 2091 | this, SLOT( whatsnew() ), actionCollection(), |
2077 | "wn" ); | 2092 | "wn" ); |
2078 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2093 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2079 | this, SLOT( synchowto() ), actionCollection(), | 2094 | this, SLOT( synchowto() ), actionCollection(), |
2080 | "sync" ); | 2095 | "sync" ); |
2081 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2096 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2082 | this, SLOT( kdesynchowto() ), actionCollection(), | 2097 | this, SLOT( kdesynchowto() ), actionCollection(), |
2083 | "kdesync" ); | 2098 | "kdesync" ); |
2084 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2099 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2085 | this, SLOT( multisynchowto() ), actionCollection(), | 2100 | this, SLOT( multisynchowto() ), actionCollection(), |
2086 | "multisync" ); | 2101 | "multisync" ); |
2087 | 2102 | ||
2088 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2103 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2089 | this, SLOT( createAboutData() ), actionCollection(), | 2104 | this, SLOT( createAboutData() ), actionCollection(), |
2090 | "kaddressbook_about_data" ); | 2105 | "kaddressbook_about_data" ); |
2091 | #endif //KAB_EMBEDDED | 2106 | #endif //KAB_EMBEDDED |
2092 | 2107 | ||
2093 | clipboardDataChanged(); | 2108 | clipboardDataChanged(); |
2094 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2109 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2095 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2110 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2096 | } | 2111 | } |
2097 | 2112 | ||
2098 | //US we need this function, to plug all actions into the correct menues. | 2113 | //US we need this function, to plug all actions into the correct menues. |
2099 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2114 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2100 | void KABCore::addActionsManually() | 2115 | void KABCore::addActionsManually() |
2101 | { | 2116 | { |
2102 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2117 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2103 | 2118 | ||
2104 | #ifdef KAB_EMBEDDED | 2119 | #ifdef KAB_EMBEDDED |
2105 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2120 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2106 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2121 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2107 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2122 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2108 | 2123 | ||
2109 | KToolBar* tb = mMainWindow->toolBar(); | 2124 | KToolBar* tb = mMainWindow->toolBar(); |
2110 | 2125 | ||
2111 | #ifndef DESKTOP_VERSION | 2126 | #ifndef DESKTOP_VERSION |
2112 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2127 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2113 | #endif | 2128 | #endif |
2114 | QMenuBar* mb = mMainWindow->menuBar(); | 2129 | QMenuBar* mb = mMainWindow->menuBar(); |
2115 | 2130 | ||
2116 | //US setup menubar. | 2131 | //US setup menubar. |
2117 | //Disable the following block if you do not want to have a menubar. | 2132 | //Disable the following block if you do not want to have a menubar. |
2118 | mb->insertItem( i18n("&File"), fileMenu ); | 2133 | mb->insertItem( i18n("&File"), fileMenu ); |
2119 | mb->insertItem( i18n("&Edit"), editMenu ); | 2134 | mb->insertItem( i18n("&Edit"), editMenu ); |
2120 | mb->insertItem( i18n("&View"), viewMenu ); | 2135 | mb->insertItem( i18n("&View"), viewMenu ); |
2121 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2136 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2122 | #ifdef DESKTOP_VERSION | 2137 | #ifdef DESKTOP_VERSION |
2123 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2138 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2124 | #else | 2139 | #else |
2125 | mb->insertItem( i18n("Sync"), syncMenu ); | 2140 | mb->insertItem( i18n("Sync"), syncMenu ); |
2126 | #endif | 2141 | #endif |
2127 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2142 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2128 | mb->insertItem( i18n("&Help"), helpMenu ); | 2143 | mb->insertItem( i18n("&Help"), helpMenu ); |
2129 | mIncSearchWidget = new IncSearchWidget( tb ); | 2144 | mIncSearchWidget = new IncSearchWidget( tb ); |
2130 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2145 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2131 | #ifndef DESKTOP_VERSION | 2146 | #ifndef DESKTOP_VERSION |
2132 | } else { | 2147 | } else { |
2133 | //US setup toolbar | 2148 | //US setup toolbar |
2134 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2149 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2135 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2150 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2136 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2151 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2137 | tb->insertWidget(-1, 0, menuBarTB); | 2152 | tb->insertWidget(-1, 0, menuBarTB); |
2138 | mIncSearchWidget = new IncSearchWidget( tb ); | 2153 | mIncSearchWidget = new IncSearchWidget( tb ); |
2139 | tb->enableMoving(false); | 2154 | tb->enableMoving(false); |
2140 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2155 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2141 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2156 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2142 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2157 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2143 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2158 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2144 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2159 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2145 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2160 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2146 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2161 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2147 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2162 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2148 | if (QApplication::desktop()->width() > 320 ) { | 2163 | if (QApplication::desktop()->width() > 320 ) { |
2149 | // mViewManager->getFilterAction()->plug ( tb); | 2164 | // mViewManager->getFilterAction()->plug ( tb); |
2150 | } | 2165 | } |
2151 | } | 2166 | } |
2152 | #endif | 2167 | #endif |
2153 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2168 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2154 | 2169 | ||
2155 | 2170 | ||
2156 | 2171 | ||
2157 | //US Now connect the actions with the menue entries. | 2172 | //US Now connect the actions with the menue entries. |
2158 | #ifdef DESKTOP_VERSION | 2173 | #ifdef DESKTOP_VERSION |
2159 | mActionPrint->plug( fileMenu ); | 2174 | mActionPrint->plug( fileMenu ); |
2160 | mActionPrintDetails->plug( fileMenu ); | 2175 | mActionPrintDetails->plug( fileMenu ); |
2161 | fileMenu->insertSeparator(); | 2176 | fileMenu->insertSeparator(); |
2162 | #endif | 2177 | #endif |
2163 | mActionMail->plug( fileMenu ); | 2178 | mActionMail->plug( fileMenu ); |
2164 | fileMenu->insertSeparator(); | 2179 | fileMenu->insertSeparator(); |
2165 | 2180 | ||
2166 | mActionNewContact->plug( fileMenu ); | 2181 | mActionNewContact->plug( fileMenu ); |
2167 | mActionNewContact->plug( tb ); | 2182 | mActionNewContact->plug( tb ); |
2168 | 2183 | ||
2169 | mActionEditAddressee->plug( fileMenu ); | 2184 | mActionEditAddressee->plug( fileMenu ); |
2170 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2185 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2171 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2186 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2172 | mActionEditAddressee->plug( tb ); | 2187 | mActionEditAddressee->plug( tb ); |
2173 | 2188 | ||
2174 | fileMenu->insertSeparator(); | 2189 | fileMenu->insertSeparator(); |
2175 | mActionSave->plug( fileMenu ); | 2190 | mActionSave->plug( fileMenu ); |
2176 | fileMenu->insertItem( "&Import", ImportMenu ); | 2191 | fileMenu->insertItem( "&Import", ImportMenu ); |
2177 | fileMenu->insertItem( "&Export", ExportMenu ); | 2192 | fileMenu->insertItem( "&Export", ExportMenu ); |
2178 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2193 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2179 | #ifndef DESKTOP_VERSION | 2194 | #ifndef DESKTOP_VERSION |
2180 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2195 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2181 | #endif | 2196 | #endif |
2182 | #if 0 | 2197 | #if 0 |
2183 | // PENDING fix MailVCard | 2198 | // PENDING fix MailVCard |
2184 | fileMenu->insertSeparator(); | 2199 | fileMenu->insertSeparator(); |
2185 | mActionMailVCard->plug( fileMenu ); | 2200 | mActionMailVCard->plug( fileMenu ); |
2186 | #endif | 2201 | #endif |
2187 | #ifndef DESKTOP_VERSION | 2202 | #ifndef DESKTOP_VERSION |
2188 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2203 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2189 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2204 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2190 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2205 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2191 | #endif | 2206 | #endif |
2192 | fileMenu->insertSeparator(); | 2207 | fileMenu->insertSeparator(); |
2193 | mActionQuit->plug( fileMenu ); | 2208 | mActionQuit->plug( fileMenu ); |
2194 | #ifdef _OL_IMPORT_ | 2209 | #ifdef _OL_IMPORT_ |
2195 | mActionImportOL->plug( ImportMenu ); | 2210 | mActionImportOL->plug( ImportMenu ); |
2196 | #endif | 2211 | #endif |
2197 | // edit menu | 2212 | // edit menu |
2198 | mActionUndo->plug( editMenu ); | 2213 | mActionUndo->plug( editMenu ); |
2199 | mActionRedo->plug( editMenu ); | 2214 | mActionRedo->plug( editMenu ); |
2200 | editMenu->insertSeparator(); | 2215 | editMenu->insertSeparator(); |
2201 | mActionCut->plug( editMenu ); | 2216 | mActionCut->plug( editMenu ); |
2202 | mActionCopy->plug( editMenu ); | 2217 | mActionCopy->plug( editMenu ); |
2203 | mActionPaste->plug( editMenu ); | 2218 | mActionPaste->plug( editMenu ); |
2204 | mActionDelete->plug( editMenu ); | 2219 | mActionDelete->plug( editMenu ); |
2205 | editMenu->insertSeparator(); | 2220 | editMenu->insertSeparator(); |
2206 | mActionSelectAll->plug( editMenu ); | 2221 | mActionSelectAll->plug( editMenu ); |
2207 | 2222 | ||
2208 | mActionSetFormattedName->plug( changeMenu ); | 2223 | mActionSetFormattedName->plug( changeMenu ); |
2209 | mActionRemoveVoice->plug( changeMenu ); | 2224 | mActionRemoveVoice->plug( changeMenu ); |
2210 | // settingsmings menu | 2225 | // settingsmings menu |
2211 | //US special menuentry to configure the addressbook resources. On KDE | 2226 | //US special menuentry to configure the addressbook resources. On KDE |
2212 | // you do that through the control center !!! | 2227 | // you do that through the control center !!! |
2213 | // settingsMenu->insertSeparator(); | 2228 | // settingsMenu->insertSeparator(); |
2214 | 2229 | ||
2215 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); | 2230 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); |
2216 | mActionConfigResources->plug( settingsMenu,1 ); | 2231 | mActionConfigResources->plug( settingsMenu,1 ); |
2217 | settingsMenu->insertSeparator(2); | 2232 | settingsMenu->insertSeparator(2); |
2218 | 2233 | ||
2219 | if ( mIsPart ) { | 2234 | if ( mIsPart ) { |
2220 | //US not implemented yet | 2235 | //US not implemented yet |
2221 | //mActionConfigShortcuts->plug( settingsMenu ); | 2236 | //mActionConfigShortcuts->plug( settingsMenu ); |
2222 | //mActionConfigureToolbars->plug( settingsMenu ); | 2237 | //mActionConfigureToolbars->plug( settingsMenu ); |
2223 | 2238 | ||
2224 | } else { | 2239 | } else { |
2225 | //US not implemented yet | 2240 | //US not implemented yet |
2226 | //mActionKeyBindings->plug( settingsMenu ); | 2241 | //mActionKeyBindings->plug( settingsMenu ); |
2227 | } | 2242 | } |
2228 | 2243 | ||
2229 | settingsMenu->insertSeparator(); | 2244 | settingsMenu->insertSeparator(); |
2230 | 2245 | ||
2231 | mActionJumpBar->plug( settingsMenu ); | 2246 | mActionJumpBar->plug( settingsMenu ); |
2232 | mActionDetails->plug( settingsMenu ); | 2247 | mActionDetails->plug( settingsMenu ); |
2233 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2248 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2234 | mActionDetails->plug( tb ); | 2249 | mActionDetails->plug( tb ); |
2235 | settingsMenu->insertSeparator(); | 2250 | settingsMenu->insertSeparator(); |
2236 | #ifndef DESKTOP_VERSION | 2251 | #ifndef DESKTOP_VERSION |
2237 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2252 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2238 | settingsMenu->insertSeparator(); | 2253 | settingsMenu->insertSeparator(); |
2239 | #endif | 2254 | #endif |
2240 | 2255 | ||
2241 | mActionWhoAmI->plug( settingsMenu ); | 2256 | mActionWhoAmI->plug( settingsMenu ); |
2242 | mActionEditCategories->plug( settingsMenu ); | 2257 | mActionEditCategories->plug( settingsMenu ); |
2243 | mActionEditCategories->plug( changeMenu ); | 2258 | mActionEditCategories->plug( changeMenu ); |
2244 | mActionCategories->plug( changeMenu ); | 2259 | mActionCategories->plug( changeMenu ); |
2245 | mActionManageCategories->plug( changeMenu ); | 2260 | mActionManageCategories->plug( changeMenu ); |
2246 | 2261 | ||
2247 | mActionCategories->plug( settingsMenu ); | 2262 | mActionCategories->plug( settingsMenu ); |
2248 | mActionManageCategories->plug( settingsMenu ); | 2263 | mActionManageCategories->plug( settingsMenu ); |
2249 | 2264 | ||
2250 | 2265 | ||
2251 | mActionWN->plug( helpMenu ); | 2266 | mActionWN->plug( helpMenu ); |
2252 | mActionSyncHowto->plug( helpMenu ); | 2267 | mActionSyncHowto->plug( helpMenu ); |
2253 | mActionKdeSyncHowto->plug( helpMenu ); | 2268 | mActionKdeSyncHowto->plug( helpMenu ); |
2254 | mActionMultiSyncHowto->plug( helpMenu ); | 2269 | mActionMultiSyncHowto->plug( helpMenu ); |
2255 | mActionFaq->plug( helpMenu ); | 2270 | mActionFaq->plug( helpMenu ); |
2256 | mActionLicence->plug( helpMenu ); | 2271 | mActionLicence->plug( helpMenu ); |
2257 | mActionAboutKAddressbook->plug( helpMenu ); | 2272 | mActionAboutKAddressbook->plug( helpMenu ); |
2258 | 2273 | ||
2259 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2274 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2260 | 2275 | ||
2261 | mActionSave->plug( tb ); | 2276 | mActionSave->plug( tb ); |
2262 | mViewManager->getFilterAction()->plug ( tb); | 2277 | mViewManager->getFilterAction()->plug ( tb); |
2263 | //LR hide filteraction on started in 480x640 | 2278 | //LR hide filteraction on started in 480x640 |
2264 | if (QApplication::desktop()->width() == 480 ) { | 2279 | if (QApplication::desktop()->width() == 480 ) { |
2265 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2280 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2266 | } | 2281 | } |
2267 | mActionUndo->plug( tb ); | 2282 | mActionUndo->plug( tb ); |
2268 | mActionDelete->plug( tb ); | 2283 | mActionDelete->plug( tb ); |
2269 | mActionRedo->plug( tb ); | 2284 | mActionRedo->plug( tb ); |
2270 | } else { | 2285 | } else { |
2271 | mActionSave->plug( tb ); | 2286 | mActionSave->plug( tb ); |
2272 | tb->enableMoving(false); | 2287 | tb->enableMoving(false); |
2273 | } | 2288 | } |
2274 | //mActionQuit->plug ( tb ); | 2289 | //mActionQuit->plug ( tb ); |
2275 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2290 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2276 | 2291 | ||
2277 | //US link the searchwidget first to this. | 2292 | //US link the searchwidget first to this. |
2278 | // The real linkage to the toolbar happens later. | 2293 | // The real linkage to the toolbar happens later. |
2279 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2294 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2280 | //US tb->insertItem( mIncSearchWidget ); | 2295 | //US tb->insertItem( mIncSearchWidget ); |
2281 | /*US | 2296 | /*US |
2282 | mIncSearchWidget = new IncSearchWidget( tb ); | 2297 | mIncSearchWidget = new IncSearchWidget( tb ); |
2283 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2298 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2284 | SLOT( incrementalSearch( const QString& ) ) ); | 2299 | SLOT( incrementalSearch( const QString& ) ) ); |
2285 | 2300 | ||
2286 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2301 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2287 | 2302 | ||
2288 | //US topLayout->addWidget( mJumpButtonBar ); | 2303 | //US topLayout->addWidget( mJumpButtonBar ); |
2289 | this->layout()->add( mJumpButtonBar ); | 2304 | this->layout()->add( mJumpButtonBar ); |
2290 | */ | 2305 | */ |
2291 | 2306 | ||
2292 | #endif //KAB_EMBEDDED | 2307 | #endif //KAB_EMBEDDED |
2293 | 2308 | ||
2294 | mActionExport2phone->plug( ExportMenu ); | 2309 | mActionExport2phone->plug( ExportMenu ); |
2295 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2310 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2296 | syncManager->fillSyncMenu(); | 2311 | syncManager->fillSyncMenu(); |
2297 | 2312 | ||
2298 | } | 2313 | } |
2299 | void KABCore::showLicence() | 2314 | void KABCore::showLicence() |
2300 | { | 2315 | { |
2301 | KApplication::showLicence(); | 2316 | KApplication::showLicence(); |
2302 | } | 2317 | } |
2303 | 2318 | ||
2304 | void KABCore::manageCategories( ) | 2319 | void KABCore::manageCategories( ) |
2305 | { | 2320 | { |
2306 | KABCatPrefs* cp = new KABCatPrefs(); | 2321 | KABCatPrefs* cp = new KABCatPrefs(); |
2307 | cp->show(); | 2322 | cp->show(); |
2308 | int w =cp->sizeHint().width() ; | 2323 | int w =cp->sizeHint().width() ; |
2309 | int h = cp->sizeHint().height() ; | 2324 | int h = cp->sizeHint().height() ; |
2310 | int dw = QApplication::desktop()->width(); | 2325 | int dw = QApplication::desktop()->width(); |
2311 | int dh = QApplication::desktop()->height(); | 2326 | int dh = QApplication::desktop()->height(); |
2312 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2327 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2313 | if ( !cp->exec() ) { | 2328 | if ( !cp->exec() ) { |
2314 | delete cp; | 2329 | delete cp; |
2315 | return; | 2330 | return; |
2316 | } | 2331 | } |
2317 | int count = 0; | 2332 | int count = 0; |
2318 | int cc = 0; | 2333 | int cc = 0; |
2319 | message( i18n("Please wait, processing categories...")); | 2334 | message( i18n("Please wait, processing categories...")); |
2320 | if ( cp->addCat() ) { | 2335 | if ( cp->addCat() ) { |
2321 | KABC::AddressBook::Iterator it; | 2336 | KABC::AddressBook::Iterator it; |
2322 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2337 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2323 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2338 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2324 | ++cc; | 2339 | ++cc; |
2325 | if ( cc %10 == 0) | 2340 | if ( cc %10 == 0) |
2326 | message(i18n("Processing contact #%1").arg(cc)); | 2341 | message(i18n("Processing contact #%1").arg(cc)); |
2327 | QStringList catIncList = (*it).categories(); | 2342 | QStringList catIncList = (*it).categories(); |
2328 | int i; | 2343 | int i; |
2329 | for( i = 0; i< catIncList.count(); ++i ) { | 2344 | for( i = 0; i< catIncList.count(); ++i ) { |
2330 | if ( !catList.contains (catIncList[i])) { | 2345 | if ( !catList.contains (catIncList[i])) { |
2331 | catList.append( catIncList[i] ); | 2346 | catList.append( catIncList[i] ); |
2332 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2347 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2333 | ++count; | 2348 | ++count; |
2334 | } | 2349 | } |
2335 | } | 2350 | } |
2336 | } | 2351 | } |
2337 | catList.sort(); | 2352 | catList.sort(); |
2338 | KABPrefs::instance()->mCustomCategories = catList; | 2353 | KABPrefs::instance()->mCustomCategories = catList; |
2339 | KABPrefs::instance()->writeConfig(); | 2354 | KABPrefs::instance()->writeConfig(); |
2340 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2355 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2341 | } else { | 2356 | } else { |
2342 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2357 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2343 | QStringList catIncList; | 2358 | QStringList catIncList; |
2344 | QStringList newCatList; | 2359 | QStringList newCatList; |
2345 | KABC::AddressBook::Iterator it; | 2360 | KABC::AddressBook::Iterator it; |
2346 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2361 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2347 | ++cc; | 2362 | ++cc; |
2348 | if ( cc %10 == 0) | 2363 | if ( cc %10 == 0) |
2349 | message(i18n("Processing contact #%1").arg(cc)); | 2364 | message(i18n("Processing contact #%1").arg(cc)); |
2350 | QStringList catIncList = (*it).categories(); | 2365 | QStringList catIncList = (*it).categories(); |
2351 | int i; | 2366 | int i; |
2352 | if ( catIncList.count() ) { | 2367 | if ( catIncList.count() ) { |
2353 | newCatList.clear(); | 2368 | newCatList.clear(); |
2354 | for( i = 0; i< catIncList.count(); ++i ) { | 2369 | for( i = 0; i< catIncList.count(); ++i ) { |
2355 | if ( catList.contains (catIncList[i])) { | 2370 | if ( catList.contains (catIncList[i])) { |
2356 | newCatList.append( catIncList[i] ); | 2371 | newCatList.append( catIncList[i] ); |
2357 | } | 2372 | } |
2358 | } | 2373 | } |
2359 | newCatList.sort(); | 2374 | newCatList.sort(); |
2360 | (*it).setCategories( newCatList ); | 2375 | (*it).setCategories( newCatList ); |
2361 | mAddressBook->insertAddressee( (*it) ); | 2376 | mAddressBook->insertAddressee( (*it) ); |
2362 | } | 2377 | } |
2363 | } | 2378 | } |
2364 | setModified( true ); | 2379 | setModified( true ); |
2365 | mViewManager->refreshView(); | 2380 | mViewManager->refreshView(); |
2366 | message( i18n("Removing categories done!")); | 2381 | message( i18n("Removing categories done!")); |
2367 | } | 2382 | } |
2368 | delete cp; | 2383 | delete cp; |
2369 | } | 2384 | } |
2370 | void KABCore::removeVoice() | 2385 | void KABCore::removeVoice() |
2371 | { | 2386 | { |
2372 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2387 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2373 | return; | 2388 | return; |
2374 | XXPortSelectDialog dlg( this, false, this ); | 2389 | XXPortSelectDialog dlg( this, false, this ); |
2375 | if ( !dlg.exec() ) | 2390 | if ( !dlg.exec() ) |
2376 | return; | 2391 | return; |
2377 | mAddressBook->setUntagged(); | 2392 | mAddressBook->setUntagged(); |
2378 | dlg.tagSelected(); | 2393 | dlg.tagSelected(); |
2379 | message(i18n("Removing voice..."), false ); | 2394 | message(i18n("Removing voice..."), false ); |
2380 | KABC::AddressBook::Iterator it; | 2395 | KABC::AddressBook::Iterator it; |
2381 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2396 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2382 | if ( (*it).tagged() ) { | 2397 | if ( (*it).tagged() ) { |
2383 | (*it).removeVoice(); | 2398 | (*it).removeVoice(); |
2384 | } | 2399 | } |
2385 | } | 2400 | } |
2386 | message(i18n("Refreshing view...") ); | 2401 | message(i18n("Refreshing view...") ); |
2387 | qApp->processEvents(); | 2402 | qApp->processEvents(); |
2388 | mViewManager->refreshView( "" ); | 2403 | mViewManager->refreshView( "" ); |
2389 | Addressee add; | 2404 | Addressee add; |
2390 | mDetails->setAddressee( add ); | 2405 | mDetails->setAddressee( add ); |
2391 | message(i18n("Remove voice completed!") ); | 2406 | message(i18n("Remove voice completed!") ); |
2392 | 2407 | ||
2393 | 2408 | ||
2394 | 2409 | ||
2395 | } | 2410 | } |
2396 | 2411 | ||
2397 | void KABCore::setFormattedName() | 2412 | void KABCore::setFormattedName() |
2398 | { | 2413 | { |
2399 | KABFormatPrefs setpref; | 2414 | KABFormatPrefs setpref; |
2400 | if ( !setpref.exec() ) { | 2415 | if ( !setpref.exec() ) { |
2401 | return; | 2416 | return; |
2402 | } | 2417 | } |
2403 | XXPortSelectDialog dlg( this, false, this ); | 2418 | XXPortSelectDialog dlg( this, false, this ); |
2404 | if ( !dlg.exec() ) | 2419 | if ( !dlg.exec() ) |
2405 | return; | 2420 | return; |
2406 | mAddressBook->setUntagged(); | 2421 | mAddressBook->setUntagged(); |
2407 | dlg.tagSelected(); | 2422 | dlg.tagSelected(); |
2408 | int count = 0; | 2423 | int count = 0; |
2409 | KABC::AddressBook::Iterator it; | 2424 | KABC::AddressBook::Iterator it; |
2410 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2425 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2411 | if ( (*it).tagged() ) { | 2426 | if ( (*it).tagged() ) { |
2412 | ++count; | 2427 | ++count; |
2413 | if ( count %10 == 0 ) | 2428 | if ( count %10 == 0 ) |
2414 | message(i18n("Changing contact #%1").arg( count ) ); | 2429 | message(i18n("Changing contact #%1").arg( count ) ); |
2415 | qApp->processEvents(); | 2430 | qApp->processEvents(); |
2416 | QString fName; | 2431 | QString fName; |
2417 | if ( setpref.simple->isChecked() ) | 2432 | if ( setpref.simple->isChecked() ) |
2418 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2433 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2419 | else if ( setpref.full->isChecked() ) | 2434 | else if ( setpref.full->isChecked() ) |
2420 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2435 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2421 | else if ( setpref.reverse->isChecked() ) | 2436 | else if ( setpref.reverse->isChecked() ) |
2422 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2437 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2423 | else | 2438 | else |
2424 | fName = (*it).organization(); | 2439 | fName = (*it).organization(); |
2425 | if ( setpref.setCompany->isChecked() ) | 2440 | if ( setpref.setCompany->isChecked() ) |
2426 | if ( fName.isEmpty() || fName =="," ) | 2441 | if ( fName.isEmpty() || fName =="," ) |
2427 | fName = (*it).organization(); | 2442 | fName = (*it).organization(); |
2428 | (*it).setFormattedName( fName ); | 2443 | (*it).setFormattedName( fName ); |
2429 | } | 2444 | } |
2430 | } | 2445 | } |
2431 | message(i18n("Refreshing view...") ); | 2446 | message(i18n("Refreshing view...") ); |
2432 | qApp->processEvents(); | 2447 | qApp->processEvents(); |
2433 | mViewManager->refreshView( "" ); | 2448 | mViewManager->refreshView( "" ); |
2434 | Addressee add; | 2449 | Addressee add; |
2435 | mDetails->setAddressee( add ); | 2450 | mDetails->setAddressee( add ); |
2436 | message(i18n("Setting formatted name completed!") ); | 2451 | message(i18n("Setting formatted name completed!") ); |
2437 | } | 2452 | } |
2438 | 2453 | ||
2439 | void KABCore::clipboardDataChanged() | 2454 | void KABCore::clipboardDataChanged() |
2440 | { | 2455 | { |
2441 | 2456 | ||
2442 | if ( mReadWrite ) | 2457 | if ( mReadWrite ) |
2443 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2458 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2444 | 2459 | ||
2445 | } | 2460 | } |
2446 | 2461 | ||
2447 | void KABCore::updateActionMenu() | 2462 | void KABCore::updateActionMenu() |
2448 | { | 2463 | { |
2449 | UndoStack *undo = UndoStack::instance(); | 2464 | UndoStack *undo = UndoStack::instance(); |
2450 | RedoStack *redo = RedoStack::instance(); | 2465 | RedoStack *redo = RedoStack::instance(); |
2451 | 2466 | ||
2452 | if ( undo->isEmpty() ) | 2467 | if ( undo->isEmpty() ) |
2453 | mActionUndo->setText( i18n( "Undo" ) ); | 2468 | mActionUndo->setText( i18n( "Undo" ) ); |
2454 | else | 2469 | else |
2455 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2470 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2456 | 2471 | ||
2457 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2472 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2458 | 2473 | ||
2459 | if ( !redo->top() ) | 2474 | if ( !redo->top() ) |
2460 | mActionRedo->setText( i18n( "Redo" ) ); | 2475 | mActionRedo->setText( i18n( "Redo" ) ); |
2461 | else | 2476 | else |
2462 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2477 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2463 | 2478 | ||
2464 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2479 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2465 | } | 2480 | } |
2466 | 2481 | ||
2467 | void KABCore::configureKeyBindings() | 2482 | void KABCore::configureKeyBindings() |
2468 | { | 2483 | { |
2469 | #ifndef KAB_EMBEDDED | 2484 | #ifndef KAB_EMBEDDED |
2470 | KKeyDialog::configure( actionCollection(), true ); | 2485 | KKeyDialog::configure( actionCollection(), true ); |
2471 | #else //KAB_EMBEDDED | 2486 | #else //KAB_EMBEDDED |
2472 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2487 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2473 | #endif //KAB_EMBEDDED | 2488 | #endif //KAB_EMBEDDED |
2474 | } | 2489 | } |
2475 | 2490 | ||
2476 | #ifdef KAB_EMBEDDED | 2491 | #ifdef KAB_EMBEDDED |
2477 | void KABCore::configureResources() | 2492 | void KABCore::configureResources() |
2478 | { | 2493 | { |
2479 | KRES::KCMKResources dlg( this, "" , 0 ); | 2494 | KRES::KCMKResources dlg( this, "" , 0 ); |
2480 | 2495 | ||
2481 | if ( !dlg.exec() ) | 2496 | if ( !dlg.exec() ) |
2482 | return; | 2497 | return; |
2483 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2498 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2484 | } | 2499 | } |
2485 | #endif //KAB_EMBEDDED | 2500 | #endif //KAB_EMBEDDED |
2486 | 2501 | ||
2487 | 2502 | ||
2488 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2503 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2489 | * for the attendees list of an event. | 2504 | * for the attendees list of an event. |
2490 | */ | 2505 | */ |
2491 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2506 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2492 | { | 2507 | { |
2493 | QStringList nameList; | 2508 | QStringList nameList; |
2494 | QStringList emailList; | 2509 | QStringList emailList; |
2495 | QStringList uidList; | 2510 | QStringList uidList; |
2496 | 2511 | ||
2497 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2512 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2498 | uint i=0; | 2513 | uint i=0; |
2499 | for (i=0; i < list.count(); i++) | 2514 | for (i=0; i < list.count(); i++) |
2500 | { | 2515 | { |
2501 | nameList.append(list[i].realName()); | 2516 | nameList.append(list[i].realName()); |
2502 | emailList.append(list[i].preferredEmail()); | 2517 | emailList.append(list[i].preferredEmail()); |
2503 | uidList.append(list[i].uid()); | 2518 | uidList.append(list[i].uid()); |
2504 | } | 2519 | } |
2505 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2520 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2506 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2521 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2507 | 2522 | ||
2508 | } | 2523 | } |
2509 | 2524 | ||
2510 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2525 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2511 | * to put them into the calendar. | 2526 | * to put them into the calendar. |
2512 | */ | 2527 | */ |
2513 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2528 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2514 | { | 2529 | { |
2515 | // qDebug("KABCore::requestForBirthdayList"); | 2530 | // qDebug("KABCore::requestForBirthdayList"); |
2516 | QStringList birthdayList; | 2531 | QStringList birthdayList; |
2517 | QStringList anniversaryList; | 2532 | QStringList anniversaryList; |
2518 | QStringList realNameList; | 2533 | QStringList realNameList; |
2519 | QStringList preferredEmailList; | 2534 | QStringList preferredEmailList; |
2520 | QStringList assembledNameList; | 2535 | QStringList assembledNameList; |
2521 | QStringList uidList; | 2536 | QStringList uidList; |
2522 | 2537 | ||
2523 | KABC::AddressBook::Iterator it; | 2538 | KABC::AddressBook::Iterator it; |
2524 | 2539 | ||
2525 | int count = 0; | 2540 | int count = 0; |
2526 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2541 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2527 | ++count; | 2542 | ++count; |
2528 | } | 2543 | } |
2529 | QProgressBar bar(count,0 ); | 2544 | QProgressBar bar(count,0 ); |
2530 | int w = 300; | 2545 | int w = 300; |
2531 | if ( QApplication::desktop()->width() < 320 ) | 2546 | if ( QApplication::desktop()->width() < 320 ) |
2532 | w = 220; | 2547 | w = 220; |
2533 | int h = bar.sizeHint().height() ; | 2548 | int h = bar.sizeHint().height() ; |
2534 | int dw = QApplication::desktop()->width(); | 2549 | int dw = QApplication::desktop()->width(); |
2535 | int dh = QApplication::desktop()->height(); | 2550 | int dh = QApplication::desktop()->height(); |
2536 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2551 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2537 | bar.show(); | 2552 | bar.show(); |
2538 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2553 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2539 | qApp->processEvents(); | 2554 | qApp->processEvents(); |
2540 | 2555 | ||
2541 | QDate bday; | 2556 | QDate bday; |
2542 | QString anni; | 2557 | QString anni; |
2543 | QString formattedbday; | 2558 | QString formattedbday; |
2544 | 2559 | ||
2545 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2560 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2546 | { | 2561 | { |
2547 | if ( ! bar.isVisible() ) | 2562 | if ( ! bar.isVisible() ) |
2548 | return; | 2563 | return; |
2549 | bar.setProgress( count++ ); | 2564 | bar.setProgress( count++ ); |
2550 | qApp->processEvents(); | 2565 | qApp->processEvents(); |
2551 | bday = (*it).birthday().date(); | 2566 | bday = (*it).birthday().date(); |
2552 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2567 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2553 | 2568 | ||
2554 | if ( bday.isValid() || !anni.isEmpty()) | 2569 | if ( bday.isValid() || !anni.isEmpty()) |
2555 | { | 2570 | { |
2556 | if (bday.isValid()) | 2571 | if (bday.isValid()) |
2557 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2572 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2558 | else | 2573 | else |
2559 | formattedbday = "NOTVALID"; | 2574 | formattedbday = "NOTVALID"; |
2560 | if (anni.isEmpty()) | 2575 | if (anni.isEmpty()) |
2561 | anni = "INVALID"; | 2576 | anni = "INVALID"; |
2562 | 2577 | ||
2563 | birthdayList.append(formattedbday); | 2578 | birthdayList.append(formattedbday); |
2564 | anniversaryList.append(anni); //should be ISODate | 2579 | anniversaryList.append(anni); //should be ISODate |
2565 | realNameList.append((*it).realName()); | 2580 | realNameList.append((*it).realName()); |
2566 | preferredEmailList.append((*it).preferredEmail()); | 2581 | preferredEmailList.append((*it).preferredEmail()); |
2567 | assembledNameList.append((*it).assembledName()); | 2582 | assembledNameList.append((*it).assembledName()); |
2568 | uidList.append((*it).uid()); | 2583 | uidList.append((*it).uid()); |
2569 | 2584 | ||
2570 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2585 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2571 | } | 2586 | } |
2572 | } | 2587 | } |
2573 | 2588 | ||
2574 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2589 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2575 | 2590 | ||
2576 | } | 2591 | } |
2577 | 2592 | ||
2578 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2593 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2579 | */ | 2594 | */ |
2580 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2595 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2581 | { | 2596 | { |
2582 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2597 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2583 | 2598 | ||
2584 | QString foundUid = QString::null; | 2599 | QString foundUid = QString::null; |
2585 | if ( ! uid.isEmpty() ) { | 2600 | if ( ! uid.isEmpty() ) { |
2586 | Addressee adrr = mAddressBook->findByUid( uid ); | 2601 | Addressee adrr = mAddressBook->findByUid( uid ); |
2587 | if ( !adrr.isEmpty() ) { | 2602 | if ( !adrr.isEmpty() ) { |
2588 | foundUid = uid; | 2603 | foundUid = uid; |
2589 | } | 2604 | } |
2590 | if ( email == "sendbacklist" ) { | 2605 | if ( email == "sendbacklist" ) { |
2591 | //qDebug("ssssssssssssssssssssssend "); | 2606 | //qDebug("ssssssssssssssssssssssend "); |
2592 | QStringList nameList; | 2607 | QStringList nameList; |
2593 | QStringList emailList; | 2608 | QStringList emailList; |
2594 | QStringList uidList; | 2609 | QStringList uidList; |
2595 | nameList.append(adrr.realName()); | 2610 | nameList.append(adrr.realName()); |
2596 | emailList = adrr.emails(); | 2611 | emailList = adrr.emails(); |
2597 | uidList.append( adrr.preferredEmail()); | 2612 | uidList.append( adrr.preferredEmail()); |
2598 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2613 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2599 | return; | 2614 | return; |
2600 | } | 2615 | } |
2601 | 2616 | ||
2602 | } | 2617 | } |
2603 | 2618 | ||
2604 | if ( email == "sendbacklist" ) | 2619 | if ( email == "sendbacklist" ) |
2605 | return; | 2620 | return; |
2606 | if (foundUid.isEmpty()) | 2621 | if (foundUid.isEmpty()) |
2607 | { | 2622 | { |
2608 | //find the uid of the person first | 2623 | //find the uid of the person first |
2609 | Addressee::List namelist; | 2624 | Addressee::List namelist; |
2610 | Addressee::List emaillist; | 2625 | Addressee::List emaillist; |
2611 | 2626 | ||
2612 | if (!name.isEmpty()) | 2627 | if (!name.isEmpty()) |
2613 | namelist = mAddressBook->findByName( name ); | 2628 | namelist = mAddressBook->findByName( name ); |
2614 | 2629 | ||
2615 | if (!email.isEmpty()) | 2630 | if (!email.isEmpty()) |
2616 | emaillist = mAddressBook->findByEmail( email ); | 2631 | emaillist = mAddressBook->findByEmail( email ); |
2617 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2632 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2618 | //check if we have a match in Namelist and Emaillist | 2633 | //check if we have a match in Namelist and Emaillist |
2619 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2634 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2620 | foundUid = emaillist[0].uid(); | 2635 | foundUid = emaillist[0].uid(); |
2621 | } | 2636 | } |
2622 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2637 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2623 | foundUid = namelist[0].uid(); | 2638 | foundUid = namelist[0].uid(); |
2624 | else | 2639 | else |
2625 | { | 2640 | { |
2626 | for (int i = 0; i < namelist.count(); i++) | 2641 | for (int i = 0; i < namelist.count(); i++) |
2627 | { | 2642 | { |
2628 | for (int j = 0; j < emaillist.count(); j++) | 2643 | for (int j = 0; j < emaillist.count(); j++) |
2629 | { | 2644 | { |
2630 | if (namelist[i] == emaillist[j]) | 2645 | if (namelist[i] == emaillist[j]) |
2631 | { | 2646 | { |
2632 | foundUid = namelist[i].uid(); | 2647 | foundUid = namelist[i].uid(); |
2633 | } | 2648 | } |
2634 | } | 2649 | } |
2635 | } | 2650 | } |
2636 | } | 2651 | } |
2637 | } | 2652 | } |
2638 | else | 2653 | else |
2639 | { | 2654 | { |
2640 | foundUid = uid; | 2655 | foundUid = uid; |
2641 | } | 2656 | } |
2642 | 2657 | ||
2643 | if (!foundUid.isEmpty()) | 2658 | if (!foundUid.isEmpty()) |
2644 | { | 2659 | { |
2645 | 2660 | ||
2646 | // raise Ka/Pi if it is in the background | 2661 | // raise Ka/Pi if it is in the background |
2647 | #ifndef DESKTOP_VERSION | 2662 | #ifndef DESKTOP_VERSION |
2648 | #ifndef KORG_NODCOP | 2663 | #ifndef KORG_NODCOP |
2649 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2664 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2650 | #endif | 2665 | #endif |
2651 | #endif | 2666 | #endif |
2652 | 2667 | ||
2653 | mMainWindow->showMaximized(); | 2668 | mMainWindow->showMaximized(); |
2654 | mMainWindow-> raise(); | 2669 | mMainWindow-> raise(); |
2655 | 2670 | ||
2656 | mViewManager->setSelected( "", false); | 2671 | mViewManager->setSelected( "", false); |
2657 | mViewManager->refreshView( "" ); | 2672 | mViewManager->refreshView( "" ); |
2658 | mViewManager->setSelected( foundUid, true ); | 2673 | mViewManager->setSelected( foundUid, true ); |
2659 | mViewManager->refreshView( foundUid ); | 2674 | mViewManager->refreshView( foundUid ); |
2660 | 2675 | ||
2661 | if ( !mMultipleViewsAtOnce ) | 2676 | if ( !mMultipleViewsAtOnce ) |
2662 | { | 2677 | { |
2663 | setDetailsVisible( true ); | 2678 | setDetailsVisible( true ); |
2664 | mActionDetails->setChecked(true); | 2679 | mActionDetails->setChecked(true); |
2665 | } | 2680 | } |
2666 | } | 2681 | } |
2667 | } | 2682 | } |
2668 | 2683 | ||
2669 | void KABCore::whatsnew() | 2684 | void KABCore::whatsnew() |
2670 | { | 2685 | { |
2671 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2686 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2672 | } | 2687 | } |
2673 | void KABCore::synchowto() | 2688 | void KABCore::synchowto() |
2674 | { | 2689 | { |
2675 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2690 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2676 | } | 2691 | } |
2677 | void KABCore::kdesynchowto() | 2692 | void KABCore::kdesynchowto() |
2678 | { | 2693 | { |
2679 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2694 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2680 | } | 2695 | } |
2681 | void KABCore::multisynchowto() | 2696 | void KABCore::multisynchowto() |
2682 | { | 2697 | { |
2683 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2698 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2684 | } | 2699 | } |
2685 | void KABCore::faq() | 2700 | void KABCore::faq() |
2686 | { | 2701 | { |
2687 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2702 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2688 | } | 2703 | } |
2689 | 2704 | ||
2690 | #include <libkcal/syncdefines.h> | 2705 | #include <libkcal/syncdefines.h> |
2691 | 2706 | ||
2692 | KABC::Addressee KABCore::getLastSyncAddressee() | 2707 | KABC::Addressee KABCore::getLastSyncAddressee() |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index b96d28a..ea254b7 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,154 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 <qtextstream.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" |
41 | 41 | ||
42 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | KABPrefs *KABPrefs::sInstance = 0; | 46 | KABPrefs *KABPrefs::sInstance = 0; |
47 | static KStaticDeleter<KABPrefs> staticDeleterAB; | 47 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
48 | 48 | ||
49 | KABPrefs::KABPrefs() | 49 | KABPrefs::KABPrefs() |
50 | : KPimPrefs("kaddressbookrc") | 50 | : KPimPrefs("kaddressbookrc") |
51 | { | 51 | { |
52 | KPrefs::setCurrentGroup( "Views" ); | 52 | KPrefs::setCurrentGroup( "Views" ); |
53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
54 | 54 | ||
55 | KPrefs::setCurrentGroup( "General" ); | 55 | KPrefs::setCurrentGroup( "General" ); |
56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
58 | #ifdef KAB_EMBEDDED | 58 | #ifdef KAB_EMBEDDED |
59 | addItemBool("AskForQuit",&mAskForQuit,true); | 59 | addItemBool("AskForQuit",&mAskForQuit,true); |
60 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 60 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
61 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 61 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
62 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); | 62 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); |
63 | addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); | ||
64 | addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); | ||
63 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); | 65 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); |
64 | 66 | ||
65 | 67 | ||
66 | #endif //KAB_EMBEDDED | 68 | #endif //KAB_EMBEDDED |
67 | 69 | ||
68 | KPrefs::setCurrentGroup( "MainWindow" ); | 70 | KPrefs::setCurrentGroup( "MainWindow" ); |
69 | bool m_visible = false; | 71 | bool m_visible = false; |
70 | #ifdef DESKTOP_VERSION | 72 | #ifdef DESKTOP_VERSION |
71 | m_visible = true; | 73 | m_visible = true; |
72 | #endif | 74 | #endif |
73 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); | 75 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); |
74 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 76 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
75 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 77 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
76 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 78 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
77 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 79 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
78 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 80 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
79 | 81 | ||
80 | 82 | ||
81 | KPrefs::setCurrentGroup( "Extensions_General" ); | 83 | KPrefs::setCurrentGroup( "Extensions_General" ); |
82 | QStringList defaultExtensions; | 84 | QStringList defaultExtensions; |
83 | defaultExtensions << "merge"; | 85 | defaultExtensions << "merge"; |
84 | defaultExtensions << "distribution_list_editor"; | 86 | defaultExtensions << "distribution_list_editor"; |
85 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 87 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
86 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 88 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
87 | 89 | ||
88 | KPrefs::setCurrentGroup( "Views" ); | 90 | KPrefs::setCurrentGroup( "Views" ); |
89 | QString defaultView = i18n( "Default Table View" ); | 91 | QString defaultView = i18n( "Default Table View" ); |
90 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 92 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
91 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 93 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
92 | 94 | ||
93 | KPrefs::setCurrentGroup( "Filters" ); | 95 | KPrefs::setCurrentGroup( "Filters" ); |
94 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 96 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
95 | 97 | ||
96 | } | 98 | } |
97 | 99 | ||
98 | KABPrefs::~KABPrefs() | 100 | KABPrefs::~KABPrefs() |
99 | { | 101 | { |
100 | //qDebug("KABPrefs::~KABPrefs() "); | 102 | //qDebug("KABPrefs::~KABPrefs() "); |
101 | if (sInstance == this) | 103 | if (sInstance == this) |
102 | sInstance = staticDeleterAB.setObject(0); | 104 | sInstance = staticDeleterAB.setObject(0); |
103 | } | 105 | } |
104 | 106 | ||
105 | KABPrefs *KABPrefs::instance() | 107 | KABPrefs *KABPrefs::instance() |
106 | { | 108 | { |
107 | if ( !sInstance ) { | 109 | if ( !sInstance ) { |
108 | #ifdef KAB_EMBEDDED | 110 | #ifdef KAB_EMBEDDED |
109 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); | 111 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
110 | #else //KAB_EMBEDDED | 112 | #else //KAB_EMBEDDED |
111 | //US the following line has changed ???. Why | 113 | //US the following line has changed ???. Why |
112 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); | 114 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
113 | #endif //KAB_EMBEDDED | 115 | #endif //KAB_EMBEDDED |
114 | sInstance->readConfig(); | 116 | sInstance->readConfig(); |
115 | } | 117 | } |
116 | 118 | ||
117 | return sInstance; | 119 | return sInstance; |
118 | } | 120 | } |
119 | 121 | ||
120 | void KABPrefs::setCategoryDefaults() | 122 | void KABPrefs::setCategoryDefaults() |
121 | { | 123 | { |
122 | mCustomCategories.clear(); | 124 | mCustomCategories.clear(); |
123 | 125 | ||
124 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 126 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
125 | << i18n( "Customer" ) << i18n( "Friend" ); | 127 | << i18n( "Customer" ) << i18n( "Friend" ); |
126 | } | 128 | } |
127 | 129 | ||
128 | // US introduce a nonconst way to return the config object. | 130 | // US introduce a nonconst way to return the config object. |
129 | KConfig* KABPrefs::getConfig() | 131 | KConfig* KABPrefs::getConfig() |
130 | { | 132 | { |
131 | return config(); | 133 | return config(); |
132 | } | 134 | } |
133 | void KABPrefs::usrReadConfig() | 135 | void KABPrefs::usrReadConfig() |
134 | { | 136 | { |
135 | KPimPrefs::usrReadConfig(); | 137 | KPimPrefs::usrReadConfig(); |
136 | } | 138 | } |
137 | 139 | ||
138 | 140 | ||
139 | /*US | 141 | /*US |
140 | void KABPrefs::usrSetDefaults() | 142 | void KABPrefs::usrSetDefaults() |
141 | { | 143 | { |
142 | KPimPrefs::usrSetDefaults(); | 144 | KPimPrefs::usrSetDefaults(); |
143 | } | 145 | } |
144 | 146 | ||
145 | void KABPrefs::usrReadConfig() | 147 | void KABPrefs::usrReadConfig() |
146 | { | 148 | { |
147 | KPimPrefs::usrReadConfig(); | 149 | KPimPrefs::usrReadConfig(); |
148 | } | 150 | } |
149 | 151 | ||
150 | void KABPrefs::usrWriteConfig() | 152 | void KABPrefs::usrWriteConfig() |
151 | { | 153 | { |
152 | KPimPrefs::usrWriteConfig(); | 154 | KPimPrefs::usrWriteConfig(); |
153 | } | 155 | } |
154 | */ | 156 | */ |
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index 1e3b48f..2bb173d 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -1,96 +1,98 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 <qdict.h> |
29 | 29 | ||
30 | #include <libkdepim/kpimprefs.h> | 30 | #include <libkdepim/kpimprefs.h> |
31 | 31 | ||
32 | class KConfig; | 32 | class KConfig; |
33 | 33 | ||
34 | class KABPrefs : public KPimPrefs | 34 | class KABPrefs : public KPimPrefs |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | virtual ~KABPrefs(); | 37 | virtual ~KABPrefs(); |
38 | 38 | ||
39 | static KABPrefs *instance(); | 39 | static KABPrefs *instance(); |
40 | 40 | ||
41 | // General | 41 | // General |
42 | bool mHonorSingleClick; | 42 | bool mHonorSingleClick; |
43 | bool mAutomaticNameParsing; | 43 | bool mAutomaticNameParsing; |
44 | int mCurrentIncSearchField; | 44 | int mCurrentIncSearchField; |
45 | 45 | ||
46 | #ifdef KAB_EMBEDDED | 46 | #ifdef KAB_EMBEDDED |
47 | // US introduce a nonconst way to return the config object. | 47 | // US introduce a nonconst way to return the config object. |
48 | KConfig* getConfig(); | 48 | KConfig* getConfig(); |
49 | 49 | ||
50 | bool mToolBarHor; | 50 | bool mToolBarHor; |
51 | bool mToolBarUp; | 51 | bool mToolBarUp; |
52 | bool mAskForQuit; | 52 | bool mAskForQuit; |
53 | 53 | ||
54 | 54 | ||
55 | /** Set preferences to default values */ | 55 | /** Set preferences to default values */ |
56 | // void usrSetDefaults(); | 56 | // void usrSetDefaults(); |
57 | 57 | ||
58 | /** Read preferences from config file */ | 58 | /** Read preferences from config file */ |
59 | // void usrReadConfig(); | 59 | // void usrReadConfig(); |
60 | 60 | ||
61 | /** Write preferences to config file */ | 61 | /** Write preferences to config file */ |
62 | // void usrWriteConfig(); | 62 | // void usrWriteConfig(); |
63 | #endif //KAB_EMBEDDED | 63 | #endif //KAB_EMBEDDED |
64 | void usrReadConfig(); | 64 | void usrReadConfig(); |
65 | 65 | ||
66 | 66 | ||
67 | // GUI | 67 | // GUI |
68 | bool mFullMenuBarVisible; | 68 | bool mFullMenuBarVisible; |
69 | bool mJumpButtonBarVisible; | 69 | bool mJumpButtonBarVisible; |
70 | bool mDetailsPageVisible; | 70 | bool mDetailsPageVisible; |
71 | bool mMultipleViewsAtOnce; | 71 | bool mMultipleViewsAtOnce; |
72 | bool mSearchWithReturn; | 72 | bool mSearchWithReturn; |
73 | bool mAutoSearchWithWildcard; | ||
74 | bool mHideSearchOnSwitch; | ||
73 | QValueList<int> mExtensionsSplitter; | 75 | QValueList<int> mExtensionsSplitter; |
74 | QValueList<int> mDetailsSplitter; | 76 | QValueList<int> mDetailsSplitter; |
75 | 77 | ||
76 | // Extensions stuff | 78 | // Extensions stuff |
77 | int mCurrentExtension; | 79 | int mCurrentExtension; |
78 | QStringList mActiveExtensions; | 80 | QStringList mActiveExtensions; |
79 | 81 | ||
80 | // Views stuff | 82 | // Views stuff |
81 | QString mCurrentView; | 83 | QString mCurrentView; |
82 | QStringList mViewNames; | 84 | QStringList mViewNames; |
83 | 85 | ||
84 | // Filter | 86 | // Filter |
85 | int mCurrentFilter; | 87 | int mCurrentFilter; |
86 | 88 | ||
87 | void setCategoryDefaults(); | 89 | void setCategoryDefaults(); |
88 | QFont mDetailsFont; | 90 | QFont mDetailsFont; |
89 | 91 | ||
90 | private: | 92 | private: |
91 | KABPrefs(); | 93 | KABPrefs(); |
92 | 94 | ||
93 | static KABPrefs *sInstance; | 95 | static KABPrefs *sInstance; |
94 | }; | 96 | }; |
95 | 97 | ||
96 | #endif | 98 | #endif |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 3ad2f74..986c9b8 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -1,401 +1,416 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.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 <qvbox.h> |
35 | 35 | ||
36 | #include <kconfig.h> | 36 | #include <kconfig.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <kdialog.h> | 38 | #include <kdialog.h> |
39 | #include <klistview.h> | 39 | #include <klistview.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <ktrader.h> | 46 | #include <ktrader.h> |
47 | #else // KAB_EMBEDDED | 47 | #else // KAB_EMBEDDED |
48 | #include <mergewidget.h> | 48 | #include <mergewidget.h> |
49 | #include <distributionlistwidget.h> | 49 | #include <distributionlistwidget.h> |
50 | #endif // KAB_EMBEDDED | 50 | #endif // KAB_EMBEDDED |
51 | 51 | ||
52 | #include "addresseewidget.h" | 52 | #include "addresseewidget.h" |
53 | #include "extensionconfigdialog.h" | 53 | #include "extensionconfigdialog.h" |
54 | #include "extensionwidget.h" | 54 | #include "extensionwidget.h" |
55 | #include "kabprefs.h" | 55 | #include "kabprefs.h" |
56 | 56 | ||
57 | #include "kabconfigwidget.h" | 57 | #include "kabconfigwidget.h" |
58 | 58 | ||
59 | class ExtensionItem : public QCheckListItem | 59 | class ExtensionItem : public QCheckListItem |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | 62 | ||
63 | #ifndef KAB_EMBEDDED | 63 | #ifndef KAB_EMBEDDED |
64 | ExtensionItem( QListView *parent, const QString &text ); | 64 | ExtensionItem( QListView *parent, const QString &text ); |
65 | void setService( const KService::Ptr &ptr ); | 65 | void setService( const KService::Ptr &ptr ); |
66 | #else //KAB_EMBEDDED | 66 | #else //KAB_EMBEDDED |
67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); |
68 | void setFactory( ExtensionFactory* fac ); | 68 | void setFactory( ExtensionFactory* fac ); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | bool configWidgetAvailable() const; | 71 | bool configWidgetAvailable() const; |
72 | ExtensionFactory *factory() const; | 72 | ExtensionFactory *factory() const; |
73 | 73 | ||
74 | virtual QString text( int column ) const; | 74 | virtual QString text( int column ) const; |
75 | 75 | ||
76 | private: | 76 | private: |
77 | #ifndef KAB_EMBEDDED | 77 | #ifndef KAB_EMBEDDED |
78 | KService::Ptr mPtr; | 78 | KService::Ptr mPtr; |
79 | #else //KAB_EMBEDDED | 79 | #else //KAB_EMBEDDED |
80 | ExtensionFactory* mFactory; | 80 | ExtensionFactory* mFactory; |
81 | QString mName; | 81 | QString mName; |
82 | QString mComment; | 82 | QString mComment; |
83 | 83 | ||
84 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
85 | 85 | ||
86 | }; | 86 | }; |
87 | 87 | ||
88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
89 | : KPrefsWidget( prefs, parent, name ) | 89 | : KPrefsWidget( prefs, parent, name ) |
90 | { | 90 | { |
91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
92 | KDialog::spacingHint() ); | 92 | KDialog::spacingHint() ); |
93 | 93 | ||
94 | QTabWidget *tabWidget = new QTabWidget( this ); | 94 | QTabWidget *tabWidget = new QTabWidget( this ); |
95 | topLayout->addWidget( tabWidget ); | 95 | topLayout->addWidget( tabWidget ); |
96 | 96 | ||
97 | // General page | 97 | // General page |
98 | QWidget *generalPage = new QWidget( this ); | 98 | QWidget *generalPage = new QWidget( this ); |
99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
100 | KDialog::spacingHintSmall() ); | 100 | KDialog::spacingHintSmall() ); |
101 | 101 | ||
102 | 102 | ||
103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); |
105 | KPrefsWidFont *detailsFont = | 105 | KPrefsWidFont *detailsFont = |
106 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 106 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
107 | &(KABPrefs::instance()->mDetailsFont),hBox); | 107 | &(KABPrefs::instance()->mDetailsFont),hBox); |
108 | hboxLayout->addWidget(detailsFont->label()); | 108 | hboxLayout->addWidget(detailsFont->label()); |
109 | hboxLayout->addWidget(detailsFont->preview()); | 109 | hboxLayout->addWidget(detailsFont->preview()); |
110 | hboxLayout->addWidget(detailsFont->button()); | 110 | hboxLayout->addWidget(detailsFont->button()); |
111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
113 | //hBox->setBackgroundColor( black); | 113 | //hBox->setBackgroundColor( black); |
114 | layout->addWidget( hBox ); | 114 | layout->addWidget( hBox ); |
115 | 115 | ||
116 | //general groupbox | 116 | //general groupbox |
117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); |
119 | boxLayout->setAlignment( Qt::AlignTop ); | 119 | boxLayout->setAlignment( Qt::AlignTop ); |
120 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 120 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
122 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | 122 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); |
123 | boxLayout->addWidget( mMenuBarBox ); | 123 | boxLayout->addWidget( mMenuBarBox ); |
124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
125 | boxLayout->addWidget( mSearchReturnBox ); | 125 | boxLayout->addWidget( mSearchReturnBox ); |
126 | mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" ); | ||
127 | boxLayout->addWidget( mAutoSearchWithWildcardBox); | ||
128 | mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" ); | ||
129 | boxLayout->addWidget( mHideSearchOnSwitchBox ); | ||
130 | |||
131 | #ifdef DESKTOP_VERSION | ||
132 | mHideSearchOnSwitchBox->hide(); | ||
133 | #endif | ||
126 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 134 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
127 | boxLayout->addWidget( mViewsSingleClickBox ); | 135 | boxLayout->addWidget( mViewsSingleClickBox ); |
128 | 136 | ||
129 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 137 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); |
130 | boxLayout->addWidget( mNameParsing ); | 138 | boxLayout->addWidget( mNameParsing ); |
131 | 139 | ||
132 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); | 140 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); |
133 | boxLayout->addWidget( mMultipleViewsAtOnce ); | 141 | boxLayout->addWidget( mMultipleViewsAtOnce ); |
134 | 142 | ||
135 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); | 143 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); |
136 | boxLayout->addWidget( mAskForQuit ); | 144 | boxLayout->addWidget( mAskForQuit ); |
137 | 145 | ||
138 | layout->addWidget( vBox ); | 146 | layout->addWidget( vBox ); |
139 | 147 | ||
140 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 148 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
141 | 149 | ||
142 | // Extension page | 150 | // Extension page |
143 | QWidget *extensionPage = new QWidget( this ); | 151 | QWidget *extensionPage = new QWidget( this ); |
144 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 152 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), |
145 | KDialog::spacingHintSmall() ); | 153 | KDialog::spacingHintSmall() ); |
146 | 154 | ||
147 | //extensions groupbox | 155 | //extensions groupbox |
148 | 156 | ||
149 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 157 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
150 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 158 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
151 | boxLayout->setAlignment( Qt::AlignTop ); | 159 | boxLayout->setAlignment( Qt::AlignTop ); |
152 | boxLayout->setMargin(KDialog::marginHintSmall()); | 160 | boxLayout->setMargin(KDialog::marginHintSmall()); |
153 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 161 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
154 | groupBox->layout()->setMargin(1) ; | 162 | groupBox->layout()->setMargin(1) ; |
155 | groupBox->layout()->setSpacing(0); | 163 | groupBox->layout()->setSpacing(0); |
156 | mExtensionView = new KListView( groupBox ); | 164 | mExtensionView = new KListView( groupBox ); |
157 | mExtensionView->setAllColumnsShowFocus( true ); | 165 | mExtensionView->setAllColumnsShowFocus( true ); |
158 | mExtensionView->addColumn( i18n( "Name" ) ); | 166 | mExtensionView->addColumn( i18n( "Name" ) ); |
159 | mExtensionView->addColumn( i18n( "Description" ) ); | 167 | mExtensionView->addColumn( i18n( "Description" ) ); |
160 | //mExtensionView->setMaximumHeight(80); | 168 | //mExtensionView->setMaximumHeight(80); |
161 | 169 | ||
162 | boxLayout->addWidget( mExtensionView ); | 170 | boxLayout->addWidget( mExtensionView ); |
163 | 171 | ||
164 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 172 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
165 | mConfigureButton->setEnabled( false ); | 173 | mConfigureButton->setEnabled( false ); |
166 | boxLayout->addWidget( mConfigureButton ); | 174 | boxLayout->addWidget( mConfigureButton ); |
167 | 175 | ||
168 | extensionLayout->addWidget( groupBox ); | 176 | extensionLayout->addWidget( groupBox ); |
169 | 177 | ||
170 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 178 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
171 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 179 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
172 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 180 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
173 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 181 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
182 | connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
183 | connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
174 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 184 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
175 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 185 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
176 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 186 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
177 | SLOT( selectionChanged( QListViewItem* ) ) ); | 187 | SLOT( selectionChanged( QListViewItem* ) ) ); |
178 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 188 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
179 | SLOT( itemClicked( QListViewItem* ) ) ); | 189 | SLOT( itemClicked( QListViewItem* ) ) ); |
180 | connect( mConfigureButton, SIGNAL( clicked() ), | 190 | connect( mConfigureButton, SIGNAL( clicked() ), |
181 | SLOT( configureExtension() ) ); | 191 | SLOT( configureExtension() ) ); |
182 | 192 | ||
183 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 193 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
184 | 194 | ||
185 | // Addressee page | 195 | // Addressee page |
186 | mAddresseeWidget = new AddresseeWidget( this ); | 196 | mAddresseeWidget = new AddresseeWidget( this ); |
187 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 197 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
188 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 198 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
189 | 199 | ||
190 | } | 200 | } |
191 | 201 | ||
192 | void KABConfigWidget::usrReadConfig() | 202 | void KABConfigWidget::usrReadConfig() |
193 | { | 203 | { |
194 | KABPrefs* prefs = KABPrefs::instance(); | 204 | KABPrefs* prefs = KABPrefs::instance(); |
195 | 205 | ||
196 | bool blocked = signalsBlocked(); | 206 | bool blocked = signalsBlocked(); |
197 | blockSignals( true ); | 207 | blockSignals( true ); |
198 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); | 208 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); |
199 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 209 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
200 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 210 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
201 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 211 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
212 | mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard ); | ||
213 | mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch ); | ||
202 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 214 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
203 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 215 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
204 | 216 | ||
205 | mAddresseeWidget->restoreSettings(); | 217 | mAddresseeWidget->restoreSettings(); |
206 | 218 | ||
207 | restoreExtensionSettings(); | 219 | restoreExtensionSettings(); |
208 | 220 | ||
209 | blockSignals( blocked ); | 221 | blockSignals( blocked ); |
210 | 222 | ||
211 | } | 223 | } |
212 | 224 | ||
213 | void KABConfigWidget::usrWriteConfig() | 225 | void KABConfigWidget::usrWriteConfig() |
214 | { | 226 | { |
215 | KABPrefs* prefs = KABPrefs::instance(); | 227 | KABPrefs* prefs = KABPrefs::instance(); |
216 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); | 228 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); |
217 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 229 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
218 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 230 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
219 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 231 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
232 | prefs->mAutoSearchWithWildcard = mAutoSearchWithWildcardBox->isChecked(); | ||
233 | prefs->mHideSearchOnSwitch = mHideSearchOnSwitchBox->isChecked(); | ||
234 | |||
220 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 235 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
221 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 236 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
222 | 237 | ||
223 | mAddresseeWidget->saveSettings(); | 238 | mAddresseeWidget->saveSettings(); |
224 | 239 | ||
225 | saveExtensionSettings(); | 240 | saveExtensionSettings(); |
226 | 241 | ||
227 | } | 242 | } |
228 | 243 | ||
229 | void KABConfigWidget::restoreExtensionSettings() | 244 | void KABConfigWidget::restoreExtensionSettings() |
230 | { | 245 | { |
231 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 246 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
232 | 247 | ||
233 | mExtensionView->clear(); | 248 | mExtensionView->clear(); |
234 | 249 | ||
235 | #ifndef KAB_EMBEDDED | 250 | #ifndef KAB_EMBEDDED |
236 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 251 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
237 | KTrader::OfferList::ConstIterator it; | 252 | KTrader::OfferList::ConstIterator it; |
238 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 253 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
239 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 254 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
240 | continue; | 255 | continue; |
241 | 256 | ||
242 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 257 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
243 | item->setService( *it ); | 258 | item->setService( *it ); |
244 | if ( activeExtensions.contains( item->factory()->identifier() ) ) | 259 | if ( activeExtensions.contains( item->factory()->identifier() ) ) |
245 | item->setOn( true ); | 260 | item->setOn( true ); |
246 | } | 261 | } |
247 | #else //KAB_EMBEDDED | 262 | #else //KAB_EMBEDDED |
248 | ExtensionFactory *extensionFactory = new MergeFactory(); | 263 | ExtensionFactory *extensionFactory = new MergeFactory(); |
249 | 264 | ||
250 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 265 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
251 | 266 | ||
252 | item->setFactory( extensionFactory ); | 267 | item->setFactory( extensionFactory ); |
253 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 268 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
254 | item->setOn( true ); | 269 | item->setOn( true ); |
255 | 270 | ||
256 | 271 | ||
257 | 272 | ||
258 | extensionFactory = new DistributionListFactory(); | 273 | extensionFactory = new DistributionListFactory(); |
259 | 274 | ||
260 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 275 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
261 | 276 | ||
262 | item->setFactory( extensionFactory ); | 277 | item->setFactory( extensionFactory ); |
263 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 278 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
264 | item->setOn( true ); | 279 | item->setOn( true ); |
265 | 280 | ||
266 | 281 | ||
267 | #endif //KAB_EMBEDDED | 282 | #endif //KAB_EMBEDDED |
268 | 283 | ||
269 | } | 284 | } |
270 | 285 | ||
271 | void KABConfigWidget::saveExtensionSettings() | 286 | void KABConfigWidget::saveExtensionSettings() |
272 | { | 287 | { |
273 | QStringList activeExtensions; | 288 | QStringList activeExtensions; |
274 | 289 | ||
275 | QPtrList<QListViewItem> list; | 290 | QPtrList<QListViewItem> list; |
276 | QListViewItemIterator it( mExtensionView ); | 291 | QListViewItemIterator it( mExtensionView ); |
277 | while ( it.current() ) { | 292 | while ( it.current() ) { |
278 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 293 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
279 | if ( item ) { | 294 | if ( item ) { |
280 | if ( item->isOn() ) | 295 | if ( item->isOn() ) |
281 | activeExtensions.append( item->factory()->identifier() ); | 296 | activeExtensions.append( item->factory()->identifier() ); |
282 | } | 297 | } |
283 | ++it; | 298 | ++it; |
284 | } | 299 | } |
285 | 300 | ||
286 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 301 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
287 | } | 302 | } |
288 | 303 | ||
289 | void KABConfigWidget::configureExtension() | 304 | void KABConfigWidget::configureExtension() |
290 | { | 305 | { |
291 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); | 306 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); |
292 | if ( !item ) | 307 | if ( !item ) |
293 | return; | 308 | return; |
294 | 309 | ||
295 | #ifndef KAB_EMBEDDED | 310 | #ifndef KAB_EMBEDDED |
296 | KConfig config( "kaddressbookrc" ); | 311 | KConfig config( "kaddressbookrc" ); |
297 | #else //KAB_EMBEDDED | 312 | #else //KAB_EMBEDDED |
298 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 313 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
299 | #endif //KAB_EMBEDDED | 314 | #endif //KAB_EMBEDDED |
300 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 315 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
301 | 316 | ||
302 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 317 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
303 | dlg.exec(); | 318 | dlg.exec(); |
304 | 319 | ||
305 | config.sync(); | 320 | config.sync(); |
306 | } | 321 | } |
307 | 322 | ||
308 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 323 | void KABConfigWidget::selectionChanged( QListViewItem *i ) |
309 | { | 324 | { |
310 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 325 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
311 | if ( !item ) | 326 | if ( !item ) |
312 | return; | 327 | return; |
313 | 328 | ||
314 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); | 329 | mConfigureButton->setEnabled( item->configWidgetAvailable() ); |
315 | } | 330 | } |
316 | 331 | ||
317 | void KABConfigWidget::itemClicked( QListViewItem *item ) | 332 | void KABConfigWidget::itemClicked( QListViewItem *item ) |
318 | { | 333 | { |
319 | if ( item != 0 ) | 334 | if ( item != 0 ) |
320 | modified(); | 335 | modified(); |
321 | } | 336 | } |
322 | 337 | ||
323 | #ifndef KAB_EMBEDDED | 338 | #ifndef KAB_EMBEDDED |
324 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) | 339 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text ) |
325 | : QCheckListItem( parent, text, CheckBox ) | 340 | : QCheckListItem( parent, text, CheckBox ) |
326 | { | 341 | { |
327 | } | 342 | } |
328 | 343 | ||
329 | void ExtensionItem::setService( const KService::Ptr &ptr ) | 344 | void ExtensionItem::setService( const KService::Ptr &ptr ) |
330 | { | 345 | { |
331 | mPtr = ptr; | 346 | mPtr = ptr; |
332 | } | 347 | } |
333 | #else //KAB_EMBEDDED | 348 | #else //KAB_EMBEDDED |
334 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) | 349 | ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ) |
335 | : QCheckListItem( parent, text, CheckBox ) | 350 | : QCheckListItem( parent, text, CheckBox ) |
336 | { | 351 | { |
337 | mName = name; | 352 | mName = name; |
338 | mComment = comment; | 353 | mComment = comment; |
339 | } | 354 | } |
340 | 355 | ||
341 | 356 | ||
342 | void ExtensionItem::setFactory( ExtensionFactory* fac ) | 357 | void ExtensionItem::setFactory( ExtensionFactory* fac ) |
343 | { | 358 | { |
344 | mFactory = fac; | 359 | mFactory = fac; |
345 | } | 360 | } |
346 | #endif //KAB_EMBEDDED | 361 | #endif //KAB_EMBEDDED |
347 | 362 | ||
348 | bool ExtensionItem::configWidgetAvailable() const | 363 | bool ExtensionItem::configWidgetAvailable() const |
349 | { | 364 | { |
350 | #ifndef KAB_EMBEDDED | 365 | #ifndef KAB_EMBEDDED |
351 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 366 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
352 | if ( !factory ) | 367 | if ( !factory ) |
353 | return false; | 368 | return false; |
354 | 369 | ||
355 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 370 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
356 | if ( !extensionFactory ) | 371 | if ( !extensionFactory ) |
357 | return false; | 372 | return false; |
358 | 373 | ||
359 | return extensionFactory->configureWidgetAvailable(); | 374 | return extensionFactory->configureWidgetAvailable(); |
360 | #else //KAB_EMBEDDED | 375 | #else //KAB_EMBEDDED |
361 | return mFactory->configureWidgetAvailable(); | 376 | return mFactory->configureWidgetAvailable(); |
362 | #endif //KAB_EMBEDDED | 377 | #endif //KAB_EMBEDDED |
363 | 378 | ||
364 | } | 379 | } |
365 | 380 | ||
366 | ExtensionFactory *ExtensionItem::factory() const | 381 | ExtensionFactory *ExtensionItem::factory() const |
367 | { | 382 | { |
368 | #ifndef KAB_EMBEDDED | 383 | #ifndef KAB_EMBEDDED |
369 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); | 384 | KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() ); |
370 | if ( !factory ) | 385 | if ( !factory ) |
371 | return 0; | 386 | return 0; |
372 | 387 | ||
373 | return static_cast<ExtensionFactory*>( factory ); | 388 | return static_cast<ExtensionFactory*>( factory ); |
374 | #else //KAB_EMBEDDED | 389 | #else //KAB_EMBEDDED |
375 | return mFactory; | 390 | return mFactory; |
376 | #endif //KAB_EMBEDDED | 391 | #endif //KAB_EMBEDDED |
377 | } | 392 | } |
378 | 393 | ||
379 | QString ExtensionItem::text( int column ) const | 394 | QString ExtensionItem::text( int column ) const |
380 | { | 395 | { |
381 | #ifndef KAB_EMBEDDED | 396 | #ifndef KAB_EMBEDDED |
382 | if ( column == 0 ) | 397 | if ( column == 0 ) |
383 | return mPtr->name(); | 398 | return mPtr->name(); |
384 | else if ( column == 1 ) | 399 | else if ( column == 1 ) |
385 | return mPtr->comment(); | 400 | return mPtr->comment(); |
386 | else | 401 | else |
387 | return QString::null; | 402 | return QString::null; |
388 | #else //KAB_EMBEDDED | 403 | #else //KAB_EMBEDDED |
389 | if ( column == 0 ) | 404 | if ( column == 0 ) |
390 | return mName; | 405 | return mName; |
391 | else if ( column == 1 ) | 406 | else if ( column == 1 ) |
392 | return mComment; | 407 | return mComment; |
393 | else | 408 | else |
394 | return QString::null; | 409 | return QString::null; |
395 | #endif //KAB_EMBEDDED | 410 | #endif //KAB_EMBEDDED |
396 | } | 411 | } |
397 | 412 | ||
398 | #ifndef KAB_EMBEDDED | 413 | #ifndef KAB_EMBEDDED |
399 | #include "kabconfigwidget.moc" | 414 | #include "kabconfigwidget.moc" |
400 | #endif //KAB_EMBEDDED | 415 | #endif //KAB_EMBEDDED |
401 | 416 | ||
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 08d71b4..a172e97 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h | |||
@@ -1,75 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 QListViewItem; |
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 | ||
43 | public: | 43 | public: |
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( QListViewItem* ); |
57 | void itemClicked( QListViewItem* ); | 57 | void itemClicked( QListViewItem* ); |
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; | ||
68 | QCheckBox *mHideSearchOnSwitchBox; | ||
67 | QCheckBox *mMultipleViewsAtOnce; | 69 | QCheckBox *mMultipleViewsAtOnce; |
68 | QCheckBox *mAskForQuit; | 70 | QCheckBox *mAskForQuit; |
69 | QCheckBox *mMenuBarBox; | 71 | QCheckBox *mMenuBarBox; |
70 | QPushButton *mConfigureButton; | 72 | QPushButton *mConfigureButton; |
71 | 73 | ||
72 | AddresseeWidget *mAddresseeWidget; | 74 | AddresseeWidget *mAddresseeWidget; |
73 | }; | 75 | }; |
74 | 76 | ||
75 | #endif | 77 | #endif |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 04759a7..c2b1bb0 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -1,737 +1,737 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | 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 | 6 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
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 | 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 | 31 | ||
32 | #ifndef KAB_EMBEDDED | 32 | #ifndef KAB_EMBEDDED |
33 | #include <libkdepim/kvcarddrag.h> | 33 | #include <libkdepim/kvcarddrag.h> |
34 | #include <kabc/vcardconverter.h> | 34 | #include <kabc/vcardconverter.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kdeversion.h> | 36 | #include <kdeversion.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kmultipledrag.h> | 40 | #include <kmultipledrag.h> |
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 <qpopupmenu.h> |
54 | #include <kconfigbase.h> | 54 | #include <kconfigbase.h> |
55 | 55 | ||
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
57 | 57 | ||
58 | 58 | ||
59 | #include <kdebug.h> | 59 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 60 | #include <kactionclasses.h> |
61 | 61 | ||
62 | #include <qlayout.h> | 62 | #include <qlayout.h> |
63 | #include <qapplication.h> | 63 | #include <qapplication.h> |
64 | #include <qwidgetstack.h> | 64 | #include <qwidgetstack.h> |
65 | 65 | ||
66 | #include <kabc/addressbook.h> | 66 | #include <kabc/addressbook.h> |
67 | #include "filtereditdialog.h" | 67 | #include "filtereditdialog.h" |
68 | #include "addviewdialog.h" | 68 | #include "addviewdialog.h" |
69 | #include "kabcore.h" | 69 | #include "kabcore.h" |
70 | #include "kabprefs.h" | 70 | #include "kabprefs.h" |
71 | #include "viewmanager.h" | 71 | #include "viewmanager.h" |
72 | 72 | ||
73 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) | 73 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) |
74 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) | 74 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) |
75 | { | 75 | { |
76 | initGUI(); | 76 | initGUI(); |
77 | initActions(); | 77 | initActions(); |
78 | 78 | ||
79 | mViewDict.setAutoDelete( true ); | 79 | mViewDict.setAutoDelete( true ); |
80 | 80 | ||
81 | createViewFactories(); | 81 | createViewFactories(); |
82 | } | 82 | } |
83 | 83 | ||
84 | ViewManager::~ViewManager() | 84 | ViewManager::~ViewManager() |
85 | { | 85 | { |
86 | unloadViews(); | 86 | unloadViews(); |
87 | mViewFactoryDict.clear(); | 87 | mViewFactoryDict.clear(); |
88 | } | 88 | } |
89 | void ViewManager::scrollUP() | 89 | void ViewManager::scrollUP() |
90 | { | 90 | { |
91 | if ( mActiveView ) | 91 | if ( mActiveView ) |
92 | mActiveView->scrollUP(); | 92 | mActiveView->scrollUP(); |
93 | } | 93 | } |
94 | void ViewManager::scrollDOWN() | 94 | void ViewManager::scrollDOWN() |
95 | { | 95 | { |
96 | if ( mActiveView ) | 96 | if ( mActiveView ) |
97 | mActiveView->scrollDOWN(); | 97 | mActiveView->scrollDOWN(); |
98 | } | 98 | } |
99 | void ViewManager::restoreSettings() | 99 | void ViewManager::restoreSettings() |
100 | { | 100 | { |
101 | mViewNameList = KABPrefs::instance()->mViewNames; | 101 | mViewNameList = KABPrefs::instance()->mViewNames; |
102 | QString activeViewName = KABPrefs::instance()->mCurrentView; | 102 | QString activeViewName = KABPrefs::instance()->mCurrentView; |
103 | 103 | ||
104 | mActionSelectView->setItems( mViewNameList ); | 104 | mActionSelectView->setItems( mViewNameList ); |
105 | 105 | ||
106 | // Filter | 106 | // Filter |
107 | mFilterList = Filter::restore( mCore->config(), "Filter" ); | 107 | mFilterList = Filter::restore( mCore->config(), "Filter" ); |
108 | mActionSelectFilter->setItems( filterNames() ); | 108 | mActionSelectFilter->setItems( filterNames() ); |
109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
110 | int cw = 150; | 110 | int cw = 150; |
111 | if (QApplication::desktop()->width() == 480 ) | 111 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
112 | cw = 0; | 112 | cw = 0; |
113 | mActionSelectFilter->setComboWidth( cw ); | 113 | mActionSelectFilter->setComboWidth( cw ); |
114 | // Tell the views to reread their config, since they may have | 114 | // Tell the views to reread their config, since they may have |
115 | // been modified by global settings | 115 | // been modified by global settings |
116 | QString _oldgroup = mCore->config()->group(); | 116 | QString _oldgroup = mCore->config()->group(); |
117 | 117 | ||
118 | QDictIterator<KAddressBookView> it( mViewDict ); | 118 | QDictIterator<KAddressBookView> it( mViewDict ); |
119 | for ( it.toFirst(); it.current(); ++it ) { | 119 | for ( it.toFirst(); it.current(); ++it ) { |
120 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 120 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
121 | it.current()->readConfig( mCore->config() ); | 121 | it.current()->readConfig( mCore->config() ); |
122 | } | 122 | } |
123 | setActiveView( activeViewName ); | 123 | setActiveView( activeViewName ); |
124 | 124 | ||
125 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 125 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void ViewManager::saveSettings() | 128 | void ViewManager::saveSettings() |
129 | { | 129 | { |
130 | QString _oldgroup = mCore->config()->group(); | 130 | QString _oldgroup = mCore->config()->group(); |
131 | 131 | ||
132 | QDictIterator<KAddressBookView> it( mViewDict ); | 132 | QDictIterator<KAddressBookView> it( mViewDict ); |
133 | for ( it.toFirst(); it.current(); ++it ) { | 133 | for ( it.toFirst(); it.current(); ++it ) { |
134 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 134 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
135 | #ifdef DESKTOP_VERSION | 135 | #ifdef DESKTOP_VERSION |
136 | (*it)->writeConfig( mCore->config() ); | 136 | (*it)->writeConfig( mCore->config() ); |
137 | #else | 137 | #else |
138 | (*it).writeConfig( mCore->config() ); | 138 | (*it).writeConfig( mCore->config() ); |
139 | #endif | 139 | #endif |
140 | } | 140 | } |
141 | 141 | ||
142 | Filter::save( mCore->config(), "Filter", mFilterList ); | 142 | Filter::save( mCore->config(), "Filter", mFilterList ); |
143 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); | 143 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); |
144 | 144 | ||
145 | // write the view name list | 145 | // write the view name list |
146 | KABPrefs::instance()->mViewNames = mViewNameList; | 146 | KABPrefs::instance()->mViewNames = mViewNameList; |
147 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); | 147 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | QStringList ViewManager::selectedUids() const | 151 | QStringList ViewManager::selectedUids() const |
152 | { | 152 | { |
153 | if ( mActiveView ) | 153 | if ( mActiveView ) |
154 | return mActiveView->selectedUids(); | 154 | return mActiveView->selectedUids(); |
155 | else | 155 | else |
156 | return QStringList(); | 156 | return QStringList(); |
157 | } | 157 | } |
158 | 158 | ||
159 | QStringList ViewManager::selectedEmails() const | 159 | QStringList ViewManager::selectedEmails() const |
160 | { | 160 | { |
161 | if ( mActiveView ) | 161 | if ( mActiveView ) |
162 | return mActiveView->selectedEmails(); | 162 | return mActiveView->selectedEmails(); |
163 | else | 163 | else |
164 | return QStringList(); | 164 | return QStringList(); |
165 | } | 165 | } |
166 | 166 | ||
167 | KABC::Addressee::List ViewManager::selectedAddressees() const | 167 | KABC::Addressee::List ViewManager::selectedAddressees() const |
168 | { | 168 | { |
169 | KABC::Addressee::List list; | 169 | KABC::Addressee::List list; |
170 | if ( mActiveView ) { | 170 | if ( mActiveView ) { |
171 | QStringList uids = mActiveView->selectedUids(); | 171 | QStringList uids = mActiveView->selectedUids(); |
172 | QStringList::Iterator it; | 172 | QStringList::Iterator it; |
173 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 173 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
174 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 174 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
175 | if ( !addr.isEmpty() ) | 175 | if ( !addr.isEmpty() ) |
176 | list.append( addr ); | 176 | list.append( addr ); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | return list; | 180 | return list; |
181 | } | 181 | } |
182 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 182 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
183 | void ViewManager::setSelected() | 183 | void ViewManager::setSelected() |
184 | { | 184 | { |
185 | setSelected( QString::null, true ); | 185 | setSelected( QString::null, true ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void ViewManager::setSelected( const QString &uid, bool selected ) | 188 | void ViewManager::setSelected( const QString &uid, bool selected ) |
189 | { | 189 | { |
190 | if ( mActiveView ) | 190 | if ( mActiveView ) |
191 | mActiveView->setSelected( uid, selected ); | 191 | mActiveView->setSelected( uid, selected ); |
192 | } | 192 | } |
193 | 193 | ||
194 | void ViewManager::setListSelected(QStringList list) | 194 | void ViewManager::setListSelected(QStringList list) |
195 | { | 195 | { |
196 | int i, count = list.count(); | 196 | int i, count = list.count(); |
197 | for ( i = 0; i < count;++i ) | 197 | for ( i = 0; i < count;++i ) |
198 | setSelected( list[i], true ); | 198 | setSelected( list[i], true ); |
199 | 199 | ||
200 | } | 200 | } |
201 | void ViewManager::unloadViews() | 201 | void ViewManager::unloadViews() |
202 | { | 202 | { |
203 | mViewDict.clear(); | 203 | mViewDict.clear(); |
204 | mActiveView = 0; | 204 | mActiveView = 0; |
205 | } | 205 | } |
206 | 206 | ||
207 | void ViewManager::selectView( const QString &name ) | 207 | void ViewManager::selectView( const QString &name ) |
208 | { | 208 | { |
209 | setActiveView( name ); | 209 | setActiveView( name ); |
210 | mCore->saveSettings(); | 210 | mCore->saveSettings(); |
211 | } | 211 | } |
212 | void ViewManager::setActiveView( const QString &name ) | 212 | void ViewManager::setActiveView( const QString &name ) |
213 | { | 213 | { |
214 | KAddressBookView *view = 0; | 214 | KAddressBookView *view = 0; |
215 | 215 | ||
216 | // Check that this isn't the same as the current active view | 216 | // Check that this isn't the same as the current active view |
217 | if ( mActiveView && ( mActiveView->caption() == name ) ) | 217 | if ( mActiveView && ( mActiveView->caption() == name ) ) |
218 | return; | 218 | return; |
219 | 219 | ||
220 | // At this point we know the view that should be active is not | 220 | // At this point we know the view that should be active is not |
221 | // currently active. We will try to find the new on in the list. If | 221 | // currently active. We will try to find the new on in the list. If |
222 | // we can't find it, it means it hasn't been instantiated, so we will | 222 | // we can't find it, it means it hasn't been instantiated, so we will |
223 | // create it on demand. | 223 | // create it on demand. |
224 | 224 | ||
225 | view = mViewDict.find( name ); | 225 | view = mViewDict.find( name ); |
226 | 226 | ||
227 | // Check if we found the view. If we didn't, then we need to create it | 227 | // Check if we found the view. If we didn't, then we need to create it |
228 | if ( view == 0 ) { | 228 | if ( view == 0 ) { |
229 | KConfig *config = mCore->config(); | 229 | KConfig *config = mCore->config(); |
230 | 230 | ||
231 | KConfigGroupSaver saver( config, name ); | 231 | KConfigGroupSaver saver( config, name ); |
232 | 232 | ||
233 | QString type = config->readEntry( "Type", "Table" ); | 233 | QString type = config->readEntry( "Type", "Table" ); |
234 | 234 | ||
235 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; | 235 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; |
236 | 236 | ||
237 | ViewFactory *factory = mViewFactoryDict.find( type ); | 237 | ViewFactory *factory = mViewFactoryDict.find( type ); |
238 | if ( factory ) | 238 | if ( factory ) |
239 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); | 239 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); |
240 | 240 | ||
241 | if ( view ) { | 241 | if ( view ) { |
242 | view->setCaption( name ); | 242 | view->setCaption( name ); |
243 | mViewDict.insert( name, view ); | 243 | mViewDict.insert( name, view ); |
244 | //US my version needs an int as second parameter to addWidget | 244 | //US my version needs an int as second parameter to addWidget |
245 | mViewWidgetStack->addWidget( view, -1 ); | 245 | mViewWidgetStack->addWidget( view, -1 ); |
246 | view->readConfig( config ); | 246 | view->readConfig( config ); |
247 | 247 | ||
248 | // The manager just relays the signals | 248 | // The manager just relays the signals |
249 | connect( view, SIGNAL( selected( const QString& ) ), | 249 | connect( view, SIGNAL( selected( const QString& ) ), |
250 | SIGNAL( selected( const QString & ) ) ); | 250 | SIGNAL( selected( const QString & ) ) ); |
251 | connect( view, SIGNAL( executed( const QString& ) ), | 251 | connect( view, SIGNAL( executed( const QString& ) ), |
252 | SIGNAL( executed( const QString& ) ) ); | 252 | SIGNAL( executed( const QString& ) ) ); |
253 | 253 | ||
254 | connect( view, SIGNAL( deleteRequest( ) ), | 254 | connect( view, SIGNAL( deleteRequest( ) ), |
255 | SIGNAL( deleteRequest( ) ) ); | 255 | SIGNAL( deleteRequest( ) ) ); |
256 | 256 | ||
257 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); | 257 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); |
258 | connect( view, SIGNAL( dropped( QDropEvent* ) ), | 258 | connect( view, SIGNAL( dropped( QDropEvent* ) ), |
259 | SLOT( dropped( QDropEvent* ) ) ); | 259 | SLOT( dropped( QDropEvent* ) ) ); |
260 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); | 260 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | // If we found or created the view, raise it and refresh it | 264 | // If we found or created the view, raise it and refresh it |
265 | if ( view ) { | 265 | if ( view ) { |
266 | mActiveView = view; | 266 | mActiveView = view; |
267 | mViewWidgetStack->raiseWidget( view ); | 267 | mViewWidgetStack->raiseWidget( view ); |
268 | // Set the proper filter in the view. By setting the combo | 268 | // Set the proper filter in the view. By setting the combo |
269 | // box, the activated slot will be called, which will push | 269 | // box, the activated slot will be called, which will push |
270 | // the filter to the view and refresh it. | 270 | // the filter to the view and refresh it. |
271 | 271 | ||
272 | if ( view->defaultFilterType() == KAddressBookView::None ) { | 272 | if ( view->defaultFilterType() == KAddressBookView::None ) { |
273 | 273 | ||
274 | mActionSelectFilter->setCurrentItem( 0 ); | 274 | mActionSelectFilter->setCurrentItem( 0 ); |
275 | setActiveFilter( 0 ); | 275 | setActiveFilter( 0 ); |
276 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { | 276 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { |
277 | setActiveFilter( mActionSelectFilter->currentItem() ); | 277 | setActiveFilter( mActionSelectFilter->currentItem() ); |
278 | } else { | 278 | } else { |
279 | uint pos = filterPosition( view->defaultFilterName() ); | 279 | uint pos = filterPosition( view->defaultFilterName() ); |
280 | mActionSelectFilter->setCurrentItem( pos ); | 280 | mActionSelectFilter->setCurrentItem( pos ); |
281 | setActiveFilter( pos ); | 281 | setActiveFilter( pos ); |
282 | } | 282 | } |
283 | //US qDebug("ViewManager::setActiveView 6" ); | 283 | //US qDebug("ViewManager::setActiveView 6" ); |
284 | 284 | ||
285 | // Update the inc search widget to show the fields in the new active | 285 | // Update the inc search widget to show the fields in the new active |
286 | // view. | 286 | // view. |
287 | mCore->setSearchFields( mActiveView->fields() ); | 287 | mCore->setSearchFields( mActiveView->fields() ); |
288 | 288 | ||
289 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 289 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
290 | //US mActiveView->refresh(); | 290 | //US mActiveView->refresh(); |
291 | } | 291 | } |
292 | else | 292 | else |
293 | { | 293 | { |
294 | qDebug("ViewManager::setActiveView: unable to find view" ); | 294 | qDebug("ViewManager::setActiveView: unable to find view" ); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 298 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
299 | void ViewManager::refreshView() | 299 | void ViewManager::refreshView() |
300 | { | 300 | { |
301 | refreshView( QString::null ); | 301 | refreshView( QString::null ); |
302 | } | 302 | } |
303 | 303 | ||
304 | void ViewManager::refreshView( const QString &uid ) | 304 | void ViewManager::refreshView( const QString &uid ) |
305 | { | 305 | { |
306 | if ( mActiveView ) | 306 | if ( mActiveView ) |
307 | mActiveView->refresh( uid ); | 307 | mActiveView->refresh( uid ); |
308 | } | 308 | } |
309 | 309 | ||
310 | void ViewManager::setFocusAV() | 310 | void ViewManager::setFocusAV() |
311 | { | 311 | { |
312 | if ( mActiveView ) | 312 | if ( mActiveView ) |
313 | mActiveView->setFocusAV(); | 313 | mActiveView->setFocusAV(); |
314 | } | 314 | } |
315 | void ViewManager::editView() | 315 | void ViewManager::editView() |
316 | { | 316 | { |
317 | if ( !mActiveView ) | 317 | if ( !mActiveView ) |
318 | return; | 318 | return; |
319 | 319 | ||
320 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); | 320 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); |
321 | ViewConfigureWidget *wdg = 0; | 321 | ViewConfigureWidget *wdg = 0; |
322 | ViewConfigureDialog* dlg = 0; | 322 | ViewConfigureDialog* dlg = 0; |
323 | if ( factory ) { | 323 | if ( factory ) { |
324 | // Save the filters so the dialog has the latest set | 324 | // Save the filters so the dialog has the latest set |
325 | Filter::save( mCore->config(), "Filter", mFilterList ); | 325 | Filter::save( mCore->config(), "Filter", mFilterList ); |
326 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); | 326 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); |
327 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); | 327 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); |
328 | } else { | 328 | } else { |
329 | qDebug("ViewManager::editView()::cannot find viewfactory "); | 329 | qDebug("ViewManager::editView()::cannot find viewfactory "); |
330 | return; | 330 | return; |
331 | } | 331 | } |
332 | if ( wdg ) { | 332 | if ( wdg ) { |
333 | dlg->setWidget( wdg ); | 333 | dlg->setWidget( wdg ); |
334 | 334 | ||
335 | #ifndef DESKTOP_VERSION | 335 | #ifndef DESKTOP_VERSION |
336 | //dlg.setMaximumSize( 640, 480 ); | 336 | //dlg.setMaximumSize( 640, 480 ); |
337 | //dlg->setGeometry( 40,40, 400, 300); | 337 | //dlg->setGeometry( 40,40, 400, 300); |
338 | dlg->showMaximized(); | 338 | dlg->showMaximized(); |
339 | #endif | 339 | #endif |
340 | 340 | ||
341 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); | 341 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); |
342 | 342 | ||
343 | dlg->restoreSettings( mCore->config() ); | 343 | dlg->restoreSettings( mCore->config() ); |
344 | 344 | ||
345 | if ( dlg->exec() ) { | 345 | if ( dlg->exec() ) { |
346 | dlg->saveSettings( mCore->config() ); | 346 | dlg->saveSettings( mCore->config() ); |
347 | mActiveView->readConfig( mCore->config() ); | 347 | mActiveView->readConfig( mCore->config() ); |
348 | 348 | ||
349 | // Set the proper filter in the view. By setting the combo | 349 | // Set the proper filter in the view. By setting the combo |
350 | // box, the activated slot will be called, which will push | 350 | // box, the activated slot will be called, which will push |
351 | // the filter to the view and refresh it. | 351 | // the filter to the view and refresh it. |
352 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { | 352 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { |
353 | mActionSelectFilter->setCurrentItem( 0 ); | 353 | mActionSelectFilter->setCurrentItem( 0 ); |
354 | setActiveFilter( 0 ); | 354 | setActiveFilter( 0 ); |
355 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { | 355 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { |
356 | setActiveFilter( mActionSelectFilter->currentItem() ); | 356 | setActiveFilter( mActionSelectFilter->currentItem() ); |
357 | } else { | 357 | } else { |
358 | uint pos = filterPosition( mActiveView->defaultFilterName() ); | 358 | uint pos = filterPosition( mActiveView->defaultFilterName() ); |
359 | mActionSelectFilter->setCurrentItem( pos ); | 359 | mActionSelectFilter->setCurrentItem( pos ); |
360 | setActiveFilter( pos ); | 360 | setActiveFilter( pos ); |
361 | } | 361 | } |
362 | mCore->setSearchFields( mActiveView->fields() ); | 362 | mCore->setSearchFields( mActiveView->fields() ); |
363 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 363 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
364 | //US mActiveView->refresh(); | 364 | //US mActiveView->refresh(); |
365 | 365 | ||
366 | 366 | ||
367 | //US this is a bugfix, that we get notified if we change a views configuration | 367 | //US this is a bugfix, that we get notified if we change a views configuration |
368 | emit modified(); | 368 | emit modified(); |
369 | 369 | ||
370 | } | 370 | } |
371 | 371 | ||
372 | } | 372 | } |
373 | delete dlg; | 373 | delete dlg; |
374 | } | 374 | } |
375 | 375 | ||
376 | void ViewManager::deleteView() | 376 | void ViewManager::deleteView() |
377 | { | 377 | { |
378 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) | 378 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) |
379 | .arg( mActiveView->caption() ); | 379 | .arg( mActiveView->caption() ); |
380 | QString caption = i18n( "Confirm Delete" ); | 380 | QString caption = i18n( "Confirm Delete" ); |
381 | 381 | ||
382 | 382 | ||
383 | if (QMessageBox::information( this, caption, | 383 | if (QMessageBox::information( this, caption, |
384 | text, | 384 | text, |
385 | i18n("Yes!"), i18n("No"), 0, 0 ) == 0) | 385 | i18n("Yes!"), i18n("No"), 0, 0 ) == 0) |
386 | { | 386 | { |
387 | mViewNameList.remove( mActiveView->caption() ); | 387 | mViewNameList.remove( mActiveView->caption() ); |
388 | 388 | ||
389 | // remove the view from the config file | 389 | // remove the view from the config file |
390 | KConfig *config = mCore->config(); | 390 | KConfig *config = mCore->config(); |
391 | config->deleteGroup( mActiveView->caption() ); | 391 | config->deleteGroup( mActiveView->caption() ); |
392 | 392 | ||
393 | mViewDict.remove( mActiveView->caption() ); | 393 | mViewDict.remove( mActiveView->caption() ); |
394 | mActiveView = 0; | 394 | mActiveView = 0; |
395 | 395 | ||
396 | // we are in an invalid state now, but that should be fixed after | 396 | // we are in an invalid state now, but that should be fixed after |
397 | // we emit the signal | 397 | // we emit the signal |
398 | mActionSelectView->setItems( mViewNameList ); | 398 | mActionSelectView->setItems( mViewNameList ); |
399 | if ( mViewNameList.count() > 0 ) { | 399 | if ( mViewNameList.count() > 0 ) { |
400 | mActionSelectView->setCurrentItem( 0 ); | 400 | mActionSelectView->setCurrentItem( 0 ); |
401 | setActiveView( mViewNameList[ 0 ] ); | 401 | setActiveView( mViewNameList[ 0 ] ); |
402 | } | 402 | } |
403 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 403 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | void ViewManager::addView() | 407 | void ViewManager::addView() |
408 | { | 408 | { |
409 | AddViewDialog dialog( &mViewFactoryDict, this ); | 409 | AddViewDialog dialog( &mViewFactoryDict, this ); |
410 | 410 | ||
411 | if ( dialog.exec() ) { | 411 | if ( dialog.exec() ) { |
412 | QString newName = dialog.viewName(); | 412 | QString newName = dialog.viewName(); |
413 | QString type = dialog.viewType(); | 413 | QString type = dialog.viewType(); |
414 | 414 | ||
415 | // Check for name conflicts | 415 | // Check for name conflicts |
416 | bool firstConflict = true; | 416 | bool firstConflict = true; |
417 | int numTries = 1; | 417 | int numTries = 1; |
418 | while ( mViewNameList.contains( newName ) > 0 ) { | 418 | while ( mViewNameList.contains( newName ) > 0 ) { |
419 | if ( !firstConflict ) { | 419 | if ( !firstConflict ) { |
420 | newName = newName.left( newName.length() - 4 ); | 420 | newName = newName.left( newName.length() - 4 ); |
421 | firstConflict = false; | 421 | firstConflict = false; |
422 | } | 422 | } |
423 | 423 | ||
424 | newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries ); | 424 | newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries ); |
425 | numTries++; | 425 | numTries++; |
426 | } | 426 | } |
427 | 427 | ||
428 | // Add the new one to the list | 428 | // Add the new one to the list |
429 | mViewNameList.append( newName ); | 429 | mViewNameList.append( newName ); |
430 | 430 | ||
431 | // write the view to the config file, | 431 | // write the view to the config file, |
432 | KConfig *config = mCore->config(); | 432 | KConfig *config = mCore->config(); |
433 | 433 | ||
434 | config->deleteGroup( newName ); | 434 | config->deleteGroup( newName ); |
435 | 435 | ||
436 | KConfigGroupSaver saver( config, newName ); | 436 | KConfigGroupSaver saver( config, newName ); |
437 | 437 | ||
438 | config->writeEntry( "Type", type ); | 438 | config->writeEntry( "Type", type ); |
439 | 439 | ||
440 | // try to set the active view | 440 | // try to set the active view |
441 | mActionSelectView->setItems( mViewNameList ); | 441 | mActionSelectView->setItems( mViewNameList ); |
442 | mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); | 442 | mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); |
443 | setActiveView( newName ); | 443 | setActiveView( newName ); |
444 | 444 | ||
445 | editView(); | 445 | editView(); |
446 | 446 | ||
447 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 447 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | void ViewManager::createViewFactories() | 451 | void ViewManager::createViewFactories() |
452 | { | 452 | { |
453 | #ifndef KAB_EMBEDDED | 453 | #ifndef KAB_EMBEDDED |
454 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); | 454 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); |
455 | KTrader::OfferList::ConstIterator it; | 455 | KTrader::OfferList::ConstIterator it; |
456 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 456 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
457 | if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) | 457 | if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) |
458 | continue; | 458 | continue; |
459 | 459 | ||
460 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 460 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
461 | 461 | ||
462 | if ( !factory ) { | 462 | if ( !factory ) { |
463 | kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; | 463 | kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; |
464 | continue; | 464 | continue; |
465 | } | 465 | } |
466 | 466 | ||
467 | ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); | 467 | ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); |
468 | 468 | ||
469 | if ( !viewFactory ) { | 469 | if ( !viewFactory ) { |
470 | kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; | 470 | kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; |
471 | continue; | 471 | continue; |
472 | } | 472 | } |
473 | 473 | ||
474 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 474 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
475 | } | 475 | } |
476 | 476 | ||
477 | #else //KAB_EMBEDDED | 477 | #else //KAB_EMBEDDED |
478 | ViewFactory* viewFactory = new IconViewFactory(); | 478 | ViewFactory* viewFactory = new IconViewFactory(); |
479 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 479 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
480 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 480 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
481 | 481 | ||
482 | viewFactory = new TableViewFactory(); | 482 | viewFactory = new TableViewFactory(); |
483 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 483 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
484 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 484 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
485 | 485 | ||
486 | viewFactory = new CardViewFactory(); | 486 | viewFactory = new CardViewFactory(); |
487 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 487 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
488 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 488 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
489 | 489 | ||
490 | #endif //KAB_EMBEDDED | 490 | #endif //KAB_EMBEDDED |
491 | 491 | ||
492 | } | 492 | } |
493 | 493 | ||
494 | void ViewManager::dropped( QDropEvent *e ) | 494 | void ViewManager::dropped( QDropEvent *e ) |
495 | { | 495 | { |
496 | 496 | ||
497 | #ifndef KAB_EMBEDDED | 497 | #ifndef KAB_EMBEDDED |
498 | 498 | ||
499 | QString clipText, vcards; | 499 | QString clipText, vcards; |
500 | KURL::List urls; | 500 | KURL::List urls; |
501 | 501 | ||
502 | if ( KURLDrag::decode( e, urls) ) { | 502 | if ( KURLDrag::decode( e, urls) ) { |
503 | KURL::List::Iterator it = urls.begin(); | 503 | KURL::List::Iterator it = urls.begin(); |
504 | int c = urls.count(); | 504 | int c = urls.count(); |
505 | if ( c > 1 ) { | 505 | if ( c > 1 ) { |
506 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); | 506 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); |
507 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { | 507 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { |
508 | for ( ; it != urls.end(); ++it ) | 508 | for ( ; it != urls.end(); ++it ) |
509 | emit urlDropped( *it ); | 509 | emit urlDropped( *it ); |
510 | } | 510 | } |
511 | } else if ( c == 1 ) | 511 | } else if ( c == 1 ) |
512 | emit urlDropped( *it ); | 512 | emit urlDropped( *it ); |
513 | } else if ( KVCardDrag::decode( e, vcards ) ) { | 513 | } else if ( KVCardDrag::decode( e, vcards ) ) { |
514 | KABC::Addressee addr; | 514 | KABC::Addressee addr; |
515 | KABC::VCardConverter converter; | 515 | KABC::VCardConverter converter; |
516 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); | 516 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); |
517 | QStringList::Iterator it; | 517 | QStringList::Iterator it; |
518 | for ( it = list.begin(); it != list.end(); ++it ) { | 518 | for ( it = list.begin(); it != list.end(); ++it ) { |
519 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { | 519 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { |
520 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); | 520 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); |
521 | if ( a.isEmpty() ) { | 521 | if ( a.isEmpty() ) { |
522 | mCore->addressBook()->insertAddressee( addr ); | 522 | mCore->addressBook()->insertAddressee( addr ); |
523 | emit modified(); | 523 | emit modified(); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | } | 526 | } |
527 | 527 | ||
528 | mActiveView->refresh(); | 528 | mActiveView->refresh(); |
529 | } | 529 | } |
530 | #else //KAB_EMBEDDED | 530 | #else //KAB_EMBEDDED |
531 | qDebug("ViewManager::dropped() has to be changed!!" ); | 531 | qDebug("ViewManager::dropped() has to be changed!!" ); |
532 | #endif //KAB_EMBEDDED | 532 | #endif //KAB_EMBEDDED |
533 | 533 | ||
534 | } | 534 | } |
535 | 535 | ||
536 | void ViewManager::startDrag() | 536 | void ViewManager::startDrag() |
537 | { | 537 | { |
538 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 538 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
539 | 539 | ||
540 | #ifndef KAB_EMBEDDED | 540 | #ifndef KAB_EMBEDDED |
541 | 541 | ||
542 | // Get the list of all the selected addressees | 542 | // Get the list of all the selected addressees |
543 | KABC::Addressee::List addrList; | 543 | KABC::Addressee::List addrList; |
544 | QStringList uidList = selectedUids(); | 544 | QStringList uidList = selectedUids(); |
545 | QStringList::Iterator iter; | 545 | QStringList::Iterator iter; |
546 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 546 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
547 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 547 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
548 | 548 | ||
549 | KMultipleDrag *drag = new KMultipleDrag( this ); | 549 | KMultipleDrag *drag = new KMultipleDrag( this ); |
550 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 550 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
551 | KABC::Addressee::List::Iterator it; | 551 | KABC::Addressee::List::Iterator it; |
552 | QStringList vcards; | 552 | QStringList vcards; |
553 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 553 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
554 | QString vcard = QString::null; | 554 | QString vcard = QString::null; |
555 | KABC::VCardConverter converter; | 555 | KABC::VCardConverter converter; |
556 | if ( converter.addresseeToVCard( *it, vcard ) ) | 556 | if ( converter.addresseeToVCard( *it, vcard ) ) |
557 | vcards.append( vcard ); | 557 | vcards.append( vcard ); |
558 | } | 558 | } |
559 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 559 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
560 | 560 | ||
561 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 561 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
562 | drag->dragCopy(); | 562 | drag->dragCopy(); |
563 | 563 | ||
564 | #else //KAB_EMBEDDED | 564 | #else //KAB_EMBEDDED |
565 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 565 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
566 | #endif //KAB_EMBEDDED | 566 | #endif //KAB_EMBEDDED |
567 | 567 | ||
568 | } | 568 | } |
569 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 569 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
570 | { | 570 | { |
571 | if ( mActiveView ) | 571 | if ( mActiveView ) |
572 | mActiveView->doSearch( s, field ); | 572 | mActiveView->doSearch( s, field ); |
573 | 573 | ||
574 | } | 574 | } |
575 | void ViewManager::setActiveFilter( int index ) | 575 | void ViewManager::setActiveFilter( int index ) |
576 | { | 576 | { |
577 | Filter currentFilter; | 577 | Filter currentFilter; |
578 | 578 | ||
579 | if ( ( index - 1 ) < 0 ) | 579 | if ( ( index - 1 ) < 0 ) |
580 | currentFilter = Filter(); | 580 | currentFilter = Filter(); |
581 | else | 581 | else |
582 | currentFilter = mFilterList[ index - 1 ]; | 582 | currentFilter = mFilterList[ index - 1 ]; |
583 | 583 | ||
584 | // Check if we have a view. Since the filter combo is created before | 584 | // Check if we have a view. Since the filter combo is created before |
585 | // the view, this slot could be called before there is a valid view. | 585 | // the view, this slot could be called before there is a valid view. |
586 | if ( mActiveView ) { | 586 | if ( mActiveView ) { |
587 | mActiveView->setFilter( currentFilter ); | 587 | mActiveView->setFilter( currentFilter ); |
588 | mActiveView->refresh(); | 588 | mActiveView->refresh(); |
589 | emit selected( QString::null ); | 589 | emit selected( QString::null ); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | void ViewManager::configureFilters() | 593 | void ViewManager::configureFilters() |
594 | { | 594 | { |
595 | FilterDialog dlg( this ); | 595 | FilterDialog dlg( this ); |
596 | 596 | ||
597 | dlg.setFilters( mFilterList ); | 597 | dlg.setFilters( mFilterList ); |
598 | 598 | ||
599 | if ( dlg.exec() ) | 599 | if ( dlg.exec() ) |
600 | mFilterList = dlg.filters(); | 600 | mFilterList = dlg.filters(); |
601 | 601 | ||
602 | uint pos = mActionSelectFilter->currentItem(); | 602 | uint pos = mActionSelectFilter->currentItem(); |
603 | mActionSelectFilter->setItems( filterNames() ); | 603 | mActionSelectFilter->setItems( filterNames() ); |
604 | mActionSelectFilter->setCurrentItem( pos ); | 604 | mActionSelectFilter->setCurrentItem( pos ); |
605 | setActiveFilter( pos ); | 605 | setActiveFilter( pos ); |
606 | int cw = 150; | 606 | int cw = 150; |
607 | if (QApplication::desktop()->width() == 480 ) | 607 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
608 | cw = 0; | 608 | cw = 0; |
609 | mActionSelectFilter->setComboWidth( cw ); | 609 | mActionSelectFilter->setComboWidth( cw ); |
610 | saveSettings(); | 610 | saveSettings(); |
611 | } | 611 | } |
612 | 612 | ||
613 | QStringList ViewManager::filterNames() const | 613 | QStringList ViewManager::filterNames() const |
614 | { | 614 | { |
615 | QStringList names( i18n( "No Filter" ) ); | 615 | QStringList names( i18n( "No Filter" ) ); |
616 | 616 | ||
617 | Filter::List::ConstIterator it; | 617 | Filter::List::ConstIterator it; |
618 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 618 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
619 | names.append( (*it).name() ); | 619 | names.append( (*it).name() ); |
620 | 620 | ||
621 | return names; | 621 | return names; |
622 | } | 622 | } |
623 | Filter ViewManager::getFilterByName( const QString &name ) const | 623 | Filter ViewManager::getFilterByName( const QString &name ) const |
624 | { | 624 | { |
625 | Filter::List::ConstIterator it; | 625 | Filter::List::ConstIterator it; |
626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
627 | if ( name == (*it).name() ) | 627 | if ( name == (*it).name() ) |
628 | return (*it); | 628 | return (*it); |
629 | 629 | ||
630 | return Filter(); | 630 | return Filter(); |
631 | } | 631 | } |
632 | 632 | ||
633 | int ViewManager::filterPosition( const QString &name ) const | 633 | int ViewManager::filterPosition( const QString &name ) const |
634 | { | 634 | { |
635 | int pos = 0; | 635 | int pos = 0; |
636 | 636 | ||
637 | Filter::List::ConstIterator it; | 637 | Filter::List::ConstIterator it; |
638 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 638 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
639 | if ( name == (*it).name() ) | 639 | if ( name == (*it).name() ) |
640 | return pos + 1; | 640 | return pos + 1; |
641 | 641 | ||
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | void ViewManager::initActions() | 645 | void ViewManager::initActions() |
646 | { | 646 | { |
647 | //US <ActionList name="view_loadedviews"/> | 647 | //US <ActionList name="view_loadedviews"/> |
648 | //US <Separator/> | 648 | //US <Separator/> |
649 | 649 | ||
650 | #ifdef KAB_EMBEDDED | 650 | #ifdef KAB_EMBEDDED |
651 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 651 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
652 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 652 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
653 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 653 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
654 | #endif //KAB_EMBEDDED | 654 | #endif //KAB_EMBEDDED |
655 | 655 | ||
656 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 656 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
657 | #if KDE_VERSION >= 309 | 657 | #if KDE_VERSION >= 309 |
658 | mActionSelectView->setMenuAccelsEnabled( false ); | 658 | mActionSelectView->setMenuAccelsEnabled( false ); |
659 | #endif | 659 | #endif |
660 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 660 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
661 | SLOT( selectView( const QString& ) ) ); | 661 | SLOT( selectView( const QString& ) ) ); |
662 | 662 | ||
663 | 663 | ||
664 | #ifdef KAB_EMBEDDED | 664 | #ifdef KAB_EMBEDDED |
665 | mActionSelectView->plug(viewmenu); | 665 | mActionSelectView->plug(viewmenu); |
666 | viewmenu->insertSeparator(); | 666 | viewmenu->insertSeparator(); |
667 | #endif //KAB_EMBEDDED | 667 | #endif //KAB_EMBEDDED |
668 | 668 | ||
669 | KAction *action; | 669 | KAction *action; |
670 | 670 | ||
671 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 671 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
672 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 672 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
673 | #ifndef KAB_EMBEDDED | 673 | #ifndef KAB_EMBEDDED |
674 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 674 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
675 | #else //KAB_EMBEDDED | 675 | #else //KAB_EMBEDDED |
676 | action->plug(viewmenu); | 676 | action->plug(viewmenu); |
677 | #endif //KAB_EMBEDDED | 677 | #endif //KAB_EMBEDDED |
678 | 678 | ||
679 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 679 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
680 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 680 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
681 | #ifndef KAB_EMBEDDED | 681 | #ifndef KAB_EMBEDDED |
682 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); | 682 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); |
683 | #else //KAB_EMBEDDED | 683 | #else //KAB_EMBEDDED |
684 | action->plug(viewmenu); | 684 | action->plug(viewmenu); |
685 | #endif //KAB_EMBEDDED | 685 | #endif //KAB_EMBEDDED |
686 | 686 | ||
687 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, | 687 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, |
688 | this, SLOT( deleteView() ), | 688 | this, SLOT( deleteView() ), |
689 | mCore->actionCollection(), "view_delete" ); | 689 | mCore->actionCollection(), "view_delete" ); |
690 | #ifndef KAB_EMBEDDED | 690 | #ifndef KAB_EMBEDDED |
691 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); | 691 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); |
692 | #else //KAB_EMBEDDED | 692 | #else //KAB_EMBEDDED |
693 | mActionDeleteView->plug(viewmenu); | 693 | mActionDeleteView->plug(viewmenu); |
694 | viewmenu->insertSeparator(); | 694 | viewmenu->insertSeparator(); |
695 | #endif //KAB_EMBEDDED | 695 | #endif //KAB_EMBEDDED |
696 | 696 | ||
697 | #ifndef KAB_EMBEDDED | 697 | #ifndef KAB_EMBEDDED |
698 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 698 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
699 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), | 699 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), |
700 | "view_refresh" ); | 700 | "view_refresh" ); |
701 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); | 701 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); |
702 | #else //KAB_EMBEDDED | 702 | #else //KAB_EMBEDDED |
703 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 703 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
704 | SLOT( refreshView()), mCore->actionCollection(), | 704 | SLOT( refreshView()), mCore->actionCollection(), |
705 | "view_refresh" ); | 705 | "view_refresh" ); |
706 | action->plug(viewmenu); | 706 | action->plug(viewmenu); |
707 | viewmenu->insertSeparator(); | 707 | viewmenu->insertSeparator(); |
708 | #endif //KAB_EMBEDDED | 708 | #endif //KAB_EMBEDDED |
709 | 709 | ||
710 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, | 710 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, |
711 | SLOT( configureFilters() ), mCore->actionCollection(), | 711 | SLOT( configureFilters() ), mCore->actionCollection(), |
712 | "options_edit_filters" ); | 712 | "options_edit_filters" ); |
713 | 713 | ||
714 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); | 714 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); |
715 | #if KDE_VERSION >= 309 | 715 | #if KDE_VERSION >= 309 |
716 | mActionSelectFilter->setMenuAccelsEnabled( false ); | 716 | mActionSelectFilter->setMenuAccelsEnabled( false ); |
717 | #endif | 717 | #endif |
718 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), | 718 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), |
719 | SLOT( setActiveFilter( int ) ) ); | 719 | SLOT( setActiveFilter( int ) ) ); |
720 | 720 | ||
721 | #ifdef KAB_EMBEDDED | 721 | #ifdef KAB_EMBEDDED |
722 | action->plug(settingsmenu); | 722 | action->plug(settingsmenu); |
723 | mActionSelectFilter->plug(viewmenu); | 723 | mActionSelectFilter->plug(viewmenu); |
724 | #endif //KAB_EMBEDDED | 724 | #endif //KAB_EMBEDDED |
725 | 725 | ||
726 | } | 726 | } |
727 | 727 | ||
728 | void ViewManager::initGUI() | 728 | void ViewManager::initGUI() |
729 | { | 729 | { |
730 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 730 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); |
731 | mViewWidgetStack = new QWidgetStack( this ); | 731 | mViewWidgetStack = new QWidgetStack( this ); |
732 | layout->addWidget( mViewWidgetStack ); | 732 | layout->addWidget( mViewWidgetStack ); |
733 | } | 733 | } |
734 | 734 | ||
735 | #ifndef KAB_EMBEDDED | 735 | #ifndef KAB_EMBEDDED |
736 | #include "viewmanager.moc" | 736 | #include "viewmanager.moc" |
737 | #endif //KAB_EMBEDDED | 737 | #endif //KAB_EMBEDDED |