-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 | |||
@@ -173,256 +173,257 @@ class KABCatPrefs : public QDialog | |||
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 ) |
@@ -694,286 +695,294 @@ void KABCore::setContactSelected( const QString &uid ) | |||
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 { |
@@ -1028,257 +1037,263 @@ void KABCore::deleteContacts( const QStringList &uids ) | |||
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 |
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,347 +1,362 @@ | |||
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 | ||
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,239 +1,239 @@ | |||
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 ); |
@@ -479,257 +479,257 @@ void ViewManager::createViewFactories() | |||
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 |