author | zautrix <zautrix> | 2004-09-07 23:33:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-07 23:33:23 (UTC) |
commit | 199025628054eef739a261437a51a98f5218ab0f (patch) (unidiff) | |
tree | 75ec5c537ee789dbd3e1a87a2e7db9b29d44c626 | |
parent | 2676646d4744ccceab1063dc02d772a26a203c61 (diff) | |
download | kdepimpi-199025628054eef739a261437a51a98f5218ab0f.zip kdepimpi-199025628054eef739a261437a51a98f5218ab0f.tar.gz kdepimpi-199025628054eef739a261437a51a98f5218ab0f.tar.bz2 |
Fixed default settings
-rw-r--r-- | kaddressbook/kabcore.cpp | 7 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 8 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 3 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 4 |
4 files changed, 15 insertions, 7 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 6522ccc..5cd9649 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,2139 +1,2142 @@ | |||
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | 35 | ||
36 | #ifndef KAB_EMBEDDED | 36 | #ifndef KAB_EMBEDDED |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qapplicaton.h> | 40 | #include <qapplicaton.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qvbox.h> | 43 | #include <qvbox.h> |
44 | #include <kabc/addresseelist.h> | 44 | #include <kabc/addresseelist.h> |
45 | #include <kabc/errorhandler.h> | 45 | #include <kabc/errorhandler.h> |
46 | #include <kabc/resource.h> | 46 | #include <kabc/resource.h> |
47 | #include <kabc/vcardconverter.h> | 47 | #include <kabc/vcardconverter.h> |
48 | #include <kapplication.h> | 48 | #include <kapplication.h> |
49 | #include <kactionclasses.h> | 49 | #include <kactionclasses.h> |
50 | #include <kcmultidialog.h> | 50 | #include <kcmultidialog.h> |
51 | #include <kdebug.h> | 51 | #include <kdebug.h> |
52 | #include <kdeversion.h> | 52 | #include <kdeversion.h> |
53 | #include <kkeydialog.h> | 53 | #include <kkeydialog.h> |
54 | #include <kmessagebox.h> | 54 | #include <kmessagebox.h> |
55 | #include <kprinter.h> | 55 | #include <kprinter.h> |
56 | #include <kprotocolinfo.h> | 56 | #include <kprotocolinfo.h> |
57 | #include <kresources/selectdialog.h> | 57 | #include <kresources/selectdialog.h> |
58 | #include <kstandarddirs.h> | 58 | #include <kstandarddirs.h> |
59 | #include <ktempfile.h> | 59 | #include <ktempfile.h> |
60 | #include <kxmlguiclient.h> | 60 | #include <kxmlguiclient.h> |
61 | #include <kaboutdata.h> | 61 | #include <kaboutdata.h> |
62 | #include <libkdepim/categoryselectdialog.h> | 62 | #include <libkdepim/categoryselectdialog.h> |
63 | 63 | ||
64 | #include "addresseeutil.h" | 64 | #include "addresseeutil.h" |
65 | #include "addresseeeditordialog.h" | 65 | #include "addresseeeditordialog.h" |
66 | #include "extensionmanager.h" | 66 | #include "extensionmanager.h" |
67 | #include "kstdaction.h" | 67 | #include "kstdaction.h" |
68 | #include "kaddressbookservice.h" | 68 | #include "kaddressbookservice.h" |
69 | #include "ldapsearchdialog.h" | 69 | #include "ldapsearchdialog.h" |
70 | #include "printing/printingwizard.h" | 70 | #include "printing/printingwizard.h" |
71 | #else // KAB_EMBEDDED | 71 | #else // KAB_EMBEDDED |
72 | 72 | ||
73 | #include <kapplication.h> | 73 | #include <kapplication.h> |
74 | #include "KDGanttMinimizeSplitter.h" | 74 | #include "KDGanttMinimizeSplitter.h" |
75 | #include "kaddressbookmain.h" | 75 | #include "kaddressbookmain.h" |
76 | #include "kactioncollection.h" | 76 | #include "kactioncollection.h" |
77 | #include "addresseedialog.h" | 77 | #include "addresseedialog.h" |
78 | //US | 78 | //US |
79 | #include <libkdepim/addresseeview.h> | 79 | #include <libkdepim/addresseeview.h> |
80 | 80 | ||
81 | #include <qapp.h> | 81 | #include <qapp.h> |
82 | #include <qmenubar.h> | 82 | #include <qmenubar.h> |
83 | //#include <qtoolbar.h> | 83 | //#include <qtoolbar.h> |
84 | #include <qmessagebox.h> | 84 | #include <qmessagebox.h> |
85 | #include <kdebug.h> | 85 | #include <kdebug.h> |
86 | #include <kiconloader.h> // needed for SmallIcon | 86 | #include <kiconloader.h> // needed for SmallIcon |
87 | #include <kresources/kcmkresources.h> | 87 | #include <kresources/kcmkresources.h> |
88 | #include <ktoolbar.h> | 88 | #include <ktoolbar.h> |
89 | 89 | ||
90 | 90 | ||
91 | //#include <qlabel.h> | 91 | //#include <qlabel.h> |
92 | 92 | ||
93 | 93 | ||
94 | #ifndef DESKTOP_VERSION | 94 | #ifndef DESKTOP_VERSION |
95 | #include <qpe/ir.h> | 95 | #include <qpe/ir.h> |
96 | #include <qtopia/qcopenvelope_qws.h> | 96 | #include <qtopia/qcopenvelope_qws.h> |
97 | #else | 97 | #else |
98 | 98 | ||
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | #endif // KAB_EMBEDDED | 101 | #endif // KAB_EMBEDDED |
102 | #include "kcmconfigs/kcmkabconfig.h" | 102 | #include "kcmconfigs/kcmkabconfig.h" |
103 | #include "kcmconfigs/kcmkdepimconfig.h" | 103 | #include "kcmconfigs/kcmkdepimconfig.h" |
104 | #include "kpimglobalprefs.h" | 104 | #include "kpimglobalprefs.h" |
105 | #include "externalapphandler.h" | 105 | #include "externalapphandler.h" |
106 | 106 | ||
107 | 107 | ||
108 | #include <kresources/selectdialog.h> | 108 | #include <kresources/selectdialog.h> |
109 | #include <kmessagebox.h> | 109 | #include <kmessagebox.h> |
110 | 110 | ||
111 | #include <picture.h> | 111 | #include <picture.h> |
112 | #include <resource.h> | 112 | #include <resource.h> |
113 | 113 | ||
114 | //US#include <qsplitter.h> | 114 | //US#include <qsplitter.h> |
115 | #include <qmap.h> | 115 | #include <qmap.h> |
116 | #include <qdir.h> | 116 | #include <qdir.h> |
117 | #include <qfile.h> | 117 | #include <qfile.h> |
118 | #include <qvbox.h> | 118 | #include <qvbox.h> |
119 | #include <qlayout.h> | 119 | #include <qlayout.h> |
120 | #include <qclipboard.h> | 120 | #include <qclipboard.h> |
121 | #include <qtextstream.h> | 121 | #include <qtextstream.h> |
122 | 122 | ||
123 | #include <libkdepim/categoryselectdialog.h> | 123 | #include <libkdepim/categoryselectdialog.h> |
124 | #include <kabc/vcardconverter.h> | 124 | #include <kabc/vcardconverter.h> |
125 | 125 | ||
126 | 126 | ||
127 | #include "addresseeutil.h" | 127 | #include "addresseeutil.h" |
128 | #include "undocmds.h" | 128 | #include "undocmds.h" |
129 | #include "addresseeeditordialog.h" | 129 | #include "addresseeeditordialog.h" |
130 | #include "viewmanager.h" | 130 | #include "viewmanager.h" |
131 | #include "details/detailsviewcontainer.h" | 131 | #include "details/detailsviewcontainer.h" |
132 | #include "kabprefs.h" | 132 | #include "kabprefs.h" |
133 | #include "xxportmanager.h" | 133 | #include "xxportmanager.h" |
134 | #include "incsearchwidget.h" | 134 | #include "incsearchwidget.h" |
135 | #include "jumpbuttonbar.h" | 135 | #include "jumpbuttonbar.h" |
136 | #include "extensionmanager.h" | 136 | #include "extensionmanager.h" |
137 | #include "addresseeconfig.h" | 137 | #include "addresseeconfig.h" |
138 | #include <kcmultidialog.h> | 138 | #include <kcmultidialog.h> |
139 | 139 | ||
140 | #ifdef _WIN32_ | 140 | #ifdef _WIN32_ |
141 | 141 | ||
142 | #include "kaimportoldialog.h" | 142 | #include "kaimportoldialog.h" |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | bool pasteWithNewUid = true; | 145 | bool pasteWithNewUid = true; |
146 | 146 | ||
147 | #ifdef KAB_EMBEDDED | 147 | #ifdef KAB_EMBEDDED |
148 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 148 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
149 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 149 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
150 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 150 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
151 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 151 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
152 | #else //KAB_EMBEDDED | 152 | #else //KAB_EMBEDDED |
153 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 153 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
154 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 154 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
155 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 155 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
156 | mReadWrite( readWrite ), mModified( false ) | 156 | mReadWrite( readWrite ), mModified( false ) |
157 | #endif //KAB_EMBEDDED | 157 | #endif //KAB_EMBEDDED |
158 | { | 158 | { |
159 | 159 | ||
160 | mExtensionBarSplitter = 0; | 160 | mExtensionBarSplitter = 0; |
161 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 161 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
162 | 162 | ||
163 | mAddressBook = KABC::StdAddressBook::self(); | 163 | mAddressBook = KABC::StdAddressBook::self(); |
164 | KABC::StdAddressBook::setAutomaticSave( false ); | 164 | KABC::StdAddressBook::setAutomaticSave( false ); |
165 | 165 | ||
166 | #ifndef KAB_EMBEDDED | 166 | #ifndef KAB_EMBEDDED |
167 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 167 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
168 | #endif //KAB_EMBEDDED | 168 | #endif //KAB_EMBEDDED |
169 | 169 | ||
170 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 170 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
171 | SLOT( addressBookChanged() ) ); | 171 | SLOT( addressBookChanged() ) ); |
172 | 172 | ||
173 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 173 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
174 | "X-Department", "KADDRESSBOOK" ); | 174 | "X-Department", "KADDRESSBOOK" ); |
175 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 175 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
176 | "X-Profession", "KADDRESSBOOK" ); | 176 | "X-Profession", "KADDRESSBOOK" ); |
177 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 177 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
178 | "X-AssistantsName", "KADDRESSBOOK" ); | 178 | "X-AssistantsName", "KADDRESSBOOK" ); |
179 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 179 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
180 | "X-ManagersName", "KADDRESSBOOK" ); | 180 | "X-ManagersName", "KADDRESSBOOK" ); |
181 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 181 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
182 | "X-SpousesName", "KADDRESSBOOK" ); | 182 | "X-SpousesName", "KADDRESSBOOK" ); |
183 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 183 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
184 | "X-Office", "KADDRESSBOOK" ); | 184 | "X-Office", "KADDRESSBOOK" ); |
185 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 185 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
186 | "X-IMAddress", "KADDRESSBOOK" ); | 186 | "X-IMAddress", "KADDRESSBOOK" ); |
187 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 187 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
188 | "X-Anniversary", "KADDRESSBOOK" ); | 188 | "X-Anniversary", "KADDRESSBOOK" ); |
189 | 189 | ||
190 | //US added this field to become compatible with Opie/qtopia addressbook | 190 | //US added this field to become compatible with Opie/qtopia addressbook |
191 | // values can be "female" or "male" or "". An empty field represents undefined. | 191 | // values can be "female" or "male" or "". An empty field represents undefined. |
192 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 192 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
193 | "X-Gender", "KADDRESSBOOK" ); | 193 | "X-Gender", "KADDRESSBOOK" ); |
194 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 194 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
195 | "X-Children", "KADDRESSBOOK" ); | 195 | "X-Children", "KADDRESSBOOK" ); |
196 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 196 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
197 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 197 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
198 | 198 | ||
199 | initGUI(); | 199 | initGUI(); |
200 | 200 | ||
201 | mIncSearchWidget->setFocus(); | 201 | mIncSearchWidget->setFocus(); |
202 | 202 | ||
203 | 203 | ||
204 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 204 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
205 | SLOT( setContactSelected( const QString& ) ) ); | 205 | SLOT( setContactSelected( const QString& ) ) ); |
206 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 206 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
207 | SLOT( executeContact( const QString& ) ) ); | 207 | SLOT( executeContact( const QString& ) ) ); |
208 | 208 | ||
209 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 209 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
210 | SLOT( deleteContacts( ) ) ); | 210 | SLOT( deleteContacts( ) ) ); |
211 | connect( mViewManager, SIGNAL( modified() ), | 211 | connect( mViewManager, SIGNAL( modified() ), |
212 | SLOT( setModified() ) ); | 212 | SLOT( setModified() ) ); |
213 | 213 | ||
214 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 214 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
215 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 215 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
216 | 216 | ||
217 | connect( mXXPortManager, SIGNAL( modified() ), | 217 | connect( mXXPortManager, SIGNAL( modified() ), |
218 | SLOT( setModified() ) ); | 218 | SLOT( setModified() ) ); |
219 | 219 | ||
220 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 220 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
221 | SLOT( incrementalSearch( const QString& ) ) ); | 221 | SLOT( incrementalSearch( const QString& ) ) ); |
222 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 222 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
223 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 223 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
224 | 224 | ||
225 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 225 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
226 | SLOT( sendMail( const QString& ) ) ); | 226 | SLOT( sendMail( const QString& ) ) ); |
227 | 227 | ||
228 | 228 | ||
229 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 229 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
230 | 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&))); | 230 | 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&))); |
231 | 231 | ||
232 | 232 | ||
233 | #ifndef KAB_EMBEDDED | 233 | #ifndef KAB_EMBEDDED |
234 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 234 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
235 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 235 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
236 | 236 | ||
237 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 237 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
238 | SLOT( browse( const QString& ) ) ); | 238 | SLOT( browse( const QString& ) ) ); |
239 | 239 | ||
240 | 240 | ||
241 | mAddressBookService = new KAddressBookService( this ); | 241 | mAddressBookService = new KAddressBookService( this ); |
242 | 242 | ||
243 | #endif //KAB_EMBEDDED | 243 | #endif //KAB_EMBEDDED |
244 | mEditorDialog = 0; | 244 | mEditorDialog = 0; |
245 | createAddresseeEditorDialog( this ); | 245 | createAddresseeEditorDialog( this ); |
246 | setModified( false ); | 246 | setModified( false ); |
247 | } | 247 | } |
248 | 248 | ||
249 | KABCore::~KABCore() | 249 | KABCore::~KABCore() |
250 | { | 250 | { |
251 | // save(); | 251 | // save(); |
252 | //saveSettings(); | 252 | //saveSettings(); |
253 | //KABPrefs::instance()->writeConfig(); | 253 | //KABPrefs::instance()->writeConfig(); |
254 | delete AddresseeConfig::instance(); | 254 | delete AddresseeConfig::instance(); |
255 | mAddressBook = 0; | 255 | mAddressBook = 0; |
256 | KABC::StdAddressBook::close(); | 256 | KABC::StdAddressBook::close(); |
257 | } | 257 | } |
258 | 258 | ||
259 | void KABCore::restoreSettings() | 259 | void KABCore::restoreSettings() |
260 | { | 260 | { |
261 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 261 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
262 | 262 | ||
263 | bool state; | 263 | bool state; |
264 | 264 | ||
265 | if (mMultipleViewsAtOnce) | 265 | if (mMultipleViewsAtOnce) |
266 | state = KABPrefs::instance()->mDetailsPageVisible; | 266 | state = KABPrefs::instance()->mDetailsPageVisible; |
267 | else | 267 | else |
268 | state = false; | 268 | state = false; |
269 | 269 | ||
270 | mActionDetails->setChecked( state ); | 270 | mActionDetails->setChecked( state ); |
271 | setDetailsVisible( state ); | 271 | setDetailsVisible( state ); |
272 | 272 | ||
273 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 273 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
274 | 274 | ||
275 | mActionJumpBar->setChecked( state ); | 275 | mActionJumpBar->setChecked( state ); |
276 | setJumpButtonBarVisible( state ); | 276 | setJumpButtonBarVisible( state ); |
277 | /*US | 277 | /*US |
278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 278 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
279 | if ( splitterSize.count() == 0 ) { | 279 | if ( splitterSize.count() == 0 ) { |
280 | splitterSize.append( width() / 2 ); | 280 | splitterSize.append( width() / 2 ); |
281 | splitterSize.append( width() / 2 ); | 281 | splitterSize.append( width() / 2 ); |
282 | } | 282 | } |
283 | mMiniSplitter->setSizes( splitterSize ); | 283 | mMiniSplitter->setSizes( splitterSize ); |
284 | if ( mExtensionBarSplitter ) { | 284 | if ( mExtensionBarSplitter ) { |
285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 285 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
286 | if ( splitterSize.count() == 0 ) { | 286 | if ( splitterSize.count() == 0 ) { |
287 | splitterSize.append( width() / 2 ); | 287 | splitterSize.append( width() / 2 ); |
288 | splitterSize.append( width() / 2 ); | 288 | splitterSize.append( width() / 2 ); |
289 | } | 289 | } |
290 | mExtensionBarSplitter->setSizes( splitterSize ); | 290 | mExtensionBarSplitter->setSizes( splitterSize ); |
291 | 291 | ||
292 | } | 292 | } |
293 | */ | 293 | */ |
294 | mViewManager->restoreSettings(); | 294 | mViewManager->restoreSettings(); |
295 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 295 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
296 | mExtensionManager->restoreSettings(); | 296 | mExtensionManager->restoreSettings(); |
297 | 297 | ||
298 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 298 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
299 | if ( splitterSize.count() == 0 ) { | 299 | if ( splitterSize.count() == 0 ) { |
300 | splitterSize.append( width() / 2 ); | 300 | splitterSize.append( width() / 2 ); |
301 | splitterSize.append( width() / 2 ); | 301 | splitterSize.append( width() / 2 ); |
302 | } | 302 | } |
303 | mMiniSplitter->setSizes( splitterSize ); | 303 | mMiniSplitter->setSizes( splitterSize ); |
304 | if ( mExtensionBarSplitter ) { | 304 | if ( mExtensionBarSplitter ) { |
305 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 305 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
306 | if ( splitterSize.count() == 0 ) { | 306 | if ( splitterSize.count() == 0 ) { |
307 | splitterSize.append( width() / 2 ); | 307 | splitterSize.append( width() / 2 ); |
308 | splitterSize.append( width() / 2 ); | 308 | splitterSize.append( width() / 2 ); |
309 | } | 309 | } |
310 | mExtensionBarSplitter->setSizes( splitterSize ); | 310 | mExtensionBarSplitter->setSizes( splitterSize ); |
311 | 311 | ||
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||
315 | } | 315 | } |
316 | 316 | ||
317 | void KABCore::saveSettings() | 317 | void KABCore::saveSettings() |
318 | { | 318 | { |
319 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 319 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
320 | if ( mExtensionBarSplitter ) | 320 | if ( mExtensionBarSplitter ) |
321 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 321 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
322 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 322 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
323 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 323 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
324 | #ifndef KAB_EMBEDDED | 324 | #ifndef KAB_EMBEDDED |
325 | 325 | ||
326 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 326 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
327 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 327 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
328 | #endif //KAB_EMBEDDED | 328 | #endif //KAB_EMBEDDED |
329 | mExtensionManager->saveSettings(); | 329 | mExtensionManager->saveSettings(); |
330 | mViewManager->saveSettings(); | 330 | mViewManager->saveSettings(); |
331 | 331 | ||
332 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 332 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
333 | } | 333 | } |
334 | 334 | ||
335 | KABC::AddressBook *KABCore::addressBook() const | 335 | KABC::AddressBook *KABCore::addressBook() const |
336 | { | 336 | { |
337 | return mAddressBook; | 337 | return mAddressBook; |
338 | } | 338 | } |
339 | 339 | ||
340 | KConfig *KABCore::config() | 340 | KConfig *KABCore::config() |
341 | { | 341 | { |
342 | #ifndef KAB_EMBEDDED | 342 | #ifndef KAB_EMBEDDED |
343 | return KABPrefs::instance()->config(); | 343 | return KABPrefs::instance()->config(); |
344 | #else //KAB_EMBEDDED | 344 | #else //KAB_EMBEDDED |
345 | return KABPrefs::instance()->getConfig(); | 345 | return KABPrefs::instance()->getConfig(); |
346 | #endif //KAB_EMBEDDED | 346 | #endif //KAB_EMBEDDED |
347 | } | 347 | } |
348 | 348 | ||
349 | KActionCollection *KABCore::actionCollection() const | 349 | KActionCollection *KABCore::actionCollection() const |
350 | { | 350 | { |
351 | return mGUIClient->actionCollection(); | 351 | return mGUIClient->actionCollection(); |
352 | } | 352 | } |
353 | 353 | ||
354 | KABC::Field *KABCore::currentSearchField() const | 354 | KABC::Field *KABCore::currentSearchField() const |
355 | { | 355 | { |
356 | if (mIncSearchWidget) | 356 | if (mIncSearchWidget) |
357 | return mIncSearchWidget->currentField(); | 357 | return mIncSearchWidget->currentField(); |
358 | else | 358 | else |
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | QStringList KABCore::selectedUIDs() const | 362 | QStringList KABCore::selectedUIDs() const |
363 | { | 363 | { |
364 | return mViewManager->selectedUids(); | 364 | return mViewManager->selectedUids(); |
365 | } | 365 | } |
366 | 366 | ||
367 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 367 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
368 | { | 368 | { |
369 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 369 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
370 | 370 | ||
371 | QPtrList<KRES::Resource> kresResources; | 371 | QPtrList<KRES::Resource> kresResources; |
372 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 372 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
373 | KABC::Resource *resource; | 373 | KABC::Resource *resource; |
374 | while ( ( resource = resIt.current() ) != 0 ) { | 374 | while ( ( resource = resIt.current() ) != 0 ) { |
375 | ++resIt; | 375 | ++resIt; |
376 | if ( !resource->readOnly() ) { | 376 | if ( !resource->readOnly() ) { |
377 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 377 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
378 | if ( res ) | 378 | if ( res ) |
379 | kresResources.append( res ); | 379 | kresResources.append( res ); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 383 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
384 | return static_cast<KABC::Resource*>( res ); | 384 | return static_cast<KABC::Resource*>( res ); |
385 | } | 385 | } |
386 | 386 | ||
387 | #ifndef KAB_EMBEDDED | 387 | #ifndef KAB_EMBEDDED |
388 | KAboutData *KABCore::createAboutData() | 388 | KAboutData *KABCore::createAboutData() |
389 | #else //KAB_EMBEDDED | 389 | #else //KAB_EMBEDDED |
390 | void KABCore::createAboutData() | 390 | void KABCore::createAboutData() |
391 | #endif //KAB_EMBEDDED | 391 | #endif //KAB_EMBEDDED |
392 | { | 392 | { |
393 | #ifndef KAB_EMBEDDED | 393 | #ifndef KAB_EMBEDDED |
394 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 394 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
395 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 395 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
396 | KAboutData::License_GPL_V2, | 396 | KAboutData::License_GPL_V2, |
397 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 397 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
398 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 398 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
399 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 399 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
400 | about->addAuthor( "Cornelius Schumacher", | 400 | about->addAuthor( "Cornelius Schumacher", |
401 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 401 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
402 | "schumacher@kde.org" ); | 402 | "schumacher@kde.org" ); |
403 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 403 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
404 | "mpilone@slac.com" ); | 404 | "mpilone@slac.com" ); |
405 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 405 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
406 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 406 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
407 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 407 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
408 | "michel@klaralvdalens-datakonsult.se" ); | 408 | "michel@klaralvdalens-datakonsult.se" ); |
409 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 409 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
410 | "hansen@kde.org" ); | 410 | "hansen@kde.org" ); |
411 | 411 | ||
412 | return about; | 412 | return about; |
413 | #endif //KAB_EMBEDDED | 413 | #endif //KAB_EMBEDDED |
414 | 414 | ||
415 | QString version; | 415 | QString version; |
416 | #include <../version> | 416 | #include <../version> |
417 | QMessageBox::about( this, "About KAddressbook/Pi", | 417 | QMessageBox::about( this, "About KAddressbook/Pi", |
418 | "KAddressbook/Platform-independent\n" | 418 | "KAddressbook/Platform-independent\n" |
419 | "(KA/Pi) " +version + " - " + | 419 | "(KA/Pi) " +version + " - " + |
420 | #ifdef DESKTOP_VERSION | 420 | #ifdef DESKTOP_VERSION |
421 | "Desktop Edition\n" | 421 | "Desktop Edition\n" |
422 | #else | 422 | #else |
423 | "PDA-Edition\n" | 423 | "PDA-Edition\n" |
424 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 424 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
425 | #endif | 425 | #endif |
426 | 426 | ||
427 | "(c) 2004 Ulf Schenk\n" | 427 | "(c) 2004 Ulf Schenk\n" |
428 | "(c) 2004 Lutz Rogowski\n" | 428 | "(c) 2004 Lutz Rogowski\n" |
429 | "(c) 1997-2003, The KDE PIM Team\n" | 429 | "(c) 1997-2003, The KDE PIM Team\n" |
430 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 430 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
431 | "Don Sanders Original author\n" | 431 | "Don Sanders Original author\n" |
432 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 432 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
433 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 433 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
434 | "Greg Stern DCOP interface\n" | 434 | "Greg Stern DCOP interface\n" |
435 | "Mark Westcot Contact pinning\n" | 435 | "Mark Westcot Contact pinning\n" |
436 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" | 436 | "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" |
437 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" | 437 | "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" |
438 | #ifdef _WIN32_ | 438 | #ifdef _WIN32_ |
439 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 439 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
440 | #endif | 440 | #endif |
441 | ); | 441 | ); |
442 | } | 442 | } |
443 | 443 | ||
444 | void KABCore::setContactSelected( const QString &uid ) | 444 | void KABCore::setContactSelected( const QString &uid ) |
445 | { | 445 | { |
446 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 446 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
447 | if ( !mDetails->isHidden() ) | 447 | if ( !mDetails->isHidden() ) |
448 | mDetails->setAddressee( addr ); | 448 | mDetails->setAddressee( addr ); |
449 | 449 | ||
450 | if ( !addr.isEmpty() ) { | 450 | if ( !addr.isEmpty() ) { |
451 | emit contactSelected( addr.formattedName() ); | 451 | emit contactSelected( addr.formattedName() ); |
452 | KABC::Picture pic = addr.photo(); | 452 | KABC::Picture pic = addr.photo(); |
453 | if ( pic.isIntern() ) { | 453 | if ( pic.isIntern() ) { |
454 | //US emit contactSelected( pic.data() ); | 454 | //US emit contactSelected( pic.data() ); |
455 | //US instead use: | 455 | //US instead use: |
456 | QPixmap px; | 456 | QPixmap px; |
457 | if (pic.data().isNull() != true) | 457 | if (pic.data().isNull() != true) |
458 | { | 458 | { |
459 | px.convertFromImage(pic.data()); | 459 | px.convertFromImage(pic.data()); |
460 | } | 460 | } |
461 | 461 | ||
462 | emit contactSelected( px ); | 462 | emit contactSelected( px ); |
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | mExtensionManager->setSelectionChanged(); | 467 | mExtensionManager->setSelectionChanged(); |
468 | 468 | ||
469 | // update the actions | 469 | // update the actions |
470 | bool selected = !uid.isEmpty(); | 470 | bool selected = !uid.isEmpty(); |
471 | 471 | ||
472 | if ( mReadWrite ) { | 472 | if ( mReadWrite ) { |
473 | mActionCut->setEnabled( selected ); | 473 | mActionCut->setEnabled( selected ); |
474 | mActionPaste->setEnabled( selected ); | 474 | mActionPaste->setEnabled( selected ); |
475 | } | 475 | } |
476 | 476 | ||
477 | mActionCopy->setEnabled( selected ); | 477 | mActionCopy->setEnabled( selected ); |
478 | mActionDelete->setEnabled( selected ); | 478 | mActionDelete->setEnabled( selected ); |
479 | mActionEditAddressee->setEnabled( selected ); | 479 | mActionEditAddressee->setEnabled( selected ); |
480 | mActionMail->setEnabled( selected ); | 480 | mActionMail->setEnabled( selected ); |
481 | mActionMailVCard->setEnabled( selected ); | 481 | mActionMailVCard->setEnabled( selected ); |
482 | //if (mActionBeam) | 482 | //if (mActionBeam) |
483 | //mActionBeam->setEnabled( selected ); | 483 | //mActionBeam->setEnabled( selected ); |
484 | 484 | ||
485 | if (mActionBeamVCard) | 485 | if (mActionBeamVCard) |
486 | mActionBeamVCard->setEnabled( selected ); | 486 | mActionBeamVCard->setEnabled( selected ); |
487 | 487 | ||
488 | mActionWhoAmI->setEnabled( selected ); | 488 | mActionWhoAmI->setEnabled( selected ); |
489 | mActionCategories->setEnabled( selected ); | 489 | mActionCategories->setEnabled( selected ); |
490 | } | 490 | } |
491 | 491 | ||
492 | void KABCore::sendMail() | 492 | void KABCore::sendMail() |
493 | { | 493 | { |
494 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 494 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void KABCore::sendMail( const QString& emaillist ) | 497 | void KABCore::sendMail( const QString& emaillist ) |
498 | { | 498 | { |
499 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 499 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
500 | if (emaillist.contains(",") > 0) | 500 | if (emaillist.contains(",") > 0) |
501 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 501 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
502 | else | 502 | else |
503 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 503 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
504 | } | 504 | } |
505 | 505 | ||
506 | 506 | ||
507 | 507 | ||
508 | void KABCore::mailVCard() | 508 | void KABCore::mailVCard() |
509 | { | 509 | { |
510 | QStringList uids = mViewManager->selectedUids(); | 510 | QStringList uids = mViewManager->selectedUids(); |
511 | if ( !uids.isEmpty() ) | 511 | if ( !uids.isEmpty() ) |
512 | mailVCard( uids ); | 512 | mailVCard( uids ); |
513 | } | 513 | } |
514 | 514 | ||
515 | void KABCore::mailVCard( const QStringList& uids ) | 515 | void KABCore::mailVCard( const QStringList& uids ) |
516 | { | 516 | { |
517 | QStringList urls; | 517 | QStringList urls; |
518 | 518 | ||
519 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 519 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
520 | 520 | ||
521 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 521 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
522 | 522 | ||
523 | 523 | ||
524 | 524 | ||
525 | QDir().mkdir( dirName, true ); | 525 | QDir().mkdir( dirName, true ); |
526 | 526 | ||
527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 527 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
528 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 528 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
529 | 529 | ||
530 | if ( a.isEmpty() ) | 530 | if ( a.isEmpty() ) |
531 | continue; | 531 | continue; |
532 | 532 | ||
533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 533 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
534 | 534 | ||
535 | QString fileName = dirName + "/" + name; | 535 | QString fileName = dirName + "/" + name; |
536 | 536 | ||
537 | QFile outFile(fileName); | 537 | QFile outFile(fileName); |
538 | 538 | ||
539 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 539 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
540 | KABC::VCardConverter converter; | 540 | KABC::VCardConverter converter; |
541 | QString vcard; | 541 | QString vcard; |
542 | 542 | ||
543 | converter.addresseeToVCard( a, vcard ); | 543 | converter.addresseeToVCard( a, vcard ); |
544 | 544 | ||
545 | QTextStream t( &outFile ); // use a text stream | 545 | QTextStream t( &outFile ); // use a text stream |
546 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 546 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
547 | t << vcard; | 547 | t << vcard; |
548 | 548 | ||
549 | outFile.close(); | 549 | outFile.close(); |
550 | 550 | ||
551 | urls.append( fileName ); | 551 | urls.append( fileName ); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 555 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
556 | 556 | ||
557 | 557 | ||
558 | /*US | 558 | /*US |
559 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 559 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
560 | QString::null, // subject | 560 | QString::null, // subject |
561 | QString::null, // body | 561 | QString::null, // body |
562 | QString::null, | 562 | QString::null, |
563 | urls ); // attachments | 563 | urls ); // attachments |
564 | */ | 564 | */ |
565 | 565 | ||
566 | } | 566 | } |
567 | 567 | ||
568 | /** | 568 | /** |
569 | Beams the "WhoAmI contact. | 569 | Beams the "WhoAmI contact. |
570 | */ | 570 | */ |
571 | void KABCore::beamMySelf() | 571 | void KABCore::beamMySelf() |
572 | { | 572 | { |
573 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 573 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
574 | if (!a.isEmpty()) | 574 | if (!a.isEmpty()) |
575 | { | 575 | { |
576 | QStringList uids; | 576 | QStringList uids; |
577 | uids << a.uid(); | 577 | uids << a.uid(); |
578 | 578 | ||
579 | beamVCard(uids); | 579 | beamVCard(uids); |
580 | } else { | 580 | } else { |
581 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 581 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
582 | 582 | ||
583 | 583 | ||
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
587 | void KABCore::beamVCard() | 587 | void KABCore::beamVCard() |
588 | { | 588 | { |
589 | QStringList uids = mViewManager->selectedUids(); | 589 | QStringList uids = mViewManager->selectedUids(); |
590 | if ( !uids.isEmpty() ) | 590 | if ( !uids.isEmpty() ) |
591 | beamVCard( uids ); | 591 | beamVCard( uids ); |
592 | } | 592 | } |
593 | 593 | ||
594 | 594 | ||
595 | void KABCore::beamVCard(const QStringList& uids) | 595 | void KABCore::beamVCard(const QStringList& uids) |
596 | { | 596 | { |
597 | /*US | 597 | /*US |
598 | QString beamFilename; | 598 | QString beamFilename; |
599 | Opie::OPimContact c; | 599 | Opie::OPimContact c; |
600 | if ( actionPersonal->isOn() ) { | 600 | if ( actionPersonal->isOn() ) { |
601 | beamFilename = addressbookPersonalVCardName(); | 601 | beamFilename = addressbookPersonalVCardName(); |
602 | if ( !QFile::exists( beamFilename ) ) | 602 | if ( !QFile::exists( beamFilename ) ) |
603 | return; // can't beam a non-existent file | 603 | return; // can't beam a non-existent file |
604 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 604 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
605 | beamFilename ); | 605 | beamFilename ); |
606 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 606 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
607 | Opie::OPimContactAccess::List allList = access->allRecords(); | 607 | Opie::OPimContactAccess::List allList = access->allRecords(); |
608 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 608 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
609 | c = *it; | 609 | c = *it; |
610 | 610 | ||
611 | delete access; | 611 | delete access; |
612 | } else { | 612 | } else { |
613 | unlink( beamfile ); // delete if exists | 613 | unlink( beamfile ); // delete if exists |
614 | mkdir("/tmp/obex/", 0755); | 614 | mkdir("/tmp/obex/", 0755); |
615 | c = m_abView -> currentEntry(); | 615 | c = m_abView -> currentEntry(); |
616 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 616 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
617 | beamfile ); | 617 | beamfile ); |
618 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 618 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
619 | access->add( c ); | 619 | access->add( c ); |
620 | access->save(); | 620 | access->save(); |
621 | delete access; | 621 | delete access; |
622 | 622 | ||
623 | beamFilename = beamfile; | 623 | beamFilename = beamfile; |
624 | } | 624 | } |
625 | 625 | ||
626 | owarn << "Beaming: " << beamFilename << oendl; | 626 | owarn << "Beaming: " << beamFilename << oendl; |
627 | */ | 627 | */ |
628 | 628 | ||
629 | #if 0 | 629 | #if 0 |
630 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 630 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
631 | 631 | ||
632 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 632 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
633 | 633 | ||
634 | QString name = "contact.vcf"; | 634 | QString name = "contact.vcf"; |
635 | 635 | ||
636 | QString fileName = dirName + "/" + name; | 636 | QString fileName = dirName + "/" + name; |
637 | #endif | 637 | #endif |
638 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 638 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
639 | // | 639 | // |
640 | QString fileName = "/tmp/kdepimbeamfile"; | 640 | QString fileName = "/tmp/kdepimbeamfile"; |
641 | 641 | ||
642 | 642 | ||
643 | //QDir().mkdir( dirName, true ); | 643 | //QDir().mkdir( dirName, true ); |
644 | 644 | ||
645 | QFile outFile(fileName); | 645 | QFile outFile(fileName); |
646 | KABC::VCardConverter converter; | 646 | KABC::VCardConverter converter; |
647 | QString description; | 647 | QString description; |
648 | 648 | ||
649 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 649 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
650 | 650 | ||
651 | QTextStream t( &outFile ); // use a text stream | 651 | QTextStream t( &outFile ); // use a text stream |
652 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 652 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
653 | 653 | ||
654 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 654 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
655 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 655 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
656 | 656 | ||
657 | if ( a.isEmpty() ) | 657 | if ( a.isEmpty() ) |
658 | continue; | 658 | continue; |
659 | 659 | ||
660 | if (description.isEmpty()) | 660 | if (description.isEmpty()) |
661 | description = a.formattedName(); | 661 | description = a.formattedName(); |
662 | 662 | ||
663 | QString vcard; | 663 | QString vcard; |
664 | converter.addresseeToVCard( a, vcard ); | 664 | converter.addresseeToVCard( a, vcard ); |
665 | t << vcard; | 665 | t << vcard; |
666 | 666 | ||
667 | } | 667 | } |
668 | } else { | 668 | } else { |
669 | qDebug("Error open temp beam file "); | 669 | qDebug("Error open temp beam file "); |
670 | return; | 670 | return; |
671 | } | 671 | } |
672 | 672 | ||
673 | outFile.close(); | 673 | outFile.close(); |
674 | 674 | ||
675 | #ifndef DESKTOP_VERSION | 675 | #ifndef DESKTOP_VERSION |
676 | Ir *ir = new Ir( this ); | 676 | Ir *ir = new Ir( this ); |
677 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 677 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
678 | ir->send( fileName, description, "text/x-vCard" ); | 678 | ir->send( fileName, description, "text/x-vCard" ); |
679 | #endif | 679 | #endif |
680 | 680 | ||
681 | } | 681 | } |
682 | 682 | ||
683 | void KABCore::beamDone( Ir *ir ) | 683 | void KABCore::beamDone( Ir *ir ) |
684 | { | 684 | { |
685 | #ifndef DESKTOP_VERSION | 685 | #ifndef DESKTOP_VERSION |
686 | delete ir; | 686 | delete ir; |
687 | #endif | 687 | #endif |
688 | } | 688 | } |
689 | 689 | ||
690 | 690 | ||
691 | void KABCore::browse( const QString& url ) | 691 | void KABCore::browse( const QString& url ) |
692 | { | 692 | { |
693 | #ifndef KAB_EMBEDDED | 693 | #ifndef KAB_EMBEDDED |
694 | kapp->invokeBrowser( url ); | 694 | kapp->invokeBrowser( url ); |
695 | #else //KAB_EMBEDDED | 695 | #else //KAB_EMBEDDED |
696 | qDebug("KABCore::browse must be fixed"); | 696 | qDebug("KABCore::browse must be fixed"); |
697 | #endif //KAB_EMBEDDED | 697 | #endif //KAB_EMBEDDED |
698 | } | 698 | } |
699 | 699 | ||
700 | void KABCore::selectAllContacts() | 700 | void KABCore::selectAllContacts() |
701 | { | 701 | { |
702 | mViewManager->setSelected( QString::null, true ); | 702 | mViewManager->setSelected( QString::null, true ); |
703 | } | 703 | } |
704 | 704 | ||
705 | void KABCore::deleteContacts() | 705 | void KABCore::deleteContacts() |
706 | { | 706 | { |
707 | QStringList uidList = mViewManager->selectedUids(); | 707 | QStringList uidList = mViewManager->selectedUids(); |
708 | deleteContacts( uidList ); | 708 | deleteContacts( uidList ); |
709 | } | 709 | } |
710 | 710 | ||
711 | void KABCore::deleteContacts( const QStringList &uids ) | 711 | void KABCore::deleteContacts( const QStringList &uids ) |
712 | { | 712 | { |
713 | if ( uids.count() > 0 ) { | 713 | if ( uids.count() > 0 ) { |
714 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 714 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
715 | UndoStack::instance()->push( command ); | 715 | UndoStack::instance()->push( command ); |
716 | RedoStack::instance()->clear(); | 716 | RedoStack::instance()->clear(); |
717 | 717 | ||
718 | // now if we deleted anything, refresh | 718 | // now if we deleted anything, refresh |
719 | setContactSelected( QString::null ); | 719 | setContactSelected( QString::null ); |
720 | setModified( true ); | 720 | setModified( true ); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
724 | void KABCore::copyContacts() | 724 | void KABCore::copyContacts() |
725 | { | 725 | { |
726 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 726 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
727 | 727 | ||
728 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 728 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
729 | 729 | ||
730 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 730 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
731 | 731 | ||
732 | QClipboard *cb = QApplication::clipboard(); | 732 | QClipboard *cb = QApplication::clipboard(); |
733 | cb->setText( clipText ); | 733 | cb->setText( clipText ); |
734 | } | 734 | } |
735 | 735 | ||
736 | void KABCore::cutContacts() | 736 | void KABCore::cutContacts() |
737 | { | 737 | { |
738 | QStringList uidList = mViewManager->selectedUids(); | 738 | QStringList uidList = mViewManager->selectedUids(); |
739 | 739 | ||
740 | //US if ( uidList.size() > 0 ) { | 740 | //US if ( uidList.size() > 0 ) { |
741 | if ( uidList.count() > 0 ) { | 741 | if ( uidList.count() > 0 ) { |
742 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 742 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
743 | UndoStack::instance()->push( command ); | 743 | UndoStack::instance()->push( command ); |
744 | RedoStack::instance()->clear(); | 744 | RedoStack::instance()->clear(); |
745 | 745 | ||
746 | setModified( true ); | 746 | setModified( true ); |
747 | } | 747 | } |
748 | } | 748 | } |
749 | 749 | ||
750 | void KABCore::pasteContacts() | 750 | void KABCore::pasteContacts() |
751 | { | 751 | { |
752 | QClipboard *cb = QApplication::clipboard(); | 752 | QClipboard *cb = QApplication::clipboard(); |
753 | 753 | ||
754 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 754 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
755 | 755 | ||
756 | pasteContacts( list ); | 756 | pasteContacts( list ); |
757 | } | 757 | } |
758 | 758 | ||
759 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 759 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
760 | { | 760 | { |
761 | KABC::Resource *resource = requestResource( this ); | 761 | KABC::Resource *resource = requestResource( this ); |
762 | KABC::Addressee::List::Iterator it; | 762 | KABC::Addressee::List::Iterator it; |
763 | for ( it = list.begin(); it != list.end(); ++it ) | 763 | for ( it = list.begin(); it != list.end(); ++it ) |
764 | (*it).setResource( resource ); | 764 | (*it).setResource( resource ); |
765 | 765 | ||
766 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 766 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
767 | UndoStack::instance()->push( command ); | 767 | UndoStack::instance()->push( command ); |
768 | RedoStack::instance()->clear(); | 768 | RedoStack::instance()->clear(); |
769 | 769 | ||
770 | setModified( true ); | 770 | setModified( true ); |
771 | } | 771 | } |
772 | 772 | ||
773 | void KABCore::setWhoAmI() | 773 | void KABCore::setWhoAmI() |
774 | { | 774 | { |
775 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 775 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
776 | 776 | ||
777 | if ( addrList.count() > 1 ) { | 777 | if ( addrList.count() > 1 ) { |
778 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 778 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
779 | return; | 779 | return; |
780 | } | 780 | } |
781 | 781 | ||
782 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 782 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
783 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 783 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
784 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 784 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
785 | } | 785 | } |
786 | 786 | ||
787 | void KABCore::setCategories() | 787 | void KABCore::setCategories() |
788 | { | 788 | { |
789 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 789 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
790 | if ( !dlg.exec() ) | 790 | if ( !dlg.exec() ) |
791 | return; | 791 | return; |
792 | 792 | ||
793 | bool merge = false; | 793 | bool merge = false; |
794 | QString msg = i18n( "Merge with existing categories?" ); | 794 | QString msg = i18n( "Merge with existing categories?" ); |
795 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 795 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
796 | merge = true; | 796 | merge = true; |
797 | 797 | ||
798 | QStringList categories = dlg.selectedCategories(); | 798 | QStringList categories = dlg.selectedCategories(); |
799 | 799 | ||
800 | QStringList uids = mViewManager->selectedUids(); | 800 | QStringList uids = mViewManager->selectedUids(); |
801 | QStringList::Iterator it; | 801 | QStringList::Iterator it; |
802 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 802 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
803 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 803 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
804 | if ( !addr.isEmpty() ) { | 804 | if ( !addr.isEmpty() ) { |
805 | if ( !merge ) | 805 | if ( !merge ) |
806 | addr.setCategories( categories ); | 806 | addr.setCategories( categories ); |
807 | else { | 807 | else { |
808 | QStringList addrCategories = addr.categories(); | 808 | QStringList addrCategories = addr.categories(); |
809 | QStringList::Iterator catIt; | 809 | QStringList::Iterator catIt; |
810 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 810 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
811 | if ( !addrCategories.contains( *catIt ) ) | 811 | if ( !addrCategories.contains( *catIt ) ) |
812 | addrCategories.append( *catIt ); | 812 | addrCategories.append( *catIt ); |
813 | } | 813 | } |
814 | addr.setCategories( addrCategories ); | 814 | addr.setCategories( addrCategories ); |
815 | } | 815 | } |
816 | 816 | ||
817 | mAddressBook->insertAddressee( addr ); | 817 | mAddressBook->insertAddressee( addr ); |
818 | } | 818 | } |
819 | } | 819 | } |
820 | 820 | ||
821 | if ( uids.count() > 0 ) | 821 | if ( uids.count() > 0 ) |
822 | setModified( true ); | 822 | setModified( true ); |
823 | } | 823 | } |
824 | 824 | ||
825 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 825 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
826 | { | 826 | { |
827 | mIncSearchWidget->setFields( fields ); | 827 | mIncSearchWidget->setFields( fields ); |
828 | } | 828 | } |
829 | 829 | ||
830 | void KABCore::incrementalSearch( const QString& text ) | 830 | void KABCore::incrementalSearch( const QString& text ) |
831 | { | 831 | { |
832 | mViewManager->setSelected( QString::null, false ); | 832 | mViewManager->setSelected( QString::null, false ); |
833 | 833 | ||
834 | if ( !text.isEmpty() ) { | 834 | if ( !text.isEmpty() ) { |
835 | KABC::Field *field = mIncSearchWidget->currentField(); | 835 | KABC::Field *field = mIncSearchWidget->currentField(); |
836 | QString pattern = text.lower()+"*"; | 836 | QString pattern = text.lower()+"*"; |
837 | QRegExp re; | 837 | QRegExp re; |
838 | re.setWildcard(true); // most people understand these better. | 838 | re.setWildcard(true); // most people understand these better. |
839 | re.setCaseSensitive(false); | 839 | re.setCaseSensitive(false); |
840 | re.setPattern( pattern ); | 840 | re.setPattern( pattern ); |
841 | QStringList foundUids; | 841 | QStringList foundUids; |
842 | if (!re.isValid()) | 842 | if (!re.isValid()) |
843 | return; | 843 | return; |
844 | #if 1 //KDE_VERSION >= 319 | 844 | #if 1 //KDE_VERSION >= 319 |
845 | KABC::AddresseeList list( mAddressBook->allAddressees() ); | 845 | KABC::AddresseeList list( mAddressBook->allAddressees() ); |
846 | if ( field ) { | 846 | if ( field ) { |
847 | list.sortByField( field ); | 847 | list.sortByField( field ); |
848 | KABC::AddresseeList::Iterator it; | 848 | KABC::AddresseeList::Iterator it; |
849 | for ( it = list.begin(); it != list.end(); ++it ) { | 849 | for ( it = list.begin(); it != list.end(); ++it ) { |
850 | 850 | ||
851 | #if QT_VERSION >= 300 | 851 | #if QT_VERSION >= 300 |
852 | if (re.search(field->value( *it ).lower()) != -1) | 852 | if (re.search(field->value( *it ).lower()) != -1) |
853 | #else | 853 | #else |
854 | if (re.match(field->value( *it ).lower()) != -1) | 854 | if (re.match(field->value( *it ).lower()) != -1) |
855 | #endif | 855 | #endif |
856 | { | 856 | { |
857 | // if ( field->value( *it ).lower().startsWith( pattern ) ) { | 857 | // if ( field->value( *it ).lower().startsWith( pattern ) ) { |
858 | //mViewManager->setSelected( (*it).uid(), true ); | 858 | //mViewManager->setSelected( (*it).uid(), true ); |
859 | foundUids.append( (*it).uid() ); | 859 | foundUids.append( (*it).uid() ); |
860 | //return; | 860 | //return; |
861 | } | 861 | } |
862 | } | 862 | } |
863 | } else { | 863 | } else { |
864 | KABC::AddresseeList::Iterator it; | 864 | KABC::AddresseeList::Iterator it; |
865 | for ( it = list.begin(); it != list.end(); ++it ) { | 865 | for ( it = list.begin(); it != list.end(); ++it ) { |
866 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 866 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
867 | KABC::Field::List::ConstIterator fieldIt; | 867 | KABC::Field::List::ConstIterator fieldIt; |
868 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 868 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
869 | #if QT_VERSION >= 300 | 869 | #if QT_VERSION >= 300 |
870 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 870 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
871 | #else | 871 | #else |
872 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 872 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
873 | #endif | 873 | #endif |
874 | { | 874 | { |
875 | // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 875 | // if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
876 | //mViewManager->setSelected( (*it).uid(), true ); | 876 | //mViewManager->setSelected( (*it).uid(), true ); |
877 | foundUids.append( (*it).uid() ); | 877 | foundUids.append( (*it).uid() ); |
878 | //return; | 878 | //return; |
879 | } | 879 | } |
880 | } | 880 | } |
881 | } | 881 | } |
882 | } | 882 | } |
883 | if ( foundUids.count() > 0 ) | 883 | if ( foundUids.count() > 0 ) |
884 | mViewManager->setListSelected( foundUids ); | 884 | mViewManager->setListSelected( foundUids ); |
885 | #else | 885 | #else |
886 | KABC::AddressBook::Iterator it; | 886 | KABC::AddressBook::Iterator it; |
887 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 887 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
888 | if ( field ) { | 888 | if ( field ) { |
889 | if ( field->value( *it ).lower().startsWith( pattern ) ) { | 889 | if ( field->value( *it ).lower().startsWith( pattern ) ) { |
890 | mViewManager->setSelected( (*it).uid(), true ); | 890 | mViewManager->setSelected( (*it).uid(), true ); |
891 | return; | 891 | return; |
892 | } | 892 | } |
893 | } else { | 893 | } else { |
894 | KABC::Field::List fieldList = mIncSearchWidget->fields(); | 894 | KABC::Field::List fieldList = mIncSearchWidget->fields(); |
895 | KABC::Field::List::ConstIterator fieldIt; | 895 | KABC::Field::List::ConstIterator fieldIt; |
896 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 896 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
897 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { | 897 | if ( (*fieldIt)->value( *it ).lower().startsWith( pattern ) ) { |
898 | mViewManager->setSelected( (*it).uid(), true ); | 898 | mViewManager->setSelected( (*it).uid(), true ); |
899 | return; | 899 | return; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | } | 902 | } |
903 | } | 903 | } |
904 | #endif | 904 | #endif |
905 | } | 905 | } |
906 | } | 906 | } |
907 | 907 | ||
908 | void KABCore::setModified() | 908 | void KABCore::setModified() |
909 | { | 909 | { |
910 | setModified( true ); | 910 | setModified( true ); |
911 | } | 911 | } |
912 | 912 | ||
913 | void KABCore::setModifiedWOrefresh() | 913 | void KABCore::setModifiedWOrefresh() |
914 | { | 914 | { |
915 | // qDebug("KABCore::setModifiedWOrefresh() "); | 915 | // qDebug("KABCore::setModifiedWOrefresh() "); |
916 | mModified = true; | 916 | mModified = true; |
917 | mActionSave->setEnabled( mModified ); | 917 | mActionSave->setEnabled( mModified ); |
918 | #ifdef DESKTOP_VERSION | 918 | #ifdef DESKTOP_VERSION |
919 | mDetails->refreshView(); | 919 | mDetails->refreshView(); |
920 | #endif | 920 | #endif |
921 | 921 | ||
922 | } | 922 | } |
923 | void KABCore::setModified( bool modified ) | 923 | void KABCore::setModified( bool modified ) |
924 | { | 924 | { |
925 | mModified = modified; | 925 | mModified = modified; |
926 | mActionSave->setEnabled( mModified ); | 926 | mActionSave->setEnabled( mModified ); |
927 | 927 | ||
928 | if ( modified ) | 928 | if ( modified ) |
929 | mJumpButtonBar->recreateButtons(); | 929 | mJumpButtonBar->recreateButtons(); |
930 | 930 | ||
931 | mViewManager->refreshView(); | 931 | mViewManager->refreshView(); |
932 | mDetails->refreshView(); | 932 | mDetails->refreshView(); |
933 | 933 | ||
934 | } | 934 | } |
935 | 935 | ||
936 | bool KABCore::modified() const | 936 | bool KABCore::modified() const |
937 | { | 937 | { |
938 | return mModified; | 938 | return mModified; |
939 | } | 939 | } |
940 | 940 | ||
941 | void KABCore::contactModified( const KABC::Addressee &addr ) | 941 | void KABCore::contactModified( const KABC::Addressee &addr ) |
942 | { | 942 | { |
943 | 943 | ||
944 | Command *command = 0; | 944 | Command *command = 0; |
945 | QString uid; | 945 | QString uid; |
946 | 946 | ||
947 | // check if it exists already | 947 | // check if it exists already |
948 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 948 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
949 | if ( origAddr.isEmpty() ) | 949 | if ( origAddr.isEmpty() ) |
950 | command = new PwNewCommand( mAddressBook, addr ); | 950 | command = new PwNewCommand( mAddressBook, addr ); |
951 | else { | 951 | else { |
952 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 952 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
953 | uid = addr.uid(); | 953 | uid = addr.uid(); |
954 | } | 954 | } |
955 | 955 | ||
956 | UndoStack::instance()->push( command ); | 956 | UndoStack::instance()->push( command ); |
957 | RedoStack::instance()->clear(); | 957 | RedoStack::instance()->clear(); |
958 | 958 | ||
959 | setModified( true ); | 959 | setModified( true ); |
960 | } | 960 | } |
961 | 961 | ||
962 | void KABCore::newContact() | 962 | void KABCore::newContact() |
963 | { | 963 | { |
964 | 964 | ||
965 | 965 | ||
966 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 966 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
967 | 967 | ||
968 | QPtrList<KRES::Resource> kresResources; | 968 | QPtrList<KRES::Resource> kresResources; |
969 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 969 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
970 | KABC::Resource *resource; | 970 | KABC::Resource *resource; |
971 | while ( ( resource = it.current() ) != 0 ) { | 971 | while ( ( resource = it.current() ) != 0 ) { |
972 | ++it; | 972 | ++it; |
973 | if ( !resource->readOnly() ) { | 973 | if ( !resource->readOnly() ) { |
974 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 974 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
975 | if ( res ) | 975 | if ( res ) |
976 | kresResources.append( res ); | 976 | kresResources.append( res ); |
977 | } | 977 | } |
978 | } | 978 | } |
979 | 979 | ||
980 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 980 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
981 | resource = static_cast<KABC::Resource*>( res ); | 981 | resource = static_cast<KABC::Resource*>( res ); |
982 | 982 | ||
983 | if ( resource ) { | 983 | if ( resource ) { |
984 | KABC::Addressee addr; | 984 | KABC::Addressee addr; |
985 | addr.setResource( resource ); | 985 | addr.setResource( resource ); |
986 | mEditorDialog->setAddressee( addr ); | 986 | mEditorDialog->setAddressee( addr ); |
987 | KApplication::execDialog ( mEditorDialog ); | 987 | KApplication::execDialog ( mEditorDialog ); |
988 | 988 | ||
989 | } else | 989 | } else |
990 | return; | 990 | return; |
991 | 991 | ||
992 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 992 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
993 | 993 | ||
994 | 994 | ||
995 | } | 995 | } |
996 | 996 | ||
997 | void KABCore::addEmail( QString aStr ) | 997 | void KABCore::addEmail( QString aStr ) |
998 | { | 998 | { |
999 | #ifndef KAB_EMBEDDED | 999 | #ifndef KAB_EMBEDDED |
1000 | QString fullName, email; | 1000 | QString fullName, email; |
1001 | 1001 | ||
1002 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1002 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1003 | 1003 | ||
1004 | // Try to lookup the addressee matching the email address | 1004 | // Try to lookup the addressee matching the email address |
1005 | bool found = false; | 1005 | bool found = false; |
1006 | QStringList emailList; | 1006 | QStringList emailList; |
1007 | KABC::AddressBook::Iterator it; | 1007 | KABC::AddressBook::Iterator it; |
1008 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1008 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1009 | emailList = (*it).emails(); | 1009 | emailList = (*it).emails(); |
1010 | if ( emailList.contains( email ) > 0 ) { | 1010 | if ( emailList.contains( email ) > 0 ) { |
1011 | found = true; | 1011 | found = true; |
1012 | (*it).setNameFromString( fullName ); | 1012 | (*it).setNameFromString( fullName ); |
1013 | editContact( (*it).uid() ); | 1013 | editContact( (*it).uid() ); |
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | if ( !found ) { | 1017 | if ( !found ) { |
1018 | KABC::Addressee addr; | 1018 | KABC::Addressee addr; |
1019 | addr.setNameFromString( fullName ); | 1019 | addr.setNameFromString( fullName ); |
1020 | addr.insertEmail( email, true ); | 1020 | addr.insertEmail( email, true ); |
1021 | 1021 | ||
1022 | mAddressBook->insertAddressee( addr ); | 1022 | mAddressBook->insertAddressee( addr ); |
1023 | mViewManager->refreshView( addr.uid() ); | 1023 | mViewManager->refreshView( addr.uid() ); |
1024 | editContact( addr.uid() ); | 1024 | editContact( addr.uid() ); |
1025 | } | 1025 | } |
1026 | #else //KAB_EMBEDDED | 1026 | #else //KAB_EMBEDDED |
1027 | qDebug("KABCore::addEmail finsih method"); | 1027 | qDebug("KABCore::addEmail finsih method"); |
1028 | #endif //KAB_EMBEDDED | 1028 | #endif //KAB_EMBEDDED |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1031 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1032 | { | 1032 | { |
1033 | mXXPortManager->importVCard( url, showPreview ); | 1033 | mXXPortManager->importVCard( url, showPreview ); |
1034 | } | 1034 | } |
1035 | void KABCore::importFromOL() | 1035 | void KABCore::importFromOL() |
1036 | { | 1036 | { |
1037 | #ifdef _WIN32_ | 1037 | #ifdef _WIN32_ |
1038 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1038 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1039 | idgl->exec(); | 1039 | idgl->exec(); |
1040 | KABC::Addressee::List list = idgl->getAddressList(); | 1040 | KABC::Addressee::List list = idgl->getAddressList(); |
1041 | if ( list.count() > 0 ) { | 1041 | if ( list.count() > 0 ) { |
1042 | KABC::Addressee::List listNew; | 1042 | KABC::Addressee::List listNew; |
1043 | KABC::Addressee::List listExisting; | 1043 | KABC::Addressee::List listExisting; |
1044 | KABC::Addressee::List::Iterator it; | 1044 | KABC::Addressee::List::Iterator it; |
1045 | KABC::AddressBook::Iterator iter; | 1045 | KABC::AddressBook::Iterator iter; |
1046 | for ( it = list.begin(); it != list.end(); ++it ) { | 1046 | for ( it = list.begin(); it != list.end(); ++it ) { |
1047 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1047 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1048 | listNew.append( (*it) ); | 1048 | listNew.append( (*it) ); |
1049 | else | 1049 | else |
1050 | listExisting.append( (*it) ); | 1050 | listExisting.append( (*it) ); |
1051 | } | 1051 | } |
1052 | if ( listExisting.count() > 0 ) | 1052 | if ( listExisting.count() > 0 ) |
1053 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1053 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1054 | if ( listNew.count() > 0 ) { | 1054 | if ( listNew.count() > 0 ) { |
1055 | pasteWithNewUid = false; | 1055 | pasteWithNewUid = false; |
1056 | pasteContacts( listNew ); | 1056 | pasteContacts( listNew ); |
1057 | pasteWithNewUid = true; | 1057 | pasteWithNewUid = true; |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | delete idgl; | 1060 | delete idgl; |
1061 | #endif | 1061 | #endif |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1064 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1065 | { | 1065 | { |
1066 | mXXPortManager->importVCard( vCard, showPreview ); | 1066 | mXXPortManager->importVCard( vCard, showPreview ); |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | //US added a second method without defaultparameter | 1069 | //US added a second method without defaultparameter |
1070 | void KABCore::editContact2() { | 1070 | void KABCore::editContact2() { |
1071 | editContact( QString::null ); | 1071 | editContact( QString::null ); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | void KABCore::editContact( const QString &uid ) | 1074 | void KABCore::editContact( const QString &uid ) |
1075 | { | 1075 | { |
1076 | 1076 | ||
1077 | if ( mExtensionManager->isQuickEditVisible() ) | 1077 | if ( mExtensionManager->isQuickEditVisible() ) |
1078 | return; | 1078 | return; |
1079 | 1079 | ||
1080 | // First, locate the contact entry | 1080 | // First, locate the contact entry |
1081 | QString localUID = uid; | 1081 | QString localUID = uid; |
1082 | if ( localUID.isNull() ) { | 1082 | if ( localUID.isNull() ) { |
1083 | QStringList uidList = mViewManager->selectedUids(); | 1083 | QStringList uidList = mViewManager->selectedUids(); |
1084 | if ( uidList.count() > 0 ) | 1084 | if ( uidList.count() > 0 ) |
1085 | localUID = *( uidList.at( 0 ) ); | 1085 | localUID = *( uidList.at( 0 ) ); |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1088 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1089 | if ( !addr.isEmpty() ) { | 1089 | if ( !addr.isEmpty() ) { |
1090 | mEditorDialog->setAddressee( addr ); | 1090 | mEditorDialog->setAddressee( addr ); |
1091 | KApplication::execDialog ( mEditorDialog ); | 1091 | KApplication::execDialog ( mEditorDialog ); |
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | /** | 1095 | /** |
1096 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1096 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1097 | the method will try to find a selected addressee in the view. | 1097 | the method will try to find a selected addressee in the view. |
1098 | */ | 1098 | */ |
1099 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1099 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1100 | { | 1100 | { |
1101 | if ( mMultipleViewsAtOnce ) | 1101 | if ( mMultipleViewsAtOnce ) |
1102 | { | 1102 | { |
1103 | editContact( uid ); | 1103 | editContact( uid ); |
1104 | } | 1104 | } |
1105 | else | 1105 | else |
1106 | { | 1106 | { |
1107 | setDetailsVisible( true ); | 1107 | setDetailsVisible( true ); |
1108 | mActionDetails->setChecked(true); | 1108 | mActionDetails->setChecked(true); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | void KABCore::save() | 1113 | void KABCore::save() |
1114 | { | 1114 | { |
1115 | if ( !mModified ) | 1115 | if ( !mModified ) |
1116 | return; | 1116 | return; |
1117 | QString text = i18n( "There was an error while attempting to save\n the " | 1117 | QString text = i18n( "There was an error while attempting to save\n the " |
1118 | "address book. Please check that some \nother application is " | 1118 | "address book. Please check that some \nother application is " |
1119 | "not using it. " ); | 1119 | "not using it. " ); |
1120 | statusMessage(i18n("Saving addressbook ... ")); | 1120 | statusMessage(i18n("Saving addressbook ... ")); |
1121 | #ifndef KAB_EMBEDDED | 1121 | #ifndef KAB_EMBEDDED |
1122 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1122 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1123 | if ( !b || !b->save() ) { | 1123 | if ( !b || !b->save() ) { |
1124 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1124 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1125 | } | 1125 | } |
1126 | #else //KAB_EMBEDDED | 1126 | #else //KAB_EMBEDDED |
1127 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1127 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1128 | if ( !b || !b->save() ) { | 1128 | if ( !b || !b->save() ) { |
1129 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1129 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1130 | } | 1130 | } |
1131 | #endif //KAB_EMBEDDED | 1131 | #endif //KAB_EMBEDDED |
1132 | 1132 | ||
1133 | statusMessage(i18n("Addressbook saved!")); | 1133 | statusMessage(i18n("Addressbook saved!")); |
1134 | setModified( false ); | 1134 | setModified( false ); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | void KABCore::statusMessage(QString mess , int time ) | 1137 | void KABCore::statusMessage(QString mess , int time ) |
1138 | { | 1138 | { |
1139 | //topLevelWidget()->setCaption( mess ); | 1139 | //topLevelWidget()->setCaption( mess ); |
1140 | // pending setting timer to revome message | 1140 | // pending setting timer to revome message |
1141 | } | 1141 | } |
1142 | void KABCore::undo() | 1142 | void KABCore::undo() |
1143 | { | 1143 | { |
1144 | UndoStack::instance()->undo(); | 1144 | UndoStack::instance()->undo(); |
1145 | 1145 | ||
1146 | // Refresh the view | 1146 | // Refresh the view |
1147 | mViewManager->refreshView(); | 1147 | mViewManager->refreshView(); |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | void KABCore::redo() | 1150 | void KABCore::redo() |
1151 | { | 1151 | { |
1152 | RedoStack::instance()->redo(); | 1152 | RedoStack::instance()->redo(); |
1153 | 1153 | ||
1154 | // Refresh the view | 1154 | // Refresh the view |
1155 | mViewManager->refreshView(); | 1155 | mViewManager->refreshView(); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1158 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1159 | { | 1159 | { |
1160 | if (mMultipleViewsAtOnce) | 1160 | if (mMultipleViewsAtOnce) |
1161 | { | 1161 | { |
1162 | if ( visible ) | 1162 | if ( visible ) |
1163 | mJumpButtonBar->show(); | 1163 | mJumpButtonBar->show(); |
1164 | else | 1164 | else |
1165 | mJumpButtonBar->hide(); | 1165 | mJumpButtonBar->hide(); |
1166 | } | 1166 | } |
1167 | else | 1167 | else |
1168 | { | 1168 | { |
1169 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1169 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1170 | if (mViewManager->isVisible()) | 1170 | if (mViewManager->isVisible()) |
1171 | { | 1171 | { |
1172 | if ( visible ) | 1172 | if ( visible ) |
1173 | mJumpButtonBar->show(); | 1173 | mJumpButtonBar->show(); |
1174 | else | 1174 | else |
1175 | mJumpButtonBar->hide(); | 1175 | mJumpButtonBar->hide(); |
1176 | } | 1176 | } |
1177 | else | 1177 | else |
1178 | { | 1178 | { |
1179 | mJumpButtonBar->hide(); | 1179 | mJumpButtonBar->hide(); |
1180 | } | 1180 | } |
1181 | } | 1181 | } |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | 1184 | ||
1185 | void KABCore::setDetailsToState() | 1185 | void KABCore::setDetailsToState() |
1186 | { | 1186 | { |
1187 | setDetailsVisible( mActionDetails->isChecked() ); | 1187 | setDetailsVisible( mActionDetails->isChecked() ); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | 1190 | ||
1191 | 1191 | ||
1192 | void KABCore::setDetailsVisible( bool visible ) | 1192 | void KABCore::setDetailsVisible( bool visible ) |
1193 | { | 1193 | { |
1194 | if (visible && mDetails->isHidden()) | 1194 | if (visible && mDetails->isHidden()) |
1195 | { | 1195 | { |
1196 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1196 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1197 | if ( addrList.count() > 0 ) | 1197 | if ( addrList.count() > 0 ) |
1198 | mDetails->setAddressee( addrList[ 0 ] ); | 1198 | mDetails->setAddressee( addrList[ 0 ] ); |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1201 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1202 | // the listview and the detailview. We do that by changing the splitbar size. | 1202 | // the listview and the detailview. We do that by changing the splitbar size. |
1203 | if (mMultipleViewsAtOnce) | 1203 | if (mMultipleViewsAtOnce) |
1204 | { | 1204 | { |
1205 | if ( visible ) | 1205 | if ( visible ) |
1206 | mDetails->show(); | 1206 | mDetails->show(); |
1207 | else | 1207 | else |
1208 | mDetails->hide(); | 1208 | mDetails->hide(); |
1209 | } | 1209 | } |
1210 | else | 1210 | else |
1211 | { | 1211 | { |
1212 | if ( visible ) { | 1212 | if ( visible ) { |
1213 | mViewManager->hide(); | 1213 | mViewManager->hide(); |
1214 | mDetails->show(); | 1214 | mDetails->show(); |
1215 | } | 1215 | } |
1216 | else { | 1216 | else { |
1217 | mViewManager->show(); | 1217 | mViewManager->show(); |
1218 | mDetails->hide(); | 1218 | mDetails->hide(); |
1219 | } | 1219 | } |
1220 | setJumpButtonBarVisible( !visible ); | 1220 | setJumpButtonBarVisible( !visible ); |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | void KABCore::extensionChanged( int id ) | 1225 | void KABCore::extensionChanged( int id ) |
1226 | { | 1226 | { |
1227 | //change the details view only for non desktop systems | 1227 | //change the details view only for non desktop systems |
1228 | #ifndef DESKTOP_VERSION | 1228 | #ifndef DESKTOP_VERSION |
1229 | 1229 | ||
1230 | if (id == 0) | 1230 | if (id == 0) |
1231 | { | 1231 | { |
1232 | //the user disabled the extension. | 1232 | //the user disabled the extension. |
1233 | 1233 | ||
1234 | if (mMultipleViewsAtOnce) | 1234 | if (mMultipleViewsAtOnce) |
1235 | { // enable detailsview again | 1235 | { // enable detailsview again |
1236 | setDetailsVisible( true ); | 1236 | setDetailsVisible( true ); |
1237 | mActionDetails->setChecked( true ); | 1237 | mActionDetails->setChecked( true ); |
1238 | } | 1238 | } |
1239 | else | 1239 | else |
1240 | { //go back to the listview | 1240 | { //go back to the listview |
1241 | setDetailsVisible( false ); | 1241 | setDetailsVisible( false ); |
1242 | mActionDetails->setChecked( false ); | 1242 | mActionDetails->setChecked( false ); |
1243 | mActionDetails->setEnabled(true); | 1243 | mActionDetails->setEnabled(true); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | } | 1246 | } |
1247 | else | 1247 | else |
1248 | { | 1248 | { |
1249 | //the user enabled the extension. | 1249 | //the user enabled the extension. |
1250 | setDetailsVisible( false ); | 1250 | setDetailsVisible( false ); |
1251 | mActionDetails->setChecked( false ); | 1251 | mActionDetails->setChecked( false ); |
1252 | 1252 | ||
1253 | if (!mMultipleViewsAtOnce) | 1253 | if (!mMultipleViewsAtOnce) |
1254 | { | 1254 | { |
1255 | mActionDetails->setEnabled(false); | 1255 | mActionDetails->setEnabled(false); |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | mExtensionManager->setSelectionChanged(); | 1258 | mExtensionManager->setSelectionChanged(); |
1259 | 1259 | ||
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | #endif// DESKTOP_VERSION | 1262 | #endif// DESKTOP_VERSION |
1263 | 1263 | ||
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | 1266 | ||
1267 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1267 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1268 | { | 1268 | { |
1269 | 1269 | ||
1270 | if ( list.count() != 0 ) { | 1270 | if ( list.count() != 0 ) { |
1271 | KABC::Addressee::List::ConstIterator it; | 1271 | KABC::Addressee::List::ConstIterator it; |
1272 | for ( it = list.begin(); it != list.end(); ++it ) | 1272 | for ( it = list.begin(); it != list.end(); ++it ) |
1273 | mAddressBook->insertAddressee( *it ); | 1273 | mAddressBook->insertAddressee( *it ); |
1274 | if ( list.count() > 1 ) | 1274 | if ( list.count() > 1 ) |
1275 | setModified(); | 1275 | setModified(); |
1276 | else | 1276 | else |
1277 | setModifiedWOrefresh(); | 1277 | setModifiedWOrefresh(); |
1278 | } | 1278 | } |
1279 | if ( list.count() == 0 ) | 1279 | if ( list.count() == 0 ) |
1280 | mViewManager->refreshView(); | 1280 | mViewManager->refreshView(); |
1281 | else | 1281 | else |
1282 | mViewManager->refreshView( list[ 0 ].uid() ); | 1282 | mViewManager->refreshView( list[ 0 ].uid() ); |
1283 | 1283 | ||
1284 | 1284 | ||
1285 | 1285 | ||
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | QString KABCore::getNameByPhone( const QString &phone ) | 1288 | QString KABCore::getNameByPhone( const QString &phone ) |
1289 | { | 1289 | { |
1290 | #ifndef KAB_EMBEDDED | 1290 | #ifndef KAB_EMBEDDED |
1291 | QRegExp r( "[/*/-/ ]" ); | 1291 | QRegExp r( "[/*/-/ ]" ); |
1292 | QString localPhone( phone ); | 1292 | QString localPhone( phone ); |
1293 | 1293 | ||
1294 | bool found = false; | 1294 | bool found = false; |
1295 | QString ownerName = ""; | 1295 | QString ownerName = ""; |
1296 | KABC::AddressBook::Iterator iter; | 1296 | KABC::AddressBook::Iterator iter; |
1297 | KABC::PhoneNumber::List::Iterator phoneIter; | 1297 | KABC::PhoneNumber::List::Iterator phoneIter; |
1298 | KABC::PhoneNumber::List phoneList; | 1298 | KABC::PhoneNumber::List phoneList; |
1299 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1299 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1300 | phoneList = (*iter).phoneNumbers(); | 1300 | phoneList = (*iter).phoneNumbers(); |
1301 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1301 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1302 | ++phoneIter) { | 1302 | ++phoneIter) { |
1303 | // Get rid of separator chars so just the numbers are compared. | 1303 | // Get rid of separator chars so just the numbers are compared. |
1304 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1304 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1305 | ownerName = (*iter).formattedName(); | 1305 | ownerName = (*iter).formattedName(); |
1306 | found = true; | 1306 | found = true; |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | return ownerName; | 1311 | return ownerName; |
1312 | #else //KAB_EMBEDDED | 1312 | #else //KAB_EMBEDDED |
1313 | qDebug("KABCore::getNameByPhone finsih method"); | 1313 | qDebug("KABCore::getNameByPhone finsih method"); |
1314 | return ""; | 1314 | return ""; |
1315 | #endif //KAB_EMBEDDED | 1315 | #endif //KAB_EMBEDDED |
1316 | 1316 | ||
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | void KABCore::openConfigDialog() | 1319 | void KABCore::openConfigDialog() |
1320 | { | 1320 | { |
1321 | KABPrefs* kab_prefs = KABPrefs::instance(); | 1321 | KABPrefs* kab_prefs = KABPrefs::instance(); |
1322 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); | 1322 | KPimGlobalPrefs* kpim_prefs = KPimGlobalPrefs::instance(); |
1323 | 1323 | ||
1324 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1324 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1325 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1325 | KCMKabConfig* kabcfg = new KCMKabConfig( kab_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1326 | ConfigureDialog->addModule(kabcfg ); | 1326 | ConfigureDialog->addModule(kabcfg ); |
1327 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1327 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( kpim_prefs, ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1328 | ConfigureDialog->addModule(kdelibcfg ); | 1328 | ConfigureDialog->addModule(kdelibcfg ); |
1329 | 1329 | ||
1330 | 1330 | ||
1331 | 1331 | ||
1332 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1332 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1333 | this, SLOT( configurationChanged() ) ); | 1333 | this, SLOT( configurationChanged() ) ); |
1334 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1334 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1335 | this, SLOT( configurationChanged() ) ); | 1335 | this, SLOT( configurationChanged() ) ); |
1336 | saveSettings(); | 1336 | saveSettings(); |
1337 | #ifndef DESKTOP_VERSION | 1337 | #ifndef DESKTOP_VERSION |
1338 | ConfigureDialog->showMaximized(); | 1338 | ConfigureDialog->showMaximized(); |
1339 | #endif | 1339 | #endif |
1340 | if ( ConfigureDialog->exec() ) | 1340 | if ( ConfigureDialog->exec() ) |
1341 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1341 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1342 | delete ConfigureDialog; | 1342 | delete ConfigureDialog; |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | void KABCore::openLDAPDialog() | 1345 | void KABCore::openLDAPDialog() |
1346 | { | 1346 | { |
1347 | #ifndef KAB_EMBEDDED | 1347 | #ifndef KAB_EMBEDDED |
1348 | if ( !mLdapSearchDialog ) { | 1348 | if ( !mLdapSearchDialog ) { |
1349 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1349 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1350 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1350 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1351 | SLOT( refreshView() ) ); | 1351 | SLOT( refreshView() ) ); |
1352 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1352 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1353 | SLOT( setModified() ) ); | 1353 | SLOT( setModified() ) ); |
1354 | } else | 1354 | } else |
1355 | mLdapSearchDialog->restoreSettings(); | 1355 | mLdapSearchDialog->restoreSettings(); |
1356 | 1356 | ||
1357 | if ( mLdapSearchDialog->isOK() ) | 1357 | if ( mLdapSearchDialog->isOK() ) |
1358 | mLdapSearchDialog->exec(); | 1358 | mLdapSearchDialog->exec(); |
1359 | #else //KAB_EMBEDDED | 1359 | #else //KAB_EMBEDDED |
1360 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1360 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1361 | #endif //KAB_EMBEDDED | 1361 | #endif //KAB_EMBEDDED |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | void KABCore::print() | 1364 | void KABCore::print() |
1365 | { | 1365 | { |
1366 | #ifndef KAB_EMBEDDED | 1366 | #ifndef KAB_EMBEDDED |
1367 | KPrinter printer; | 1367 | KPrinter printer; |
1368 | if ( !printer.setup( this ) ) | 1368 | if ( !printer.setup( this ) ) |
1369 | return; | 1369 | return; |
1370 | 1370 | ||
1371 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1371 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1372 | mViewManager->selectedUids(), this ); | 1372 | mViewManager->selectedUids(), this ); |
1373 | 1373 | ||
1374 | wizard.exec(); | 1374 | wizard.exec(); |
1375 | #else //KAB_EMBEDDED | 1375 | #else //KAB_EMBEDDED |
1376 | qDebug("KABCore::print() finsih method"); | 1376 | qDebug("KABCore::print() finsih method"); |
1377 | #endif //KAB_EMBEDDED | 1377 | #endif //KAB_EMBEDDED |
1378 | 1378 | ||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | 1381 | ||
1382 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1382 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1383 | { | 1383 | { |
1384 | if ( mGUIClient ) | 1384 | if ( mGUIClient ) |
1385 | mGUIClient->insertChildClient( client ); | 1385 | mGUIClient->insertChildClient( client ); |
1386 | else | 1386 | else |
1387 | KMessageBox::error( this, "no KXMLGUICLient"); | 1387 | KMessageBox::error( this, "no KXMLGUICLient"); |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | 1390 | ||
1391 | void KABCore::configurationChanged() | 1391 | void KABCore::configurationChanged() |
1392 | { | 1392 | { |
1393 | mExtensionManager->reconfigure(); | 1393 | mExtensionManager->reconfigure(); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | void KABCore::addressBookChanged() | 1396 | void KABCore::addressBookChanged() |
1397 | { | 1397 | { |
1398 | /*US | 1398 | /*US |
1399 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1399 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1400 | while ( it.current() ) { | 1400 | while ( it.current() ) { |
1401 | if ( it.current()->dirty() ) { | 1401 | if ( it.current()->dirty() ) { |
1402 | QString text = i18n( "Data has been changed externally. Unsaved " | 1402 | QString text = i18n( "Data has been changed externally. Unsaved " |
1403 | "changes will be lost." ); | 1403 | "changes will be lost." ); |
1404 | KMessageBox::information( this, text ); | 1404 | KMessageBox::information( this, text ); |
1405 | } | 1405 | } |
1406 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1406 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1407 | ++it; | 1407 | ++it; |
1408 | } | 1408 | } |
1409 | */ | 1409 | */ |
1410 | if (mEditorDialog) | 1410 | if (mEditorDialog) |
1411 | { | 1411 | { |
1412 | if (mEditorDialog->dirty()) | 1412 | if (mEditorDialog->dirty()) |
1413 | { | 1413 | { |
1414 | QString text = i18n( "Data has been changed externally. Unsaved " | 1414 | QString text = i18n( "Data has been changed externally. Unsaved " |
1415 | "changes will be lost." ); | 1415 | "changes will be lost." ); |
1416 | KMessageBox::information( this, text ); | 1416 | KMessageBox::information( this, text ); |
1417 | } | 1417 | } |
1418 | QString currentuid = mEditorDialog->addressee().uid(); | 1418 | QString currentuid = mEditorDialog->addressee().uid(); |
1419 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1419 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1420 | } | 1420 | } |
1421 | mViewManager->refreshView(); | 1421 | mViewManager->refreshView(); |
1422 | // mDetails->refreshView(); | 1422 | // mDetails->refreshView(); |
1423 | 1423 | ||
1424 | 1424 | ||
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1427 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1428 | const char *name ) | 1428 | const char *name ) |
1429 | { | 1429 | { |
1430 | 1430 | ||
1431 | if ( mEditorDialog == 0 ) { | 1431 | if ( mEditorDialog == 0 ) { |
1432 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1432 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1433 | name ? name : "editorDialog" ); | 1433 | name ? name : "editorDialog" ); |
1434 | 1434 | ||
1435 | 1435 | ||
1436 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1436 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1437 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1437 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1438 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1438 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1439 | // SLOT( slotEditorDestroyed( const QString& ) ) ); | 1439 | // SLOT( slotEditorDestroyed( const QString& ) ) ); |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | return mEditorDialog; | 1442 | return mEditorDialog; |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1445 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1446 | { | 1446 | { |
1447 | //mEditorDict.remove( uid ); | 1447 | //mEditorDict.remove( uid ); |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | void KABCore::initGUI() | 1450 | void KABCore::initGUI() |
1451 | { | 1451 | { |
1452 | #ifndef KAB_EMBEDDED | 1452 | #ifndef KAB_EMBEDDED |
1453 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1453 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1454 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1454 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1455 | 1455 | ||
1456 | mExtensionBarSplitter = new QSplitter( this ); | 1456 | mExtensionBarSplitter = new QSplitter( this ); |
1457 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1457 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1458 | 1458 | ||
1459 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1459 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1460 | 1460 | ||
1461 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1461 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1462 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1462 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1463 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1463 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1464 | SLOT( incrementalSearch( const QString& ) ) ); | 1464 | SLOT( incrementalSearch( const QString& ) ) ); |
1465 | 1465 | ||
1466 | mViewManager = new ViewManager( this, viewSpace ); | 1466 | mViewManager = new ViewManager( this, viewSpace ); |
1467 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1467 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1468 | 1468 | ||
1469 | mDetails = new ViewContainer( mDetailsSplitter ); | 1469 | mDetails = new ViewContainer( mDetailsSplitter ); |
1470 | 1470 | ||
1471 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1471 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1472 | 1472 | ||
1473 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1473 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1474 | 1474 | ||
1475 | topLayout->addWidget( mExtensionBarSplitter ); | 1475 | topLayout->addWidget( mExtensionBarSplitter ); |
1476 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1476 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1477 | topLayout->addWidget( mJumpButtonBar ); | 1477 | topLayout->addWidget( mJumpButtonBar ); |
1478 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1478 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1479 | 1479 | ||
1480 | mXXPortManager = new XXPortManager( this, this ); | 1480 | mXXPortManager = new XXPortManager( this, this ); |
1481 | 1481 | ||
1482 | #else //KAB_EMBEDDED | 1482 | #else //KAB_EMBEDDED |
1483 | //US initialize viewMenu before settingup viewmanager. | 1483 | //US initialize viewMenu before settingup viewmanager. |
1484 | // Viewmanager needs this menu to plugin submenues. | 1484 | // Viewmanager needs this menu to plugin submenues. |
1485 | viewMenu = new QPopupMenu( this ); | 1485 | viewMenu = new QPopupMenu( this ); |
1486 | settingsMenu = new QPopupMenu( this ); | 1486 | settingsMenu = new QPopupMenu( this ); |
1487 | //filterMenu = new QPopupMenu( this ); | 1487 | //filterMenu = new QPopupMenu( this ); |
1488 | ImportMenu = new QPopupMenu( this ); | 1488 | ImportMenu = new QPopupMenu( this ); |
1489 | ExportMenu = new QPopupMenu( this ); | 1489 | ExportMenu = new QPopupMenu( this ); |
1490 | 1490 | ||
1491 | changeMenu= new QPopupMenu( this ); | 1491 | changeMenu= new QPopupMenu( this ); |
1492 | 1492 | ||
1493 | //US since we have no splitter for the embedded system, setup | 1493 | //US since we have no splitter for the embedded system, setup |
1494 | // a layout with two frames. One left and one right. | 1494 | // a layout with two frames. One left and one right. |
1495 | 1495 | ||
1496 | QBoxLayout *topLayout; | 1496 | QBoxLayout *topLayout; |
1497 | 1497 | ||
1498 | // = new QHBoxLayout( this ); | 1498 | // = new QHBoxLayout( this ); |
1499 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1499 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1500 | 1500 | ||
1501 | // QWidget *mainBox = new QWidget( this ); | 1501 | // QWidget *mainBox = new QWidget( this ); |
1502 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1502 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1503 | 1503 | ||
1504 | #ifdef DESKTOP_VERSION | 1504 | #ifdef DESKTOP_VERSION |
1505 | topLayout = new QHBoxLayout( this ); | 1505 | topLayout = new QHBoxLayout( this ); |
1506 | 1506 | ||
1507 | 1507 | ||
1508 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1508 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1509 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1509 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1510 | 1510 | ||
1511 | topLayout->addWidget(mMiniSplitter ); | 1511 | topLayout->addWidget(mMiniSplitter ); |
1512 | 1512 | ||
1513 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1513 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1514 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1514 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1515 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1515 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1516 | mDetails = new ViewContainer( mMiniSplitter ); | 1516 | mDetails = new ViewContainer( mMiniSplitter ); |
1517 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1517 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1518 | #else | 1518 | #else |
1519 | if ( QApplication::desktop()->width() > 480 ) { | 1519 | if ( QApplication::desktop()->width() > 480 ) { |
1520 | topLayout = new QHBoxLayout( this ); | 1520 | topLayout = new QHBoxLayout( this ); |
1521 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1521 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1522 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1522 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1523 | } else { | 1523 | } else { |
1524 | 1524 | ||
1525 | topLayout = new QHBoxLayout( this ); | 1525 | topLayout = new QHBoxLayout( this ); |
1526 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1526 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1527 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1527 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | topLayout->addWidget(mMiniSplitter ); | 1530 | topLayout->addWidget(mMiniSplitter ); |
1531 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1531 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1532 | mDetails = new ViewContainer( mMiniSplitter ); | 1532 | mDetails = new ViewContainer( mMiniSplitter ); |
1533 | 1533 | ||
1534 | 1534 | ||
1535 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1535 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1536 | #endif | 1536 | #endif |
1537 | //eh->hide(); | 1537 | //eh->hide(); |
1538 | // topLayout->addWidget(mExtensionManager ); | 1538 | // topLayout->addWidget(mExtensionManager ); |
1539 | 1539 | ||
1540 | 1540 | ||
1541 | /*US | 1541 | /*US |
1542 | #ifndef KAB_NOSPLITTER | 1542 | #ifndef KAB_NOSPLITTER |
1543 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1543 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1544 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1544 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1545 | topLayout->setSpacing( 10 ); | 1545 | topLayout->setSpacing( 10 ); |
1546 | 1546 | ||
1547 | mDetailsSplitter = new QSplitter( this ); | 1547 | mDetailsSplitter = new QSplitter( this ); |
1548 | 1548 | ||
1549 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1549 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1550 | 1550 | ||
1551 | mViewManager = new ViewManager( this, viewSpace ); | 1551 | mViewManager = new ViewManager( this, viewSpace ); |
1552 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1552 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1553 | 1553 | ||
1554 | mDetails = new ViewContainer( mDetailsSplitter ); | 1554 | mDetails = new ViewContainer( mDetailsSplitter ); |
1555 | 1555 | ||
1556 | topLayout->addWidget( mDetailsSplitter ); | 1556 | topLayout->addWidget( mDetailsSplitter ); |
1557 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1557 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1558 | #else //KAB_NOSPLITTER | 1558 | #else //KAB_NOSPLITTER |
1559 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1559 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1560 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1560 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1561 | topLayout->setSpacing( 10 ); | 1561 | topLayout->setSpacing( 10 ); |
1562 | 1562 | ||
1563 | // mDetailsSplitter = new QSplitter( this ); | 1563 | // mDetailsSplitter = new QSplitter( this ); |
1564 | 1564 | ||
1565 | QVBox *viewSpace = new QVBox( this ); | 1565 | QVBox *viewSpace = new QVBox( this ); |
1566 | 1566 | ||
1567 | mViewManager = new ViewManager( this, viewSpace ); | 1567 | mViewManager = new ViewManager( this, viewSpace ); |
1568 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1568 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1569 | 1569 | ||
1570 | mDetails = new ViewContainer( this ); | 1570 | mDetails = new ViewContainer( this ); |
1571 | 1571 | ||
1572 | topLayout->addWidget( viewSpace ); | 1572 | topLayout->addWidget( viewSpace ); |
1573 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1573 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1574 | topLayout->addWidget( mDetails ); | 1574 | topLayout->addWidget( mDetails ); |
1575 | #endif //KAB_NOSPLITTER | 1575 | #endif //KAB_NOSPLITTER |
1576 | */ | 1576 | */ |
1577 | 1577 | ||
1578 | 1578 | ||
1579 | #endif //KAB_EMBEDDED | 1579 | #endif //KAB_EMBEDDED |
1580 | initActions(); | 1580 | initActions(); |
1581 | 1581 | ||
1582 | #ifdef KAB_EMBEDDED | 1582 | #ifdef KAB_EMBEDDED |
1583 | addActionsManually(); | 1583 | addActionsManually(); |
1584 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1584 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1585 | mXXPortManager = new XXPortManager( this, this ); | 1585 | mXXPortManager = new XXPortManager( this, this ); |
1586 | 1586 | ||
1587 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1587 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1588 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1588 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1589 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1589 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1590 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1590 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1591 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1591 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1592 | // mIncSearchWidget->hide(); | 1592 | // mIncSearchWidget->hide(); |
1593 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1593 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1594 | SLOT( incrementalSearch( const QString& ) ) ); | 1594 | SLOT( incrementalSearch( const QString& ) ) ); |
1595 | 1595 | ||
1596 | 1596 | ||
1597 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1597 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1598 | 1598 | ||
1599 | topLayout->addWidget( mJumpButtonBar ); | 1599 | topLayout->addWidget( mJumpButtonBar ); |
1600 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1600 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1601 | 1601 | ||
1602 | // mMainWindow->getIconToolBar()->raise(); | 1602 | // mMainWindow->getIconToolBar()->raise(); |
1603 | 1603 | ||
1604 | #endif //KAB_EMBEDDED | 1604 | #endif //KAB_EMBEDDED |
1605 | 1605 | ||
1606 | } | 1606 | } |
1607 | void KABCore::initActions() | 1607 | void KABCore::initActions() |
1608 | { | 1608 | { |
1609 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1609 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1610 | 1610 | ||
1611 | #ifndef KAB_EMBEDDED | 1611 | #ifndef KAB_EMBEDDED |
1612 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1612 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1613 | SLOT( clipboardDataChanged() ) ); | 1613 | SLOT( clipboardDataChanged() ) ); |
1614 | #endif //KAB_EMBEDDED | 1614 | #endif //KAB_EMBEDDED |
1615 | 1615 | ||
1616 | // file menu | 1616 | // file menu |
1617 | if ( mIsPart ) { | 1617 | if ( mIsPart ) { |
1618 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1618 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1619 | SLOT( sendMail() ), actionCollection(), | 1619 | SLOT( sendMail() ), actionCollection(), |
1620 | "kaddressbook_mail" ); | 1620 | "kaddressbook_mail" ); |
1621 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1621 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1622 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1622 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1623 | 1623 | ||
1624 | } else { | 1624 | } else { |
1625 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1625 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1626 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1626 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | 1629 | ||
1630 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1630 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1631 | SLOT( save() ), actionCollection(), "file_sync" ); | 1631 | SLOT( save() ), actionCollection(), "file_sync" ); |
1632 | 1632 | ||
1633 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1633 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1634 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1634 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1635 | 1635 | ||
1636 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1636 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1637 | this, SLOT( mailVCard() ), | 1637 | this, SLOT( mailVCard() ), |
1638 | actionCollection(), "file_mail_vcard"); | 1638 | actionCollection(), "file_mail_vcard"); |
1639 | 1639 | ||
1640 | mActionBeamVCard = 0; | 1640 | mActionBeamVCard = 0; |
1641 | mActionBeam = 0; | 1641 | mActionBeam = 0; |
1642 | 1642 | ||
1643 | #ifndef DESKTOP_VERSION | 1643 | #ifndef DESKTOP_VERSION |
1644 | if ( Ir::supported() ) { | 1644 | if ( Ir::supported() ) { |
1645 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1645 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1646 | SLOT( beamVCard() ), actionCollection(), | 1646 | SLOT( beamVCard() ), actionCollection(), |
1647 | "kaddressbook_beam_vcard" ); | 1647 | "kaddressbook_beam_vcard" ); |
1648 | 1648 | ||
1649 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1649 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1650 | SLOT( beamMySelf() ), actionCollection(), | 1650 | SLOT( beamMySelf() ), actionCollection(), |
1651 | "kaddressbook_beam_myself" ); | 1651 | "kaddressbook_beam_myself" ); |
1652 | } | 1652 | } |
1653 | #endif | 1653 | #endif |
1654 | 1654 | ||
1655 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1655 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1656 | this, SLOT( editContact2() ), | 1656 | this, SLOT( editContact2() ), |
1657 | actionCollection(), "file_properties" ); | 1657 | actionCollection(), "file_properties" ); |
1658 | 1658 | ||
1659 | #ifdef KAB_EMBEDDED | 1659 | #ifdef KAB_EMBEDDED |
1660 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1660 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1661 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1661 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1662 | mMainWindow, SLOT( exit() ), | 1662 | mMainWindow, SLOT( exit() ), |
1663 | actionCollection(), "quit" ); | 1663 | actionCollection(), "quit" ); |
1664 | #endif //KAB_EMBEDDED | 1664 | #endif //KAB_EMBEDDED |
1665 | 1665 | ||
1666 | // edit menu | 1666 | // edit menu |
1667 | if ( mIsPart ) { | 1667 | if ( mIsPart ) { |
1668 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1668 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1669 | SLOT( copyContacts() ), actionCollection(), | 1669 | SLOT( copyContacts() ), actionCollection(), |
1670 | "kaddressbook_copy" ); | 1670 | "kaddressbook_copy" ); |
1671 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1671 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1672 | SLOT( cutContacts() ), actionCollection(), | 1672 | SLOT( cutContacts() ), actionCollection(), |
1673 | "kaddressbook_cut" ); | 1673 | "kaddressbook_cut" ); |
1674 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1674 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1675 | SLOT( pasteContacts() ), actionCollection(), | 1675 | SLOT( pasteContacts() ), actionCollection(), |
1676 | "kaddressbook_paste" ); | 1676 | "kaddressbook_paste" ); |
1677 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1677 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1678 | SLOT( selectAllContacts() ), actionCollection(), | 1678 | SLOT( selectAllContacts() ), actionCollection(), |
1679 | "kaddressbook_select_all" ); | 1679 | "kaddressbook_select_all" ); |
1680 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1680 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1681 | SLOT( undo() ), actionCollection(), | 1681 | SLOT( undo() ), actionCollection(), |
1682 | "kaddressbook_undo" ); | 1682 | "kaddressbook_undo" ); |
1683 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1683 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1684 | this, SLOT( redo() ), actionCollection(), | 1684 | this, SLOT( redo() ), actionCollection(), |
1685 | "kaddressbook_redo" ); | 1685 | "kaddressbook_redo" ); |
1686 | } else { | 1686 | } else { |
1687 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1687 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1688 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1688 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1689 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1689 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1690 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1690 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1691 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1691 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1692 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1692 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1695 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1696 | Key_Delete, this, SLOT( deleteContacts() ), | 1696 | Key_Delete, this, SLOT( deleteContacts() ), |
1697 | actionCollection(), "edit_delete" ); | 1697 | actionCollection(), "edit_delete" ); |
1698 | 1698 | ||
1699 | mActionUndo->setEnabled( false ); | 1699 | mActionUndo->setEnabled( false ); |
1700 | mActionRedo->setEnabled( false ); | 1700 | mActionRedo->setEnabled( false ); |
1701 | 1701 | ||
1702 | // settings menu | 1702 | // settings menu |
1703 | #ifdef KAB_EMBEDDED | 1703 | #ifdef KAB_EMBEDDED |
1704 | //US special menuentry to configure the addressbook resources. On KDE | 1704 | //US special menuentry to configure the addressbook resources. On KDE |
1705 | // you do that through the control center !!! | 1705 | // you do that through the control center !!! |
1706 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1706 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1707 | SLOT( configureResources() ), actionCollection(), | 1707 | SLOT( configureResources() ), actionCollection(), |
1708 | "kaddressbook_configure_resources" ); | 1708 | "kaddressbook_configure_resources" ); |
1709 | #endif //KAB_EMBEDDED | 1709 | #endif //KAB_EMBEDDED |
1710 | 1710 | ||
1711 | if ( mIsPart ) { | 1711 | if ( mIsPart ) { |
1712 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1712 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1713 | SLOT( openConfigDialog() ), actionCollection(), | 1713 | SLOT( openConfigDialog() ), actionCollection(), |
1714 | "kaddressbook_configure" ); | 1714 | "kaddressbook_configure" ); |
1715 | 1715 | ||
1716 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1716 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1717 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1717 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1718 | "kaddressbook_configure_shortcuts" ); | 1718 | "kaddressbook_configure_shortcuts" ); |
1719 | #ifdef KAB_EMBEDDED | 1719 | #ifdef KAB_EMBEDDED |
1720 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1720 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1721 | mActionConfigureToolbars->setEnabled( false ); | 1721 | mActionConfigureToolbars->setEnabled( false ); |
1722 | #endif //KAB_EMBEDDED | 1722 | #endif //KAB_EMBEDDED |
1723 | 1723 | ||
1724 | } else { | 1724 | } else { |
1725 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1725 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1726 | 1726 | ||
1727 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1727 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1730 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1731 | actionCollection(), "options_show_jump_bar" ); | 1731 | actionCollection(), "options_show_jump_bar" ); |
1732 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1732 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1733 | 1733 | ||
1734 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1734 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1735 | actionCollection(), "options_show_details" ); | 1735 | actionCollection(), "options_show_details" ); |
1736 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1736 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1737 | 1737 | ||
1738 | // misc | 1738 | // misc |
1739 | // only enable LDAP lookup if we can handle the protocol | 1739 | // only enable LDAP lookup if we can handle the protocol |
1740 | #ifndef KAB_EMBEDDED | 1740 | #ifndef KAB_EMBEDDED |
1741 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1741 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1742 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1742 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1743 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1743 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1744 | "ldap_lookup" ); | 1744 | "ldap_lookup" ); |
1745 | } | 1745 | } |
1746 | #else //KAB_EMBEDDED | 1746 | #else //KAB_EMBEDDED |
1747 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1747 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1748 | #endif //KAB_EMBEDDED | 1748 | #endif //KAB_EMBEDDED |
1749 | 1749 | ||
1750 | 1750 | ||
1751 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1751 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1752 | SLOT( setWhoAmI() ), actionCollection(), | 1752 | SLOT( setWhoAmI() ), actionCollection(), |
1753 | "set_personal" ); | 1753 | "set_personal" ); |
1754 | 1754 | ||
1755 | 1755 | ||
1756 | 1756 | ||
1757 | 1757 | ||
1758 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1758 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1759 | SLOT( setCategories() ), actionCollection(), | 1759 | SLOT( setCategories() ), actionCollection(), |
1760 | "edit_set_categories" ); | 1760 | "edit_set_categories" ); |
1761 | 1761 | ||
1762 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1762 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1763 | SLOT( removeVoice() ), actionCollection(), | 1763 | SLOT( removeVoice() ), actionCollection(), |
1764 | "remove_voice" ); | 1764 | "remove_voice" ); |
1765 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | 1765 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, |
1766 | SLOT( importFromOL() ), actionCollection(), | 1766 | SLOT( importFromOL() ), actionCollection(), |
1767 | "import_OL" ); | 1767 | "import_OL" ); |
1768 | #ifdef KAB_EMBEDDED | 1768 | #ifdef KAB_EMBEDDED |
1769 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1769 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1770 | this, SLOT( showLicence() ), actionCollection(), | 1770 | this, SLOT( showLicence() ), actionCollection(), |
1771 | "licence_about_data" ); | 1771 | "licence_about_data" ); |
1772 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1772 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1773 | this, SLOT( faq() ), actionCollection(), | 1773 | this, SLOT( faq() ), actionCollection(), |
1774 | "faq_about_data" ); | 1774 | "faq_about_data" ); |
1775 | 1775 | ||
1776 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1776 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1777 | this, SLOT( createAboutData() ), actionCollection(), | 1777 | this, SLOT( createAboutData() ), actionCollection(), |
1778 | "kaddressbook_about_data" ); | 1778 | "kaddressbook_about_data" ); |
1779 | #endif //KAB_EMBEDDED | 1779 | #endif //KAB_EMBEDDED |
1780 | 1780 | ||
1781 | clipboardDataChanged(); | 1781 | clipboardDataChanged(); |
1782 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1782 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1783 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1783 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1784 | } | 1784 | } |
1785 | 1785 | ||
1786 | //US we need this function, to plug all actions into the correct menues. | 1786 | //US we need this function, to plug all actions into the correct menues. |
1787 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1787 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1788 | void KABCore::addActionsManually() | 1788 | void KABCore::addActionsManually() |
1789 | { | 1789 | { |
1790 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1790 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1791 | 1791 | ||
1792 | #ifdef KAB_EMBEDDED | 1792 | #ifdef KAB_EMBEDDED |
1793 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1793 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1794 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1794 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1795 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1795 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1796 | 1796 | ||
1797 | KToolBar* tb = mMainWindow->toolBar(); | 1797 | KToolBar* tb = mMainWindow->toolBar(); |
1798 | 1798 | ||
1799 | #ifdef DESKTOP_VERSION | 1799 | #ifdef DESKTOP_VERSION |
1800 | QMenuBar* mb = mMainWindow->menuBar(); | 1800 | QMenuBar* mb = mMainWindow->menuBar(); |
1801 | 1801 | ||
1802 | //US setup menubar. | 1802 | //US setup menubar. |
1803 | //Disable the following block if you do not want to have a menubar. | 1803 | //Disable the following block if you do not want to have a menubar. |
1804 | mb->insertItem( "&File", fileMenu ); | 1804 | mb->insertItem( "&File", fileMenu ); |
1805 | mb->insertItem( "&Edit", editMenu ); | 1805 | mb->insertItem( "&Edit", editMenu ); |
1806 | mb->insertItem( "&View", viewMenu ); | 1806 | mb->insertItem( "&View", viewMenu ); |
1807 | mb->insertItem( "&Settings", settingsMenu ); | 1807 | mb->insertItem( "&Settings", settingsMenu ); |
1808 | mb->insertItem( "&Change selected", changeMenu ); | 1808 | mb->insertItem( "&Change selected", changeMenu ); |
1809 | mb->insertItem( "&Help", helpMenu ); | 1809 | mb->insertItem( "&Help", helpMenu ); |
1810 | mIncSearchWidget = new IncSearchWidget( tb ); | 1810 | mIncSearchWidget = new IncSearchWidget( tb ); |
1811 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1811 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1812 | 1812 | ||
1813 | #else | 1813 | #else |
1814 | //US setup toolbar | 1814 | //US setup toolbar |
1815 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1815 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1816 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1816 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1817 | menuBarTB->insertItem( "ME", popupBarTB); | 1817 | menuBarTB->insertItem( "ME", popupBarTB); |
1818 | tb->insertWidget(-1, 0, menuBarTB); | 1818 | tb->insertWidget(-1, 0, menuBarTB); |
1819 | mIncSearchWidget = new IncSearchWidget( tb ); | 1819 | mIncSearchWidget = new IncSearchWidget( tb ); |
1820 | 1820 | ||
1821 | tb->enableMoving(false); | 1821 | tb->enableMoving(false); |
1822 | popupBarTB->insertItem( "&File", fileMenu ); | 1822 | popupBarTB->insertItem( "&File", fileMenu ); |
1823 | popupBarTB->insertItem( "&Edit", editMenu ); | 1823 | popupBarTB->insertItem( "&Edit", editMenu ); |
1824 | popupBarTB->insertItem( "&View", viewMenu ); | 1824 | popupBarTB->insertItem( "&View", viewMenu ); |
1825 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1825 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1826 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1826 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1827 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1827 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1828 | popupBarTB->insertItem( "&Help", helpMenu ); | 1828 | popupBarTB->insertItem( "&Help", helpMenu ); |
1829 | if (QApplication::desktop()->width() > 320 ) { | 1829 | if (QApplication::desktop()->width() > 320 ) { |
1830 | // mViewManager->getFilterAction()->plug ( tb); | 1830 | // mViewManager->getFilterAction()->plug ( tb); |
1831 | } | 1831 | } |
1832 | #endif | 1832 | #endif |
1833 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1833 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1834 | 1834 | ||
1835 | 1835 | ||
1836 | 1836 | ||
1837 | //US Now connect the actions with the menue entries. | 1837 | //US Now connect the actions with the menue entries. |
1838 | mActionPrint->plug( fileMenu ); | 1838 | mActionPrint->plug( fileMenu ); |
1839 | mActionMail->plug( fileMenu ); | 1839 | mActionMail->plug( fileMenu ); |
1840 | fileMenu->insertSeparator(); | 1840 | fileMenu->insertSeparator(); |
1841 | 1841 | ||
1842 | mActionNewContact->plug( fileMenu ); | 1842 | mActionNewContact->plug( fileMenu ); |
1843 | mActionNewContact->plug( tb ); | 1843 | mActionNewContact->plug( tb ); |
1844 | 1844 | ||
1845 | mActionEditAddressee->plug( fileMenu ); | 1845 | mActionEditAddressee->plug( fileMenu ); |
1846 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1846 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1847 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1847 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1848 | mActionEditAddressee->plug( tb ); | 1848 | mActionEditAddressee->plug( tb ); |
1849 | 1849 | ||
1850 | fileMenu->insertSeparator(); | 1850 | fileMenu->insertSeparator(); |
1851 | mActionSave->plug( fileMenu ); | 1851 | mActionSave->plug( fileMenu ); |
1852 | fileMenu->insertItem( "&Import", ImportMenu ); | 1852 | fileMenu->insertItem( "&Import", ImportMenu ); |
1853 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1853 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1854 | fileMenu->insertSeparator(); | 1854 | fileMenu->insertSeparator(); |
1855 | mActionMailVCard->plug( fileMenu ); | 1855 | mActionMailVCard->plug( fileMenu ); |
1856 | #ifndef DESKTOP_VERSION | 1856 | #ifndef DESKTOP_VERSION |
1857 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1857 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1858 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1858 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1859 | #endif | 1859 | #endif |
1860 | fileMenu->insertSeparator(); | 1860 | fileMenu->insertSeparator(); |
1861 | mActionQuit->plug( fileMenu ); | 1861 | mActionQuit->plug( fileMenu ); |
1862 | #ifdef _WIN32_ | 1862 | #ifdef _WIN32_ |
1863 | mActionImportOL->plug( ImportMenu ); | 1863 | mActionImportOL->plug( ImportMenu ); |
1864 | #endif | 1864 | #endif |
1865 | // edit menu | 1865 | // edit menu |
1866 | mActionUndo->plug( editMenu ); | 1866 | mActionUndo->plug( editMenu ); |
1867 | mActionRedo->plug( editMenu ); | 1867 | mActionRedo->plug( editMenu ); |
1868 | editMenu->insertSeparator(); | 1868 | editMenu->insertSeparator(); |
1869 | mActionCut->plug( editMenu ); | 1869 | mActionCut->plug( editMenu ); |
1870 | mActionCopy->plug( editMenu ); | 1870 | mActionCopy->plug( editMenu ); |
1871 | mActionPaste->plug( editMenu ); | 1871 | mActionPaste->plug( editMenu ); |
1872 | mActionDelete->plug( editMenu ); | 1872 | mActionDelete->plug( editMenu ); |
1873 | editMenu->insertSeparator(); | 1873 | editMenu->insertSeparator(); |
1874 | mActionSelectAll->plug( editMenu ); | 1874 | mActionSelectAll->plug( editMenu ); |
1875 | 1875 | ||
1876 | mActionRemoveVoice->plug( changeMenu ); | 1876 | mActionRemoveVoice->plug( changeMenu ); |
1877 | // settings menu | 1877 | // settings menu |
1878 | //US special menuentry to configure the addressbook resources. On KDE | 1878 | //US special menuentry to configure the addressbook resources. On KDE |
1879 | // you do that through the control center !!! | 1879 | // you do that through the control center !!! |
1880 | mActionConfigResources->plug( settingsMenu ); | 1880 | mActionConfigResources->plug( settingsMenu ); |
1881 | settingsMenu->insertSeparator(); | 1881 | settingsMenu->insertSeparator(); |
1882 | 1882 | ||
1883 | mActionConfigKAddressbook->plug( settingsMenu ); | 1883 | mActionConfigKAddressbook->plug( settingsMenu ); |
1884 | 1884 | ||
1885 | if ( mIsPart ) { | 1885 | if ( mIsPart ) { |
1886 | mActionConfigShortcuts->plug( settingsMenu ); | 1886 | mActionConfigShortcuts->plug( settingsMenu ); |
1887 | mActionConfigureToolbars->plug( settingsMenu ); | 1887 | mActionConfigureToolbars->plug( settingsMenu ); |
1888 | 1888 | ||
1889 | } else { | 1889 | } else { |
1890 | mActionKeyBindings->plug( settingsMenu ); | 1890 | mActionKeyBindings->plug( settingsMenu ); |
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | settingsMenu->insertSeparator(); | 1893 | settingsMenu->insertSeparator(); |
1894 | 1894 | ||
1895 | mActionJumpBar->plug( settingsMenu ); | 1895 | mActionJumpBar->plug( settingsMenu ); |
1896 | mActionDetails->plug( settingsMenu ); | 1896 | mActionDetails->plug( settingsMenu ); |
1897 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 1897 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1898 | mActionDetails->plug( tb ); | 1898 | mActionDetails->plug( tb ); |
1899 | settingsMenu->insertSeparator(); | 1899 | settingsMenu->insertSeparator(); |
1900 | 1900 | ||
1901 | mActionWhoAmI->plug( settingsMenu ); | 1901 | mActionWhoAmI->plug( settingsMenu ); |
1902 | mActionCategories->plug( settingsMenu ); | 1902 | mActionCategories->plug( settingsMenu ); |
1903 | 1903 | ||
1904 | mActionLicence->plug( helpMenu ); | 1904 | mActionLicence->plug( helpMenu ); |
1905 | mActionFaq->plug( helpMenu ); | 1905 | mActionFaq->plug( helpMenu ); |
1906 | mActionAboutKAddressbook->plug( helpMenu ); | 1906 | mActionAboutKAddressbook->plug( helpMenu ); |
1907 | 1907 | ||
1908 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 1908 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1909 | 1909 | ||
1910 | mActionSave->plug( tb ); | 1910 | mActionSave->plug( tb ); |
1911 | mViewManager->getFilterAction()->plug ( tb); | 1911 | mViewManager->getFilterAction()->plug ( tb); |
1912 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 1912 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1913 | mActionUndo->plug( tb ); | 1913 | mActionUndo->plug( tb ); |
1914 | mActionDelete->plug( tb ); | 1914 | mActionDelete->plug( tb ); |
1915 | mActionRedo->plug( tb ); | 1915 | mActionRedo->plug( tb ); |
1916 | } | 1916 | } |
1917 | } | 1917 | } |
1918 | //mActionQuit->plug ( tb ); | 1918 | //mActionQuit->plug ( tb ); |
1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1919 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1920 | 1920 | ||
1921 | //US link the searchwidget first to this. | 1921 | //US link the searchwidget first to this. |
1922 | // The real linkage to the toolbar happens later. | 1922 | // The real linkage to the toolbar happens later. |
1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1923 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1924 | //US tb->insertItem( mIncSearchWidget ); | 1924 | //US tb->insertItem( mIncSearchWidget ); |
1925 | /*US | 1925 | /*US |
1926 | mIncSearchWidget = new IncSearchWidget( tb ); | 1926 | mIncSearchWidget = new IncSearchWidget( tb ); |
1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1927 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1928 | SLOT( incrementalSearch( const QString& ) ) ); | 1928 | SLOT( incrementalSearch( const QString& ) ) ); |
1929 | 1929 | ||
1930 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1930 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1931 | 1931 | ||
1932 | //US topLayout->addWidget( mJumpButtonBar ); | 1932 | //US topLayout->addWidget( mJumpButtonBar ); |
1933 | this->layout()->add( mJumpButtonBar ); | 1933 | this->layout()->add( mJumpButtonBar ); |
1934 | */ | 1934 | */ |
1935 | 1935 | ||
1936 | #endif //KAB_EMBEDDED | 1936 | #endif //KAB_EMBEDDED |
1937 | } | 1937 | } |
1938 | void KABCore::showLicence() | 1938 | void KABCore::showLicence() |
1939 | { | 1939 | { |
1940 | KApplication::showLicence(); | 1940 | KApplication::showLicence(); |
1941 | } | 1941 | } |
1942 | void KABCore::removeVoice() | 1942 | void KABCore::removeVoice() |
1943 | { | 1943 | { |
1944 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 1944 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
1945 | return; | 1945 | return; |
1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 1946 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
1947 | KABC::Addressee::List::Iterator it; | 1947 | KABC::Addressee::List::Iterator it; |
1948 | for ( it = list.begin(); it != list.end(); ++it ) { | 1948 | for ( it = list.begin(); it != list.end(); ++it ) { |
1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); | 1949 | PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); |
1950 | PhoneNumber::List::Iterator phoneIt; | 1950 | PhoneNumber::List::Iterator phoneIt; |
1951 | bool found = false; | 1951 | bool found = false; |
1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 1952 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 1953 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 1954 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 1955 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
1956 | (*it).insertPhoneNumber( (*phoneIt) ); | 1956 | (*it).insertPhoneNumber( (*phoneIt) ); |
1957 | found = true; | 1957 | found = true; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
1960 | 1960 | ||
1961 | } | 1961 | } |
1962 | if ( found ) | 1962 | if ( found ) |
1963 | contactModified((*it) ); | 1963 | contactModified((*it) ); |
1964 | } | 1964 | } |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | 1967 | ||
1968 | 1968 | ||
1969 | void KABCore::clipboardDataChanged() | 1969 | void KABCore::clipboardDataChanged() |
1970 | { | 1970 | { |
1971 | 1971 | ||
1972 | if ( mReadWrite ) | 1972 | if ( mReadWrite ) |
1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1973 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1974 | 1974 | ||
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | void KABCore::updateActionMenu() | 1977 | void KABCore::updateActionMenu() |
1978 | { | 1978 | { |
1979 | UndoStack *undo = UndoStack::instance(); | 1979 | UndoStack *undo = UndoStack::instance(); |
1980 | RedoStack *redo = RedoStack::instance(); | 1980 | RedoStack *redo = RedoStack::instance(); |
1981 | 1981 | ||
1982 | if ( undo->isEmpty() ) | 1982 | if ( undo->isEmpty() ) |
1983 | mActionUndo->setText( i18n( "Undo" ) ); | 1983 | mActionUndo->setText( i18n( "Undo" ) ); |
1984 | else | 1984 | else |
1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1985 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1986 | 1986 | ||
1987 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1987 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1988 | 1988 | ||
1989 | if ( !redo->top() ) | 1989 | if ( !redo->top() ) |
1990 | mActionRedo->setText( i18n( "Redo" ) ); | 1990 | mActionRedo->setText( i18n( "Redo" ) ); |
1991 | else | 1991 | else |
1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1992 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1993 | 1993 | ||
1994 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1994 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | void KABCore::configureKeyBindings() | 1997 | void KABCore::configureKeyBindings() |
1998 | { | 1998 | { |
1999 | #ifndef KAB_EMBEDDED | 1999 | #ifndef KAB_EMBEDDED |
2000 | KKeyDialog::configure( actionCollection(), true ); | 2000 | KKeyDialog::configure( actionCollection(), true ); |
2001 | #else //KAB_EMBEDDED | 2001 | #else //KAB_EMBEDDED |
2002 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2002 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2003 | #endif //KAB_EMBEDDED | 2003 | #endif //KAB_EMBEDDED |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | #ifdef KAB_EMBEDDED | 2006 | #ifdef KAB_EMBEDDED |
2007 | void KABCore::configureResources() | 2007 | void KABCore::configureResources() |
2008 | { | 2008 | { |
2009 | KRES::KCMKResources dlg( this, "" , 0 ); | 2009 | KRES::KCMKResources dlg( this, "" , 0 ); |
2010 | 2010 | ||
2011 | if ( !dlg.exec() ) | 2011 | if ( !dlg.exec() ) |
2012 | return; | 2012 | return; |
2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2013 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2014 | } | 2014 | } |
2015 | #endif //KAB_EMBEDDED | 2015 | #endif //KAB_EMBEDDED |
2016 | 2016 | ||
2017 | 2017 | ||
2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2018 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2019 | * for the attendees list of an event. | 2019 | * for the attendees list of an event. |
2020 | */ | 2020 | */ |
2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2021 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2022 | { | 2022 | { |
2023 | QStringList nameList; | 2023 | QStringList nameList; |
2024 | QStringList emailList; | 2024 | QStringList emailList; |
2025 | QStringList uidList; | 2025 | QStringList uidList; |
2026 | 2026 | ||
2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2027 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2028 | uint i=0; | 2028 | uint i=0; |
2029 | for (i=0; i < list.count(); i++) | 2029 | for (i=0; i < list.count(); i++) |
2030 | { | 2030 | { |
2031 | nameList.append(list[i].realName()); | 2031 | nameList.append(list[i].realName()); |
2032 | emailList.append(list[i].preferredEmail()); | 2032 | emailList.append(list[i].preferredEmail()); |
2033 | uidList.append(list[i].uid()); | 2033 | uidList.append(list[i].uid()); |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2036 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2037 | 2037 | ||
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2041 | */ | 2041 | */ |
2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2043 | { | 2043 | { |
2044 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2044 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2045 | 2045 | ||
2046 | QString foundUid = QString::null; | 2046 | QString foundUid = QString::null; |
2047 | if ( ! uid.isEmpty() ) { | 2047 | if ( ! uid.isEmpty() ) { |
2048 | Addressee adrr = mAddressBook->findByUid( uid ); | 2048 | Addressee adrr = mAddressBook->findByUid( uid ); |
2049 | if ( !adrr.isEmpty() ) { | 2049 | if ( !adrr.isEmpty() ) { |
2050 | foundUid = uid; | 2050 | foundUid = uid; |
2051 | } | ||
2051 | if ( email == "sendbacklist" ) { | 2052 | if ( email == "sendbacklist" ) { |
2053 | qDebug("ssssssssssssssssssssssend "); | ||
2052 | QStringList nameList; | 2054 | QStringList nameList; |
2053 | QStringList emailList; | 2055 | QStringList emailList; |
2054 | QStringList uidList; | 2056 | QStringList uidList; |
2055 | nameList.append(adrr.realName()); | 2057 | nameList.append(adrr.realName()); |
2056 | emailList = adrr.emails(); | 2058 | emailList = adrr.emails(); |
2057 | uidList.append( adrr.preferredEmail()); | 2059 | uidList.append( adrr.preferredEmail()); |
2058 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2060 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2061 | return; | ||
2059 | } | 2062 | } |
2060 | } | 2063 | |
2061 | } | 2064 | } |
2062 | 2065 | ||
2063 | if ( email == "sendback" ) | 2066 | if ( email == "sendback" ) |
2064 | return; | 2067 | return; |
2065 | if (foundUid.isEmpty()) | 2068 | if (foundUid.isEmpty()) |
2066 | { | 2069 | { |
2067 | //find the uid of the person first | 2070 | //find the uid of the person first |
2068 | Addressee::List namelist; | 2071 | Addressee::List namelist; |
2069 | Addressee::List emaillist; | 2072 | Addressee::List emaillist; |
2070 | 2073 | ||
2071 | if (!name.isEmpty()) | 2074 | if (!name.isEmpty()) |
2072 | namelist = mAddressBook->findByName( name ); | 2075 | namelist = mAddressBook->findByName( name ); |
2073 | 2076 | ||
2074 | if (!email.isEmpty()) | 2077 | if (!email.isEmpty()) |
2075 | emaillist = mAddressBook->findByEmail( email ); | 2078 | emaillist = mAddressBook->findByEmail( email ); |
2076 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2079 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2077 | //check if we have a match in Namelist and Emaillist | 2080 | //check if we have a match in Namelist and Emaillist |
2078 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2081 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2079 | foundUid = emaillist[0].uid(); | 2082 | foundUid = emaillist[0].uid(); |
2080 | } | 2083 | } |
2081 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2084 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2082 | foundUid = namelist[0].uid(); | 2085 | foundUid = namelist[0].uid(); |
2083 | else | 2086 | else |
2084 | { | 2087 | { |
2085 | for (int i = 0; i < namelist.count(); i++) | 2088 | for (int i = 0; i < namelist.count(); i++) |
2086 | { | 2089 | { |
2087 | for (int j = 0; j < emaillist.count(); j++) | 2090 | for (int j = 0; j < emaillist.count(); j++) |
2088 | { | 2091 | { |
2089 | if (namelist[i] == emaillist[j]) | 2092 | if (namelist[i] == emaillist[j]) |
2090 | { | 2093 | { |
2091 | foundUid = namelist[i].uid(); | 2094 | foundUid = namelist[i].uid(); |
2092 | } | 2095 | } |
2093 | } | 2096 | } |
2094 | } | 2097 | } |
2095 | } | 2098 | } |
2096 | } | 2099 | } |
2097 | else | 2100 | else |
2098 | { | 2101 | { |
2099 | foundUid = uid; | 2102 | foundUid = uid; |
2100 | } | 2103 | } |
2101 | 2104 | ||
2102 | if (!foundUid.isEmpty()) | 2105 | if (!foundUid.isEmpty()) |
2103 | { | 2106 | { |
2104 | 2107 | ||
2105 | // raise Ka/Pi if it is in the background | 2108 | // raise Ka/Pi if it is in the background |
2106 | #ifndef DESKTOP_VERSION | 2109 | #ifndef DESKTOP_VERSION |
2107 | #ifndef KORG_NODCOP | 2110 | #ifndef KORG_NODCOP |
2108 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2111 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2109 | #endif | 2112 | #endif |
2110 | #endif | 2113 | #endif |
2111 | 2114 | ||
2112 | mMainWindow->showMaximized(); | 2115 | mMainWindow->showMaximized(); |
2113 | mMainWindow-> raise(); | 2116 | mMainWindow-> raise(); |
2114 | 2117 | ||
2115 | mViewManager->setSelected( "", false); | 2118 | mViewManager->setSelected( "", false); |
2116 | mViewManager->refreshView( "" ); | 2119 | mViewManager->refreshView( "" ); |
2117 | mViewManager->setSelected( foundUid, true ); | 2120 | mViewManager->setSelected( foundUid, true ); |
2118 | mViewManager->refreshView( foundUid ); | 2121 | mViewManager->refreshView( foundUid ); |
2119 | 2122 | ||
2120 | if ( !mMultipleViewsAtOnce ) | 2123 | if ( !mMultipleViewsAtOnce ) |
2121 | { | 2124 | { |
2122 | setDetailsVisible( true ); | 2125 | setDetailsVisible( true ); |
2123 | mActionDetails->setChecked(true); | 2126 | mActionDetails->setChecked(true); |
2124 | } | 2127 | } |
2125 | } | 2128 | } |
2126 | } | 2129 | } |
2127 | 2130 | ||
2128 | 2131 | ||
2129 | void KABCore::faq() | 2132 | void KABCore::faq() |
2130 | { | 2133 | { |
2131 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2134 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2132 | } | 2135 | } |
2133 | 2136 | ||
2134 | 2137 | ||
2135 | 2138 | ||
2136 | 2139 | ||
2137 | #ifndef KAB_EMBEDDED | 2140 | #ifndef KAB_EMBEDDED |
2138 | #include "kabcore.moc" | 2141 | #include "kabcore.moc" |
2139 | #endif //KAB_EMBEDDED | 2142 | #endif //KAB_EMBEDDED |
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 5f446fa..f7604ad 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,453 +1,459 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
6 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
7 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | 9 | ||
10 | /* OPIE */ | 10 | /* OPIE */ |
11 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
12 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
13 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
14 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
17 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
30 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #ifdef DESKTOP_VERSION | 32 | #ifdef DESKTOP_VERSION |
33 | #include <kabc/addresseedialog.h> | 33 | #include <kabc/addresseedialog.h> |
34 | #else //DESKTOP_VERSION | 34 | #else //DESKTOP_VERSION |
35 | #include <libkdepim/externalapphandler.h> | 35 | #include <libkdepim/externalapphandler.h> |
36 | #endif //DESKTOP_VERSION | 36 | #endif //DESKTOP_VERSION |
37 | 37 | ||
38 | 38 | ||
39 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
40 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
42 | : ComposeMailUI( parent, name, modal, flags ) | 42 | : ComposeMailUI( parent, name, modal, flags ) |
43 | { | 43 | { |
44 | 44 | ||
45 | mPickLineEdit = 0; | 45 | mPickLineEdit = 0; |
46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
48 | settings = s; | 48 | settings = s; |
49 | m_replyid = ""; | 49 | m_replyid = ""; |
50 | KConfig config( locateLocal("config", "kabcrc") ); | 50 | KConfig config( locateLocal("config", "kabcrc") ); |
51 | config.setGroup( "General" ); | 51 | config.setGroup( "General" ); |
52 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 52 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
53 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 53 | if ( whoami_uid.isEmpty() ) { |
54 | QMessageBox::information( 0, tr( "Hint" ), | ||
55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | ||
56 | tr( "Ok" ) ); | ||
57 | |||
58 | } else | ||
59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | ||
54 | #ifdef DESKTOP_VERSION | 60 | #ifdef DESKTOP_VERSION |
55 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
56 | QStringList mails = con.emails(); | 62 | QStringList mails = con.emails(); |
57 | QString defmail = con.preferredEmail(); | 63 | QString defmail = con.preferredEmail(); |
58 | if ( mails.count() == 0) | 64 | if ( mails.count() == 0) |
59 | QMessageBox::information( 0, tr( "Hint" ), | 65 | QMessageBox::information( 0, tr( "Hint" ), |
60 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
61 | tr( "Ok" ) ); | 67 | tr( "Ok" ) ); |
62 | if (defmail.length()!=0) { | 68 | if (defmail.length()!=0) { |
63 | fromBox->insertItem(defmail); | 69 | fromBox->insertItem(defmail); |
64 | } | 70 | } |
65 | QStringList::ConstIterator sit = mails.begin(); | 71 | QStringList::ConstIterator sit = mails.begin(); |
66 | for (;sit!=mails.end();++sit) { | 72 | for (;sit!=mails.end();++sit) { |
67 | if ( (*sit)==defmail) | 73 | if ( (*sit)==defmail) |
68 | continue; | 74 | continue; |
69 | fromBox->insertItem((*sit)); | 75 | fromBox->insertItem((*sit)); |
70 | } | 76 | } |
71 | senderNameEdit->setText(con.formattedName()); | 77 | senderNameEdit->setText(con.formattedName()); |
72 | #endif | 78 | #endif |
73 | Config cfg( "mail" ); | 79 | Config cfg( "mail" ); |
74 | cfg.setGroup( "Compose" ); | 80 | cfg.setGroup( "Compose" ); |
75 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
76 | 82 | ||
77 | attList->addColumn( tr( "Name" ) ); | 83 | attList->addColumn( tr( "Name" ) ); |
78 | attList->addColumn( tr( "Size" ) ); | 84 | attList->addColumn( tr( "Size" ) ); |
79 | 85 | ||
80 | QList<Account> accounts = settings->getAccounts(); | 86 | QList<Account> accounts = settings->getAccounts(); |
81 | 87 | ||
82 | Account *it; | 88 | Account *it; |
83 | for ( it = accounts.first(); it; it = accounts.next() ) { | 89 | for ( it = accounts.first(); it; it = accounts.next() ) { |
84 | if ( it->getType()==MAILLIB::A_SMTP ) { | 90 | if ( it->getType()==MAILLIB::A_SMTP ) { |
85 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
86 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 92 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
87 | smtpAccounts.append( smtp ); | 93 | smtpAccounts.append( smtp ); |
88 | } | 94 | } |
89 | } | 95 | } |
90 | if ( smtpAccounts.count() > 0 ) { | 96 | if ( smtpAccounts.count() > 0 ) { |
91 | fillValues( smtpAccountBox->currentItem() ); | 97 | fillValues( smtpAccountBox->currentItem() ); |
92 | } else { | 98 | } else { |
93 | QMessageBox::information( 0, tr( "Problem" ), | 99 | QMessageBox::information( 0, tr( "Problem" ), |
94 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
95 | tr( "Ok" ) ); | 101 | tr( "Ok" ) ); |
96 | return; | 102 | return; |
97 | } | 103 | } |
98 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
99 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
100 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
101 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
102 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
103 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
104 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
105 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
106 | mMail = 0; | 112 | mMail = 0; |
107 | warnAttach = true; | 113 | warnAttach = true; |
108 | 114 | ||
109 | } | 115 | } |
110 | 116 | ||
111 | 117 | ||
112 | 118 | ||
113 | void ComposeMail::saveAsDraft() | 119 | void ComposeMail::saveAsDraft() |
114 | { | 120 | { |
115 | 121 | ||
116 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
117 | mail->setMail(fromBox->currentText()); | 123 | mail->setMail(fromBox->currentText()); |
118 | mail->setTo( toLine->text() ); | 124 | mail->setTo( toLine->text() ); |
119 | mail->setName(senderNameEdit->text()); | 125 | mail->setName(senderNameEdit->text()); |
120 | mail->setCC( ccLine->text() ); | 126 | mail->setCC( ccLine->text() ); |
121 | mail->setBCC( bccLine->text() ); | 127 | mail->setBCC( bccLine->text() ); |
122 | mail->setReply( replyLine->text() ); | 128 | mail->setReply( replyLine->text() ); |
123 | mail->setSubject( subjectLine->text() ); | 129 | mail->setSubject( subjectLine->text() ); |
124 | if (!m_replyid.isEmpty()) { | 130 | if (!m_replyid.isEmpty()) { |
125 | QStringList ids; | 131 | QStringList ids; |
126 | ids.append(m_replyid); | 132 | ids.append(m_replyid); |
127 | mail->setInreply(ids); | 133 | mail->setInreply(ids); |
128 | } | 134 | } |
129 | QString txt = message->text(); | 135 | QString txt = message->text(); |
130 | if ( !sigMultiLine->text().isEmpty() ) { | 136 | if ( !sigMultiLine->text().isEmpty() ) { |
131 | txt.append( "\n--\n" ); | 137 | txt.append( "\n--\n" ); |
132 | txt.append( sigMultiLine->text() ); | 138 | txt.append( sigMultiLine->text() ); |
133 | } | 139 | } |
134 | mail->setMessage( txt ); | 140 | mail->setMessage( txt ); |
135 | 141 | ||
136 | /* only use the default drafts folder name! */ | 142 | /* only use the default drafts folder name! */ |
137 | Storemail wrapper(AbstractMail::draftFolder()); | 143 | Storemail wrapper(AbstractMail::draftFolder()); |
138 | wrapper.storeMail(mail); | 144 | wrapper.storeMail(mail); |
139 | 145 | ||
140 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 146 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
141 | /* attachments we will ignore! */ | 147 | /* attachments we will ignore! */ |
142 | if ( it != 0 ) { | 148 | if ( it != 0 ) { |
143 | if ( warnAttach ) | 149 | if ( warnAttach ) |
144 | QMessageBox::warning(0,tr("Store message"), | 150 | QMessageBox::warning(0,tr("Store message"), |
145 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 151 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
146 | warnAttach = false; | 152 | warnAttach = false; |
147 | } | 153 | } |
148 | setStatus( tr("Mail saved as draft!") ); | 154 | setStatus( tr("Mail saved as draft!") ); |
149 | } | 155 | } |
150 | void ComposeMail::clearStatus() | 156 | void ComposeMail::clearStatus() |
151 | { | 157 | { |
152 | topLevelWidget()->setCaption( tr("Compose mail") ); | 158 | topLevelWidget()->setCaption( tr("Compose mail") ); |
153 | } | 159 | } |
154 | void ComposeMail::setStatus( QString status ) | 160 | void ComposeMail::setStatus( QString status ) |
155 | { | 161 | { |
156 | topLevelWidget()->setCaption( status ); | 162 | topLevelWidget()->setCaption( status ); |
157 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 163 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
158 | } | 164 | } |
159 | void ComposeMail::pickAddress( ) | 165 | void ComposeMail::pickAddress( ) |
160 | { | 166 | { |
161 | 167 | ||
162 | QLineEdit *line = mPickLineEdit; | 168 | QLineEdit *line = mPickLineEdit; |
163 | if ( line == 0 ) | 169 | if ( line == 0 ) |
164 | return; | 170 | return; |
165 | #ifdef DESKTOP_VERSION | 171 | #ifdef DESKTOP_VERSION |
166 | //qDebug(" ComposeMail::pickAddress "); | 172 | //qDebug(" ComposeMail::pickAddress "); |
167 | QString names ;//= AddressPicker::getNames(); | 173 | QString names ;//= AddressPicker::getNames(); |
168 | 174 | ||
169 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 175 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
170 | uint i=0; | 176 | uint i=0; |
171 | for (i=0; i < list.count(); i++) { | 177 | for (i=0; i < list.count(); i++) { |
172 | if ( !list[i].preferredEmail().isEmpty()) { | 178 | if ( !list[i].preferredEmail().isEmpty()) { |
173 | if ( ! names.isEmpty() ) | 179 | if ( ! names.isEmpty() ) |
174 | names+= ","; | 180 | names+= ","; |
175 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 181 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
176 | 182 | ||
177 | } | 183 | } |
178 | } | 184 | } |
179 | 185 | ||
180 | 186 | ||
181 | if ( line->text().isEmpty() ) { | 187 | if ( line->text().isEmpty() ) { |
182 | line->setText( names ); | 188 | line->setText( names ); |
183 | } else if ( !names.isEmpty() ) { | 189 | } else if ( !names.isEmpty() ) { |
184 | line->setText( line->text() + ", " + names ); | 190 | line->setText( line->text() + ", " + names ); |
185 | } | 191 | } |
186 | #else | 192 | #else |
187 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | 193 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); |
188 | // the result should now arrive through method insertAttendees | 194 | // the result should now arrive through method insertAttendees |
189 | #endif | 195 | #endif |
190 | } | 196 | } |
191 | //the map includes name/email pairs, that comes from Ka/Pi | 197 | //the map includes name/email pairs, that comes from Ka/Pi |
192 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 198 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
193 | { | 199 | { |
194 | qDebug("ComposeMail::insertAttendees "); | 200 | qDebug("ComposeMail::insertAttendees "); |
195 | raise(); | 201 | raise(); |
196 | 202 | ||
197 | if ( mPickLineEdit == 0 ) { //whoami received | 203 | if ( mPickLineEdit == 0 ) { //whoami received |
198 | 204 | ||
199 | QString defmail = uidList[0]; | 205 | QString defmail = uidList[0]; |
200 | if ( emailList.count() == 0 ) | 206 | if ( emailList.count() == 0 ) |
201 | QMessageBox::information( 0, tr( "Hint" ), | 207 | QMessageBox::information( 0, tr( "Hint" ), |
202 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 208 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
203 | tr( "Ok" ) ); | 209 | tr( "Ok" ) ); |
204 | if (defmail.length()!=0) { | 210 | if (defmail.length()!=0) { |
205 | fromBox->insertItem(defmail); | 211 | fromBox->insertItem(defmail); |
206 | } | 212 | } |
207 | QStringList::ConstIterator sit = emailList.begin(); | 213 | QStringList::ConstIterator sit = emailList.begin(); |
208 | int pref = 0; | 214 | int pref = 0; |
209 | for (;sit!=emailList.end();++sit) { | 215 | for (;sit!=emailList.end();++sit) { |
210 | if ( (*sit)==defmail) | 216 | if ( (*sit)==defmail) |
211 | continue; | 217 | continue; |
212 | fromBox->insertItem((*sit)); | 218 | fromBox->insertItem((*sit)); |
213 | } | 219 | } |
214 | senderNameEdit->setText(nameList[0]); | 220 | senderNameEdit->setText(nameList[0]); |
215 | return; | 221 | return; |
216 | } | 222 | } |
217 | QString names ; | 223 | QString names ; |
218 | QLineEdit *line = mPickLineEdit; | 224 | QLineEdit *line = mPickLineEdit; |
219 | if (uid == this->name()) | 225 | if (uid == this->name()) |
220 | { | 226 | { |
221 | for ( int i = 0; i < nameList.count(); i++) | 227 | for ( int i = 0; i < nameList.count(); i++) |
222 | { | 228 | { |
223 | QString _name = nameList[i]; | 229 | QString _name = nameList[i]; |
224 | QString _email = emailList[i]; | 230 | QString _email = emailList[i]; |
225 | QString _uid = uidList[i]; | 231 | QString _uid = uidList[i]; |
226 | if ( ! _email.isEmpty() ) { | 232 | if ( ! _email.isEmpty() ) { |
227 | if ( ! names.isEmpty() ) | 233 | if ( ! names.isEmpty() ) |
228 | names+= ","; | 234 | names+= ","; |
229 | names+= "\""+_name +"\"<" +_email +">"; | 235 | names+= "\""+_name +"\"<" +_email +">"; |
230 | } | 236 | } |
231 | } | 237 | } |
232 | } | 238 | } |
233 | if ( line->text().isEmpty() ) { | 239 | if ( line->text().isEmpty() ) { |
234 | line->setText( names ); | 240 | line->setText( names ); |
235 | } else if ( !names.isEmpty() ) { | 241 | } else if ( !names.isEmpty() ) { |
236 | line->setText( line->text() + ", " + names ); | 242 | line->setText( line->text() + ", " + names ); |
237 | } | 243 | } |
238 | } | 244 | } |
239 | 245 | ||
240 | void ComposeMail::setTo( const QString & to ) | 246 | void ComposeMail::setTo( const QString & to ) |
241 | { | 247 | { |
242 | toLine->setText( to ); | 248 | toLine->setText( to ); |
243 | } | 249 | } |
244 | 250 | ||
245 | void ComposeMail::setSubject( const QString & subject ) | 251 | void ComposeMail::setSubject( const QString & subject ) |
246 | { | 252 | { |
247 | subjectLine->setText( subject ); | 253 | subjectLine->setText( subject ); |
248 | } | 254 | } |
249 | 255 | ||
250 | void ComposeMail::setInReplyTo( const QString & messageId ) | 256 | void ComposeMail::setInReplyTo( const QString & messageId ) |
251 | { | 257 | { |
252 | m_replyid = messageId; | 258 | m_replyid = messageId; |
253 | } | 259 | } |
254 | 260 | ||
255 | void ComposeMail::setMessage( const QString & text ) | 261 | void ComposeMail::setMessage( const QString & text ) |
256 | { | 262 | { |
257 | message->setText( text ); | 263 | message->setText( text ); |
258 | } | 264 | } |
259 | 265 | ||
260 | 266 | ||
261 | void ComposeMail::pickAddressTo() | 267 | void ComposeMail::pickAddressTo() |
262 | { | 268 | { |
263 | mPickLineEdit = toLine; | 269 | mPickLineEdit = toLine; |
264 | pickAddress( ); | 270 | pickAddress( ); |
265 | } | 271 | } |
266 | 272 | ||
267 | void ComposeMail::pickAddressCC() | 273 | void ComposeMail::pickAddressCC() |
268 | { | 274 | { |
269 | mPickLineEdit = ccLine; | 275 | mPickLineEdit = ccLine; |
270 | pickAddress( ); | 276 | pickAddress( ); |
271 | } | 277 | } |
272 | 278 | ||
273 | void ComposeMail::pickAddressBCC() | 279 | void ComposeMail::pickAddressBCC() |
274 | { | 280 | { |
275 | mPickLineEdit = bccLine; | 281 | mPickLineEdit = bccLine; |
276 | pickAddress( ); | 282 | pickAddress( ); |
277 | } | 283 | } |
278 | 284 | ||
279 | void ComposeMail::pickAddressReply() | 285 | void ComposeMail::pickAddressReply() |
280 | { | 286 | { |
281 | mPickLineEdit = replyLine; | 287 | mPickLineEdit = replyLine; |
282 | pickAddress( ); | 288 | pickAddress( ); |
283 | } | 289 | } |
284 | 290 | ||
285 | void ComposeMail::fillValues( int ) | 291 | void ComposeMail::fillValues( int ) |
286 | { | 292 | { |
287 | #if 0 | 293 | #if 0 |
288 | SMTPaccount *smtp = smtpAccounts.at( current ); | 294 | SMTPaccount *smtp = smtpAccounts.at( current ); |
289 | ccLine->clear(); | 295 | ccLine->clear(); |
290 | if ( smtp->getUseCC() ) { | 296 | if ( smtp->getUseCC() ) { |
291 | ccLine->setText( smtp->getCC() ); | 297 | ccLine->setText( smtp->getCC() ); |
292 | } | 298 | } |
293 | bccLine->clear(); | 299 | bccLine->clear(); |
294 | if ( smtp->getUseBCC() ) { | 300 | if ( smtp->getUseBCC() ) { |
295 | bccLine->setText( smtp->getBCC() ); | 301 | bccLine->setText( smtp->getBCC() ); |
296 | } | 302 | } |
297 | replyLine->clear(); | 303 | replyLine->clear(); |
298 | if ( smtp->getUseReply() ) { | 304 | if ( smtp->getUseReply() ) { |
299 | replyLine->setText( smtp->getReply() ); | 305 | replyLine->setText( smtp->getReply() ); |
300 | } | 306 | } |
301 | sigMultiLine->setText( smtp->getSignature() ); | 307 | sigMultiLine->setText( smtp->getSignature() ); |
302 | #endif | 308 | #endif |
303 | } | 309 | } |
304 | 310 | ||
305 | void ComposeMail::slotAdjustColumns() | 311 | void ComposeMail::slotAdjustColumns() |
306 | { | 312 | { |
307 | int currPage = tabWidget->currentPageIndex(); | 313 | int currPage = tabWidget->currentPageIndex(); |
308 | 314 | ||
309 | tabWidget->showPage( attachTab ); | 315 | tabWidget->showPage( attachTab ); |
310 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 316 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
311 | attList->setColumnWidth( 1, 80 ); | 317 | attList->setColumnWidth( 1, 80 ); |
312 | 318 | ||
313 | tabWidget->setCurrentPage( currPage ); | 319 | tabWidget->setCurrentPage( currPage ); |
314 | } | 320 | } |
315 | 321 | ||
316 | void ComposeMail::addAttachment() | 322 | void ComposeMail::addAttachment() |
317 | { | 323 | { |
318 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 324 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
319 | if ( !lnk.isEmpty() ) { | 325 | if ( !lnk.isEmpty() ) { |
320 | Attachment *att = new Attachment( lnk ); | 326 | Attachment *att = new Attachment( lnk ); |
321 | (void) new AttachViewItem( attList, att ); | 327 | (void) new AttachViewItem( attList, att ); |
322 | } | 328 | } |
323 | } | 329 | } |
324 | 330 | ||
325 | void ComposeMail::removeAttachment() | 331 | void ComposeMail::removeAttachment() |
326 | { | 332 | { |
327 | if ( !attList->currentItem() ) { | 333 | if ( !attList->currentItem() ) { |
328 | QMessageBox::information( this, tr( "Error" ), | 334 | QMessageBox::information( this, tr( "Error" ), |
329 | tr( "<p>Please select a File.</p>" ), | 335 | tr( "<p>Please select a File.</p>" ), |
330 | tr( "Ok" ) ); | 336 | tr( "Ok" ) ); |
331 | } else { | 337 | } else { |
332 | attList->takeItem( attList->currentItem() ); | 338 | attList->takeItem( attList->currentItem() ); |
333 | } | 339 | } |
334 | } | 340 | } |
335 | 341 | ||
336 | void ComposeMail::accept() | 342 | void ComposeMail::accept() |
337 | { | 343 | { |
338 | if ( smtpAccountBox->count() == 0 ) { | 344 | if ( smtpAccountBox->count() == 0 ) { |
339 | 345 | ||
340 | reject(); | 346 | reject(); |
341 | return; | 347 | return; |
342 | } | 348 | } |
343 | 349 | ||
344 | if (! checkBoxLater->isChecked() ) { | 350 | if (! checkBoxLater->isChecked() ) { |
345 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 351 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
346 | tr("Send this message?"), | 352 | tr("Send this message?"), |
347 | tr("Yes"), | 353 | tr("Yes"), |
348 | tr("Cancel")); | 354 | tr("Cancel")); |
349 | 355 | ||
350 | if (yesno == 1) { | 356 | if (yesno == 1) { |
351 | return; | 357 | return; |
352 | } | 358 | } |
353 | } | 359 | } |
354 | #if 0 | 360 | #if 0 |
355 | odebug << "Sending Mail with " | 361 | odebug << "Sending Mail with " |
356 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 362 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
357 | #endif | 363 | #endif |
358 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 364 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
359 | 365 | ||
360 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 366 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
361 | mail->setMail(fromBox->currentText()); | 367 | mail->setMail(fromBox->currentText()); |
362 | 368 | ||
363 | if ( !toLine->text().isEmpty() ) { | 369 | if ( !toLine->text().isEmpty() ) { |
364 | mail->setTo( toLine->text() ); | 370 | mail->setTo( toLine->text() ); |
365 | } else { | 371 | } else { |
366 | QMessageBox::warning(0,tr("Sending mail"), | 372 | QMessageBox::warning(0,tr("Sending mail"), |
367 | tr("No Receiver spezified" ) ); | 373 | tr("No Receiver spezified" ) ); |
368 | return; | 374 | return; |
369 | } | 375 | } |
370 | 376 | ||
371 | mail->setName(senderNameEdit->text()); | 377 | mail->setName(senderNameEdit->text()); |
372 | mail->setCC( ccLine->text() ); | 378 | mail->setCC( ccLine->text() ); |
373 | mail->setBCC( bccLine->text() ); | 379 | mail->setBCC( bccLine->text() ); |
374 | mail->setReply( replyLine->text() ); | 380 | mail->setReply( replyLine->text() ); |
375 | mail->setSubject( subjectLine->text() ); | 381 | mail->setSubject( subjectLine->text() ); |
376 | if (!m_replyid.isEmpty()) { | 382 | if (!m_replyid.isEmpty()) { |
377 | QStringList ids; | 383 | QStringList ids; |
378 | ids.append(m_replyid); | 384 | ids.append(m_replyid); |
379 | mail->setInreply(ids); | 385 | mail->setInreply(ids); |
380 | } | 386 | } |
381 | QString txt = message->text(); | 387 | QString txt = message->text(); |
382 | if ( !sigMultiLine->text().isEmpty() ) { | 388 | if ( !sigMultiLine->text().isEmpty() ) { |
383 | txt.append( "\n--\n" ); | 389 | txt.append( "\n--\n" ); |
384 | txt.append( sigMultiLine->text() ); | 390 | txt.append( sigMultiLine->text() ); |
385 | } | 391 | } |
386 | mail->setMessage( txt ); | 392 | mail->setMessage( txt ); |
387 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 393 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
388 | while ( it != 0 ) { | 394 | while ( it != 0 ) { |
389 | mail->addAttachment( it->getAttachment() ); | 395 | mail->addAttachment( it->getAttachment() ); |
390 | it = (AttachViewItem *) it->nextSibling(); | 396 | it = (AttachViewItem *) it->nextSibling(); |
391 | } | 397 | } |
392 | 398 | ||
393 | SMTPwrapper wrapper( smtp ); | 399 | SMTPwrapper wrapper( smtp ); |
394 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 400 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
395 | setStatus( tr ("Mail sent")); | 401 | setStatus( tr ("Mail sent")); |
396 | else { | 402 | else { |
397 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 403 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
398 | return; | 404 | return; |
399 | } | 405 | } |
400 | 406 | ||
401 | 407 | ||
402 | QDialog::accept(); | 408 | QDialog::accept(); |
403 | } | 409 | } |
404 | 410 | ||
405 | void ComposeMail::reject() | 411 | void ComposeMail::reject() |
406 | { | 412 | { |
407 | //qDebug("ComposeMail::reject() "); | 413 | //qDebug("ComposeMail::reject() "); |
408 | int yesno = QMessageBox::warning(0,tr("Store message?"), | 414 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
409 | tr("Store message into drafts?\n"), | 415 | tr("Store message into drafts?\n"), |
410 | tr("Yes"), | 416 | tr("Yes"), |
411 | tr("No")); | 417 | tr("No")); |
412 | 418 | ||
413 | //qDebug("button %d ", yesno); | 419 | //qDebug("button %d ", yesno); |
414 | if (yesno == 0) { | 420 | if (yesno == 0) { |
415 | if ( toLine->text().isEmpty() ) { | 421 | if ( toLine->text().isEmpty() ) { |
416 | QMessageBox::warning(0,tr("Sending mail"), | 422 | QMessageBox::warning(0,tr("Sending mail"), |
417 | tr("No Receiver spezified" ) ); | 423 | tr("No Receiver spezified" ) ); |
418 | return; | 424 | return; |
419 | } | 425 | } |
420 | saveAsDraft(); | 426 | saveAsDraft(); |
421 | } | 427 | } |
422 | if (yesno == 2) { | 428 | if (yesno == 2) { |
423 | qDebug("return "); | 429 | qDebug("return "); |
424 | return; | 430 | return; |
425 | } | 431 | } |
426 | QDialog::reject(); | 432 | QDialog::reject(); |
427 | } | 433 | } |
428 | 434 | ||
429 | ComposeMail::~ComposeMail() | 435 | ComposeMail::~ComposeMail() |
430 | { | 436 | { |
431 | } | 437 | } |
432 | 438 | ||
433 | void ComposeMail::reEditMail(const RecMailP¤t) | 439 | void ComposeMail::reEditMail(const RecMailP¤t) |
434 | { | 440 | { |
435 | RecMailP data = current; | 441 | RecMailP data = current; |
436 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 442 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
437 | subjectLine->setText( data->getSubject()); | 443 | subjectLine->setText( data->getSubject()); |
438 | toLine->setText(data->To().join(",")); | 444 | toLine->setText(data->To().join(",")); |
439 | ccLine->setText(data->CC().join(",")); | 445 | ccLine->setText(data->CC().join(",")); |
440 | bccLine->setText(data->Bcc().join(",")); | 446 | bccLine->setText(data->Bcc().join(",")); |
441 | replyLine->setText(data->Replyto()); | 447 | replyLine->setText(data->Replyto()); |
442 | } | 448 | } |
443 | 449 | ||
444 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 450 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
445 | : QListViewItem( parent ) | 451 | : QListViewItem( parent ) |
446 | { | 452 | { |
447 | attachment = att; | 453 | attachment = att; |
448 | if ( !attachment->getPixmap().isNull() ) | 454 | if ( !attachment->getPixmap().isNull() ) |
449 | setPixmap( 0,attachment->getPixmap() ); | 455 | setPixmap( 0,attachment->getPixmap() ); |
450 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 456 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
451 | setText( 1, QString::number( att->getSize() ) ); | 457 | setText( 1, QString::number( att->getSize() ) ); |
452 | } | 458 | } |
453 | 459 | ||
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 6100097..5ba32b6 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,1014 +1,1013 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@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 | /* | 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 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | 39 | #else |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | 46 | ||
47 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
48 | 48 | ||
49 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
50 | 50 | ||
51 | /********************************************************************************* | 51 | /********************************************************************************* |
52 | * | 52 | * |
53 | ********************************************************************************/ | 53 | ********************************************************************************/ |
54 | 54 | ||
55 | 55 | ||
56 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 56 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
57 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 57 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
58 | { | 58 | { |
59 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 59 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
60 | if (_usedSourceParameters == 0) | 60 | if (_usedSourceParameters == 0) |
61 | _sourceMessageParameters = "(QString,QString)"; | 61 | _sourceMessageParameters = "(QString,QString)"; |
62 | else if (_usedSourceParameters == 1) | 62 | else if (_usedSourceParameters == 1) |
63 | _sourceMessageParameters = "(QString,QString,QString)"; | 63 | _sourceMessageParameters = "(QString,QString,QString)"; |
64 | else if (_usedSourceParameters == 2) | 64 | else if (_usedSourceParameters == 2) |
65 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 65 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
66 | else if (_usedSourceParameters == 3) | 66 | else if (_usedSourceParameters == 3) |
67 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 67 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
68 | } | 68 | } |
69 | 69 | ||
70 | /*********************************************************************************/ | 70 | /*********************************************************************************/ |
71 | 71 | ||
72 | QCopTransferItem::QCopTransferItem() | 72 | QCopTransferItem::QCopTransferItem() |
73 | { | 73 | { |
74 | } | 74 | } |
75 | 75 | ||
76 | /*********************************************************************************/ | 76 | /*********************************************************************************/ |
77 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 77 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
78 | { | 78 | { |
79 | 79 | ||
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | //sourceMessage passes two parameters: sourceChannel, uid | 81 | //sourceMessage passes two parameters: sourceChannel, uid |
82 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 82 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
83 | 83 | ||
84 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 84 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
85 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 85 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
86 | 86 | ||
87 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 87 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
88 | 88 | ||
89 | e << _sourceChannel << uid; | 89 | e << _sourceChannel << uid; |
90 | 90 | ||
91 | if (_usedSourceParameters == 1) | 91 | if (_usedSourceParameters == 1) |
92 | e << param1; | 92 | e << param1; |
93 | else if (_usedSourceParameters == 2) | 93 | else if (_usedSourceParameters == 2) |
94 | e << param1 << param2; | 94 | e << param1 << param2; |
95 | else if (_usedSourceParameters == 3) | 95 | else if (_usedSourceParameters == 3) |
96 | e << param1 << param2 << param3; | 96 | e << param1 << param2 << param3; |
97 | 97 | ||
98 | qApp->processEvents(); | 98 | qApp->processEvents(); |
99 | 99 | ||
100 | return true; | 100 | return true; |
101 | 101 | ||
102 | #else | 102 | #else |
103 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 103 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
104 | return false; | 104 | return false; |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | /*********************************************************************************/ | 110 | /*********************************************************************************/ |
111 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 111 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
112 | { | 112 | { |
113 | 113 | ||
114 | if (_sourceChannel.isEmpty()) | 114 | if (_sourceChannel.isEmpty()) |
115 | _sourceChannel = sourceChannel; | 115 | _sourceChannel = sourceChannel; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | /*********************************************************************************/ | 119 | /*********************************************************************************/ |
120 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 120 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
121 | { | 121 | { |
122 | 122 | ||
123 | // copied from old mail2 | 123 | // copied from old mail2 |
124 | /* | 124 | /* |
125 | static int ii = 0; | 125 | static int ii = 0; |
126 | 126 | ||
127 | // block second call | 127 | // block second call |
128 | if ( ii < 2 ) { | 128 | if ( ii < 2 ) { |
129 | ++ii; | 129 | ++ii; |
130 | if ( ii > 1 ) { | 130 | if ( ii > 1 ) { |
131 | qDebug("qcop call blocked "); | 131 | qDebug("qcop call blocked "); |
132 | return true; | 132 | return true; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | */ | 135 | */ |
136 | 136 | ||
137 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 137 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
138 | 138 | ||
139 | //we are in the target and get a request from the source | 139 | //we are in the target and get a request from the source |
140 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 140 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
141 | { | 141 | { |
142 | 142 | ||
143 | QDataStream stream( data, IO_ReadOnly ); | 143 | QDataStream stream( data, IO_ReadOnly ); |
144 | 144 | ||
145 | 145 | ||
146 | QString sourceChannel; | 146 | QString sourceChannel; |
147 | QString uid; | 147 | QString uid; |
148 | QString param1; | 148 | QString param1; |
149 | QString param2; | 149 | QString param2; |
150 | QString param3; | 150 | QString param3; |
151 | 151 | ||
152 | stream >> sourceChannel >> uid; | 152 | stream >> sourceChannel >> uid; |
153 | 153 | ||
154 | if (_usedSourceParameters == 0) | 154 | if (_usedSourceParameters == 0) |
155 | { | 155 | { |
156 | emit receivedMessageFromSource(sourceChannel, uid); | 156 | emit receivedMessageFromSource(sourceChannel, uid); |
157 | } | 157 | } |
158 | else if (_usedSourceParameters == 1) | 158 | else if (_usedSourceParameters == 1) |
159 | { | 159 | { |
160 | stream >> param1; | 160 | stream >> param1; |
161 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 161 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
162 | } | 162 | } |
163 | else if (_usedSourceParameters == 2) | 163 | else if (_usedSourceParameters == 2) |
164 | { | 164 | { |
165 | stream >> param1 >> param2; | 165 | stream >> param1 >> param2; |
166 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 166 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
167 | } | 167 | } |
168 | else if (_usedSourceParameters == 3) | 168 | else if (_usedSourceParameters == 3) |
169 | { | 169 | { |
170 | stream >> param1 >> param2 >> param3; | 170 | stream >> param1 >> param2 >> param3; |
171 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | 171 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); |
172 | } | 172 | } |
173 | 173 | ||
174 | return true; | 174 | return true; |
175 | } | 175 | } |
176 | 176 | ||
177 | return false; | 177 | return false; |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | /********************************************************************************* | 181 | /********************************************************************************* |
182 | * | 182 | * |
183 | ********************************************************************************/ | 183 | ********************************************************************************/ |
184 | 184 | ||
185 | 185 | ||
186 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 186 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
187 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 187 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
188 | { | 188 | { |
189 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 189 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
190 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 190 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
191 | } | 191 | } |
192 | 192 | ||
193 | /*********************************************************************************/ | 193 | /*********************************************************************************/ |
194 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 194 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
195 | { | 195 | { |
196 | #ifndef DESKTOP_VERSION | 196 | #ifndef DESKTOP_VERSION |
197 | //targetMessage passes two parameters: uid, map | 197 | //targetMessage passes two parameters: uid, map |
198 | QString targetMessage = _targetMessage + _targetMessageParameters; | 198 | QString targetMessage = _targetMessage + _targetMessageParameters; |
199 | 199 | ||
200 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 200 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
201 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 201 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
202 | 202 | ||
203 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 203 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
204 | //US we need no names in the To field. The emailadresses are enough | 204 | //US we need no names in the To field. The emailadresses are enough |
205 | 205 | ||
206 | e << uid << nameEmailMap; | 206 | e << uid << nameEmailMap; |
207 | 207 | ||
208 | qApp->processEvents(); | 208 | qApp->processEvents(); |
209 | 209 | ||
210 | return true; | 210 | return true; |
211 | 211 | ||
212 | #else | 212 | #else |
213 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 213 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
214 | return false; | 214 | return false; |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | /*********************************************************************************/ | 220 | /*********************************************************************************/ |
221 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 221 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
222 | { | 222 | { |
223 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 223 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
224 | 224 | ||
225 | if (res == false) | 225 | if (res == false) |
226 | { | 226 | { |
227 | QDataStream stream( data, IO_ReadOnly ); | 227 | QDataStream stream( data, IO_ReadOnly ); |
228 | 228 | ||
229 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 229 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
230 | 230 | ||
231 | //we are in the source and get an answer from the target | 231 | //we are in the source and get an answer from the target |
232 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 232 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
233 | { | 233 | { |
234 | QMap<QString,QString> adrMap; | 234 | QMap<QString,QString> adrMap; |
235 | QString uid; | 235 | QString uid; |
236 | 236 | ||
237 | stream >> uid >> adrMap; | 237 | stream >> uid >> adrMap; |
238 | 238 | ||
239 | emit receivedMessageFromTarget(uid, adrMap); | 239 | emit receivedMessageFromTarget(uid, adrMap); |
240 | 240 | ||
241 | 241 | ||
242 | return true; | 242 | return true; |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | return false; | 246 | return false; |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | /********************************************************************************* | 250 | /********************************************************************************* |
251 | * | 251 | * |
252 | ********************************************************************************/ | 252 | ********************************************************************************/ |
253 | 253 | ||
254 | 254 | ||
255 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 255 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
256 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 256 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
257 | { | 257 | { |
258 | //targetMessage returns later two parameters: uid, and three lists | 258 | //targetMessage returns later two parameters: uid, and three lists |
259 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; | 259 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; |
260 | } | 260 | } |
261 | 261 | ||
262 | /*********************************************************************************/ | 262 | /*********************************************************************************/ |
263 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 263 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
264 | { | 264 | { |
265 | #ifndef DESKTOP_VERSION | 265 | #ifndef DESKTOP_VERSION |
266 | //targetMessage passes two parameters: uid, map | 266 | //targetMessage passes two parameters: uid, map |
267 | QString targetMessage = _targetMessage + _targetMessageParameters; | 267 | QString targetMessage = _targetMessage + _targetMessageParameters; |
268 | 268 | ||
269 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 269 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
270 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); | 270 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); |
271 | 271 | ||
272 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 272 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
273 | //US we need no names in the To field. The emailadresses are enough | 273 | //US we need no names in the To field. The emailadresses are enough |
274 | 274 | ||
275 | e << uid << list1 << list2 << list3; | 275 | e << uid << list1 << list2 << list3; |
276 | 276 | ||
277 | qApp->processEvents(); | 277 | qApp->processEvents(); |
278 | 278 | ||
279 | return true; | 279 | return true; |
280 | 280 | ||
281 | #else | 281 | #else |
282 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 282 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
283 | return false; | 283 | return false; |
284 | #endif | 284 | #endif |
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | /*********************************************************************************/ | 289 | /*********************************************************************************/ |
290 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 290 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
291 | { | 291 | { |
292 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 292 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
293 | 293 | ||
294 | if (res == false) | 294 | if (res == false) |
295 | { | 295 | { |
296 | QDataStream stream( data, IO_ReadOnly ); | 296 | QDataStream stream( data, IO_ReadOnly ); |
297 | 297 | ||
298 | // qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 298 | // qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
299 | 299 | ||
300 | //we are in the source and get an answer from the target | 300 | //we are in the source and get an answer from the target |
301 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 301 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
302 | { | 302 | { |
303 | QStringList list1; | 303 | QStringList list1; |
304 | QStringList list2; | 304 | QStringList list2; |
305 | QStringList list3; | 305 | QStringList list3; |
306 | QString uid; | 306 | QString uid; |
307 | 307 | ||
308 | stream >> uid >> list1 >> list2 >> list3; | 308 | stream >> uid >> list1 >> list2 >> list3; |
309 | emit receivedMessageFromTarget(uid, list1, list2, list3); | 309 | emit receivedMessageFromTarget(uid, list1, list2, list3); |
310 | 310 | ||
311 | 311 | ||
312 | return true; | 312 | return true; |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | return false; | 316 | return false; |
317 | } | 317 | } |
318 | 318 | ||
319 | 319 | ||
320 | 320 | ||
321 | /********************************************************************************* | 321 | /********************************************************************************* |
322 | * | 322 | * |
323 | ********************************************************************************/ | 323 | ********************************************************************************/ |
324 | 324 | ||
325 | 325 | ||
326 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 326 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
327 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 327 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
328 | 328 | ||
329 | ExternalAppHandler::ExternalAppHandler() | 329 | ExternalAppHandler::ExternalAppHandler() |
330 | { | 330 | { |
331 | mDefaultItems.setAutoDelete(true); | 331 | mDefaultItems.setAutoDelete(true); |
332 | 332 | ||
333 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 333 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
334 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
335 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 335 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
336 | 336 | ||
337 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 337 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
338 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 338 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
339 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 339 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
340 | 340 | ||
341 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 341 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
342 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 342 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
343 | } | 343 | } |
344 | 344 | ||
345 | ExternalAppHandler::~ExternalAppHandler() | 345 | ExternalAppHandler::~ExternalAppHandler() |
346 | { | 346 | { |
347 | } | 347 | } |
348 | 348 | ||
349 | void ExternalAppHandler::loadConfig() | 349 | void ExternalAppHandler::loadConfig() |
350 | { | 350 | { |
351 | 351 | ||
352 | mDefaultItems.clear(); | 352 | mDefaultItems.clear(); |
353 | |||
354 | mEmailAppAvailable = UNDEFINED; | 353 | mEmailAppAvailable = UNDEFINED; |
355 | mPhoneAppAvailable = UNDEFINED; | 354 | mPhoneAppAvailable = UNDEFINED; |
356 | mFaxAppAvailable = UNDEFINED; | 355 | mFaxAppAvailable = UNDEFINED; |
357 | mSMSAppAvailable = UNDEFINED; | 356 | mSMSAppAvailable = UNDEFINED; |
358 | mPagerAppAvailable = UNDEFINED; | 357 | mPagerAppAvailable = UNDEFINED; |
359 | 358 | ||
360 | 359 | ||
361 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 360 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
362 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 361 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
363 | 362 | ||
364 | if (opiepath.isEmpty()) | 363 | if (opiepath.isEmpty()) |
365 | opiepath = qtopiapath; | 364 | opiepath = qtopiapath; |
366 | 365 | ||
367 | //mailclients | 366 | //mailclients |
368 | QString mailmsg1 = "writeMail(QString,QString)"; | 367 | QString mailmsg1 = "writeMail(QString,QString)"; |
369 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 368 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
370 | 369 | ||
371 | QString undefined = ""; | 370 | QString undefined = ""; |
372 | 371 | ||
373 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 372 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
374 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 373 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
375 | 374 | ||
376 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 375 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
377 | ( QFile::exists( opiepath + "/bin/ompi" ))) | 376 | ( QFile::exists( opiepath + "/bin/ompi" ))) |
378 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 377 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
379 | 378 | ||
380 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | 379 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) |
381 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 380 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
382 | 381 | ||
383 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 382 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
384 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 383 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
385 | 384 | ||
386 | 385 | ||
387 | 386 | ||
388 | //phoneclients | 387 | //phoneclients |
389 | 388 | ||
390 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 389 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
391 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 390 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
392 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 391 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
393 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 392 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
394 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 393 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
395 | 394 | ||
396 | //faxclients | 395 | //faxclients |
397 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 396 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
398 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 397 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
399 | 398 | ||
400 | //smsclients | 399 | //smsclients |
401 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 400 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
402 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 401 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
403 | 402 | ||
404 | //pagerclients | 403 | //pagerclients |
405 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 404 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
406 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 405 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
407 | 406 | ||
408 | } | 407 | } |
409 | 408 | ||
410 | ExternalAppHandler *ExternalAppHandler::instance() | 409 | ExternalAppHandler *ExternalAppHandler::instance() |
411 | { | 410 | { |
412 | if ( !sInstance ) { | 411 | if ( !sInstance ) { |
413 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 412 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
414 | sInstance->loadConfig(); | 413 | sInstance->loadConfig(); |
415 | } | 414 | } |
416 | 415 | ||
417 | return sInstance; | 416 | return sInstance; |
418 | } | 417 | } |
419 | 418 | ||
420 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 419 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
421 | { | 420 | { |
422 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 421 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
423 | 422 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | |
424 | mDefaultItems.append(dai); | 423 | mDefaultItems.append(dai); |
425 | } | 424 | } |
426 | 425 | ||
427 | 426 | ||
428 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 427 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
429 | { | 428 | { |
430 | QList<DefaultAppItem> list; | 429 | QList<DefaultAppItem> list; |
431 | 430 | ||
432 | DefaultAppItem* dai; | 431 | DefaultAppItem* dai; |
433 | 432 | ||
434 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 433 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
435 | { | 434 | { |
436 | if (dai->_type == type) | 435 | if (dai->_type == type) |
437 | list.append(dai); | 436 | list.append(dai); |
438 | } | 437 | } |
439 | 438 | ||
440 | return list; | 439 | return list; |
441 | } | 440 | } |
442 | 441 | ||
443 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 442 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
444 | { | 443 | { |
445 | DefaultAppItem* dai; | 444 | DefaultAppItem* dai; |
446 | 445 | ||
447 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 446 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
448 | { | 447 | { |
449 | if (dai->_type == type && dai->_id == clientid) | 448 | if (dai->_type == type && dai->_id == clientid) |
450 | return dai; | 449 | return dai; |
451 | } | 450 | } |
452 | 451 | ||
453 | return 0; | 452 | return 0; |
454 | } | 453 | } |
455 | 454 | ||
456 | bool ExternalAppHandler::isEmailAppAvailable() | 455 | bool ExternalAppHandler::isEmailAppAvailable() |
457 | { | 456 | { |
458 | #ifndef DESKTOP_VERSION | 457 | #ifndef DESKTOP_VERSION |
459 | if (mEmailAppAvailable == UNDEFINED) | 458 | if (mEmailAppAvailable == UNDEFINED) |
460 | { | 459 | { |
461 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 460 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
462 | if (client == KPimGlobalPrefs::NONE_EMC) | 461 | if (client == KPimGlobalPrefs::NONE_EMC) |
463 | mEmailAppAvailable = UNAVAILABLE; | 462 | mEmailAppAvailable = UNAVAILABLE; |
464 | else | 463 | else |
465 | mEmailAppAvailable = AVAILABLE; | 464 | mEmailAppAvailable = AVAILABLE; |
466 | } | 465 | } |
467 | return (mEmailAppAvailable == AVAILABLE); | 466 | return (mEmailAppAvailable == AVAILABLE); |
468 | 467 | ||
469 | #else //DESKTOP_VERSION | 468 | #else //DESKTOP_VERSION |
470 | return false; | 469 | return false; |
471 | #endif //DESKTOP_VERSION | 470 | #endif //DESKTOP_VERSION |
472 | } | 471 | } |
473 | 472 | ||
474 | bool ExternalAppHandler::isSMSAppAvailable() | 473 | bool ExternalAppHandler::isSMSAppAvailable() |
475 | { | 474 | { |
476 | #ifndef DESKTOP_VERSION | 475 | #ifndef DESKTOP_VERSION |
477 | if (mSMSAppAvailable == UNDEFINED) | 476 | if (mSMSAppAvailable == UNDEFINED) |
478 | { | 477 | { |
479 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 478 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
480 | if (client == KPimGlobalPrefs::NONE_SMC) | 479 | if (client == KPimGlobalPrefs::NONE_SMC) |
481 | mSMSAppAvailable = UNAVAILABLE; | 480 | mSMSAppAvailable = UNAVAILABLE; |
482 | else | 481 | else |
483 | mSMSAppAvailable = AVAILABLE; | 482 | mSMSAppAvailable = AVAILABLE; |
484 | } | 483 | } |
485 | 484 | ||
486 | return (mSMSAppAvailable == AVAILABLE); | 485 | return (mSMSAppAvailable == AVAILABLE); |
487 | #else //DESKTOP_VERSION | 486 | #else //DESKTOP_VERSION |
488 | return false; | 487 | return false; |
489 | #endif //DESKTOP_VERSION | 488 | #endif //DESKTOP_VERSION |
490 | } | 489 | } |
491 | 490 | ||
492 | bool ExternalAppHandler::isPhoneAppAvailable() | 491 | bool ExternalAppHandler::isPhoneAppAvailable() |
493 | { | 492 | { |
494 | #ifndef DESKTOP_VERSION | 493 | #ifndef DESKTOP_VERSION |
495 | if (mPhoneAppAvailable == UNDEFINED) | 494 | if (mPhoneAppAvailable == UNDEFINED) |
496 | { | 495 | { |
497 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 496 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
498 | if (client == KPimGlobalPrefs::NONE_PHC) | 497 | if (client == KPimGlobalPrefs::NONE_PHC) |
499 | mPhoneAppAvailable = UNAVAILABLE; | 498 | mPhoneAppAvailable = UNAVAILABLE; |
500 | else | 499 | else |
501 | mPhoneAppAvailable = AVAILABLE; | 500 | mPhoneAppAvailable = AVAILABLE; |
502 | } | 501 | } |
503 | 502 | ||
504 | return (mPhoneAppAvailable == AVAILABLE); | 503 | return (mPhoneAppAvailable == AVAILABLE); |
505 | #else //DESKTOP_VERSION | 504 | #else //DESKTOP_VERSION |
506 | return false; | 505 | return false; |
507 | #endif //DESKTOP_VERSION | 506 | #endif //DESKTOP_VERSION |
508 | } | 507 | } |
509 | 508 | ||
510 | bool ExternalAppHandler::isFaxAppAvailable() | 509 | bool ExternalAppHandler::isFaxAppAvailable() |
511 | { | 510 | { |
512 | #ifndef DESKTOP_VERSION | 511 | #ifndef DESKTOP_VERSION |
513 | if (mFaxAppAvailable == UNDEFINED) | 512 | if (mFaxAppAvailable == UNDEFINED) |
514 | { | 513 | { |
515 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 514 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
516 | if (client == KPimGlobalPrefs::NONE_FAC) | 515 | if (client == KPimGlobalPrefs::NONE_FAC) |
517 | mFaxAppAvailable = UNAVAILABLE; | 516 | mFaxAppAvailable = UNAVAILABLE; |
518 | else | 517 | else |
519 | mFaxAppAvailable = AVAILABLE; | 518 | mFaxAppAvailable = AVAILABLE; |
520 | } | 519 | } |
521 | 520 | ||
522 | return (mFaxAppAvailable == AVAILABLE); | 521 | return (mFaxAppAvailable == AVAILABLE); |
523 | #else //DESKTOP_VERSION | 522 | #else //DESKTOP_VERSION |
524 | return false; | 523 | return false; |
525 | #endif //DESKTOP_VERSION | 524 | #endif //DESKTOP_VERSION |
526 | } | 525 | } |
527 | 526 | ||
528 | bool ExternalAppHandler::isPagerAppAvailable() | 527 | bool ExternalAppHandler::isPagerAppAvailable() |
529 | { | 528 | { |
530 | #ifndef DESKTOP_VERSION | 529 | #ifndef DESKTOP_VERSION |
531 | if (mPagerAppAvailable == UNDEFINED) | 530 | if (mPagerAppAvailable == UNDEFINED) |
532 | { | 531 | { |
533 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 532 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
534 | if (client == KPimGlobalPrefs::NONE_PAC) | 533 | if (client == KPimGlobalPrefs::NONE_PAC) |
535 | mPagerAppAvailable = UNAVAILABLE; | 534 | mPagerAppAvailable = UNAVAILABLE; |
536 | else | 535 | else |
537 | mPagerAppAvailable = AVAILABLE; | 536 | mPagerAppAvailable = AVAILABLE; |
538 | } | 537 | } |
539 | 538 | ||
540 | return (mPagerAppAvailable == AVAILABLE); | 539 | return (mPagerAppAvailable == AVAILABLE); |
541 | #else //DESKTOP_VERSION | 540 | #else //DESKTOP_VERSION |
542 | return false; | 541 | return false; |
543 | #endif //DESKTOP_VERSION | 542 | #endif //DESKTOP_VERSION |
544 | } | 543 | } |
545 | 544 | ||
546 | /************************************************************************** | 545 | /************************************************************************** |
547 | * | 546 | * |
548 | **************************************************************************/ | 547 | **************************************************************************/ |
549 | 548 | ||
550 | 549 | ||
551 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 550 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
552 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 551 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
553 | { | 552 | { |
554 | 553 | ||
555 | #ifndef DESKTOP_VERSION | 554 | #ifndef DESKTOP_VERSION |
556 | QString channel; | 555 | QString channel; |
557 | QString message2; | 556 | QString message2; |
558 | QString parameters2; | 557 | QString parameters2; |
559 | 558 | ||
560 | 559 | ||
561 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 560 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
562 | if (client == KPimGlobalPrefs::OTHER_EMC) | 561 | if (client == KPimGlobalPrefs::OTHER_EMC) |
563 | { | 562 | { |
564 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 563 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
565 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 564 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
566 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 565 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
567 | } | 566 | } |
568 | else | 567 | else |
569 | { | 568 | { |
570 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 569 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
571 | if (!dai) | 570 | if (!dai) |
572 | { | 571 | { |
573 | qDebug("could not find configured email application."); | 572 | qDebug("could not find configured email application."); |
574 | return false; | 573 | return false; |
575 | } | 574 | } |
576 | channel = dai->_channel; | 575 | channel = dai->_channel; |
577 | message2 = dai->_message2; | 576 | message2 = dai->_message2; |
578 | parameters2 = dai->_parameters2; | 577 | parameters2 = dai->_parameters2; |
579 | } | 578 | } |
580 | 579 | ||
581 | //first check if one of the mailers need the emails right in the message. | 580 | //first check if one of the mailers need the emails right in the message. |
582 | message2 = translateMessage(message2, emails, urls); | 581 | message2 = translateMessage(message2, emails, urls); |
583 | 582 | ||
584 | 583 | ||
585 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 584 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
586 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 585 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
587 | 586 | ||
588 | 587 | ||
589 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 588 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
590 | //US we need no names in the To field. The emailadresses are enough | 589 | //US we need no names in the To field. The emailadresses are enough |
591 | 590 | ||
592 | passParameters(&e, parameters2, emails, urls); | 591 | passParameters(&e, parameters2, emails, urls); |
593 | 592 | ||
594 | 593 | ||
595 | 594 | ||
596 | #else | 595 | #else |
597 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 596 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
598 | #endif | 597 | #endif |
599 | 598 | ||
600 | return true; | 599 | return true; |
601 | } | 600 | } |
602 | 601 | ||
603 | /************************************************************************** | 602 | /************************************************************************** |
604 | * | 603 | * |
605 | **************************************************************************/ | 604 | **************************************************************************/ |
606 | 605 | ||
607 | 606 | ||
608 | //calls the emailapplication and creates a mail with parameter emails as recipients | 607 | //calls the emailapplication and creates a mail with parameter emails as recipients |
609 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 608 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
610 | { | 609 | { |
611 | #ifndef DESKTOP_VERSION | 610 | #ifndef DESKTOP_VERSION |
612 | QString channel; | 611 | QString channel; |
613 | QString message; | 612 | QString message; |
614 | QString parameters; | 613 | QString parameters; |
615 | 614 | ||
616 | 615 | ||
617 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 616 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
618 | if (client == KPimGlobalPrefs::OTHER_EMC) | 617 | if (client == KPimGlobalPrefs::OTHER_EMC) |
619 | { | 618 | { |
620 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 619 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
621 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 620 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
622 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 621 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
623 | } | 622 | } |
624 | else | 623 | else |
625 | { | 624 | { |
626 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 625 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
627 | if (!dai) | 626 | if (!dai) |
628 | { | 627 | { |
629 | qDebug("could not find configured email application."); | 628 | qDebug("could not find configured email application."); |
630 | return false; | 629 | return false; |
631 | } | 630 | } |
632 | channel = dai->_channel; | 631 | channel = dai->_channel; |
633 | message = dai->_message; | 632 | message = dai->_message; |
634 | parameters = dai->_parameters; | 633 | parameters = dai->_parameters; |
635 | } | 634 | } |
636 | 635 | ||
637 | 636 | ||
638 | //first check if one of the mailers need the emails right in the message. | 637 | //first check if one of the mailers need the emails right in the message. |
639 | message = translateMessage(message, name, emailadress); | 638 | message = translateMessage(message, name, emailadress); |
640 | 639 | ||
641 | 640 | ||
642 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 641 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
643 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 642 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
644 | 643 | ||
645 | QCopEnvelope e(channel.latin1(), message.latin1()); | 644 | QCopEnvelope e(channel.latin1(), message.latin1()); |
646 | //US we need no names in the To field. The emailadresses are enough | 645 | //US we need no names in the To field. The emailadresses are enough |
647 | 646 | ||
648 | passParameters(&e, parameters, name, emailadress); | 647 | passParameters(&e, parameters, name, emailadress); |
649 | 648 | ||
650 | 649 | ||
651 | #else | 650 | #else |
652 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 651 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
653 | #endif | 652 | #endif |
654 | 653 | ||
655 | 654 | ||
656 | return true; | 655 | return true; |
657 | } | 656 | } |
658 | 657 | ||
659 | /************************************************************************** | 658 | /************************************************************************** |
660 | * | 659 | * |
661 | **************************************************************************/ | 660 | **************************************************************************/ |
662 | 661 | ||
663 | //calls the emailapplication and creates a mail with parameter as recipients | 662 | //calls the emailapplication and creates a mail with parameter as recipients |
664 | // parameters format is | 663 | // parameters format is |
665 | // NAME <EMAIL>:SUBJECT | 664 | // NAME <EMAIL>:SUBJECT |
666 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 665 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
667 | { | 666 | { |
668 | QString line = adressline; | 667 | QString line = adressline; |
669 | 668 | ||
670 | int first = line.find( "<"); | 669 | int first = line.find( "<"); |
671 | int last = line.find( ">"); | 670 | int last = line.find( ">"); |
672 | QString name = line.left(first); | 671 | QString name = line.left(first); |
673 | QString emailadress = line.mid(first+1, last-first-1); | 672 | QString emailadress = line.mid(first+1, last-first-1); |
674 | 673 | ||
675 | //Subject can not be handled right now. | 674 | //Subject can not be handled right now. |
676 | return mailToOneContact( name, emailadress ); | 675 | return mailToOneContact( name, emailadress ); |
677 | 676 | ||
678 | } | 677 | } |
679 | 678 | ||
680 | 679 | ||
681 | /************************************************************************** | 680 | /************************************************************************** |
682 | * | 681 | * |
683 | **************************************************************************/ | 682 | **************************************************************************/ |
684 | 683 | ||
685 | //calls the phoneapplication with the number | 684 | //calls the phoneapplication with the number |
686 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 685 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
687 | { | 686 | { |
688 | #ifndef DESKTOP_VERSION | 687 | #ifndef DESKTOP_VERSION |
689 | QString channel; | 688 | QString channel; |
690 | QString message; | 689 | QString message; |
691 | QString parameters; | 690 | QString parameters; |
692 | 691 | ||
693 | 692 | ||
694 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 693 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
695 | if (client == KPimGlobalPrefs::OTHER_PHC) | 694 | if (client == KPimGlobalPrefs::OTHER_PHC) |
696 | { | 695 | { |
697 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 696 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
698 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 697 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
699 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 698 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
700 | } | 699 | } |
701 | else | 700 | else |
702 | { | 701 | { |
703 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 702 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
704 | if (!dai) | 703 | if (!dai) |
705 | { | 704 | { |
706 | qDebug("could not find configured phone application."); | 705 | qDebug("could not find configured phone application."); |
707 | return false; | 706 | return false; |
708 | } | 707 | } |
709 | channel = dai->_channel; | 708 | channel = dai->_channel; |
710 | message = dai->_message; | 709 | message = dai->_message; |
711 | parameters = dai->_parameters; | 710 | parameters = dai->_parameters; |
712 | } | 711 | } |
713 | 712 | ||
714 | 713 | ||
715 | //first check if one of the mailers need the emails right in the message. | 714 | //first check if one of the mailers need the emails right in the message. |
716 | message = translateMessage(message, phonenumber, ""); | 715 | message = translateMessage(message, phonenumber, ""); |
717 | 716 | ||
718 | 717 | ||
719 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 718 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
720 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 719 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
721 | 720 | ||
722 | QCopEnvelope e(channel.latin1(), message.latin1()); | 721 | QCopEnvelope e(channel.latin1(), message.latin1()); |
723 | //US we need no names in the To field. The emailadresses are enough | 722 | //US we need no names in the To field. The emailadresses are enough |
724 | 723 | ||
725 | passParameters(&e, parameters, phonenumber, ""); | 724 | passParameters(&e, parameters, phonenumber, ""); |
726 | 725 | ||
727 | 726 | ||
728 | #else | 727 | #else |
729 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 728 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
730 | #endif | 729 | #endif |
731 | 730 | ||
732 | 731 | ||
733 | return true; | 732 | return true; |
734 | } | 733 | } |
735 | 734 | ||
736 | /************************************************************************** | 735 | /************************************************************************** |
737 | * | 736 | * |
738 | **************************************************************************/ | 737 | **************************************************************************/ |
739 | 738 | ||
740 | //calls the smsapplication with the number | 739 | //calls the smsapplication with the number |
741 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 740 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
742 | { | 741 | { |
743 | #ifndef DESKTOP_VERSION | 742 | #ifndef DESKTOP_VERSION |
744 | QString channel; | 743 | QString channel; |
745 | QString message; | 744 | QString message; |
746 | QString parameters; | 745 | QString parameters; |
747 | 746 | ||
748 | 747 | ||
749 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 748 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
750 | if (client == KPimGlobalPrefs::OTHER_SMC) | 749 | if (client == KPimGlobalPrefs::OTHER_SMC) |
751 | { | 750 | { |
752 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 751 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
753 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 752 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
754 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 753 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
755 | } | 754 | } |
756 | else | 755 | else |
757 | { | 756 | { |
758 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 757 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
759 | if (!dai) | 758 | if (!dai) |
760 | { | 759 | { |
761 | qDebug("could not find configured sms application."); | 760 | qDebug("could not find configured sms application."); |
762 | return false; | 761 | return false; |
763 | } | 762 | } |
764 | channel = dai->_channel; | 763 | channel = dai->_channel; |
765 | message = dai->_message; | 764 | message = dai->_message; |
766 | parameters = dai->_parameters; | 765 | parameters = dai->_parameters; |
767 | } | 766 | } |
768 | 767 | ||
769 | 768 | ||
770 | //first check if one of the mailers need the emails right in the message. | 769 | //first check if one of the mailers need the emails right in the message. |
771 | message = translateMessage(message, phonenumber, ""); | 770 | message = translateMessage(message, phonenumber, ""); |
772 | 771 | ||
773 | 772 | ||
774 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 773 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
775 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 774 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
776 | 775 | ||
777 | QCopEnvelope e(channel.latin1(), message.latin1()); | 776 | QCopEnvelope e(channel.latin1(), message.latin1()); |
778 | //US we need no names in the To field. The emailadresses are enough | 777 | //US we need no names in the To field. The emailadresses are enough |
779 | 778 | ||
780 | passParameters(&e, parameters, phonenumber, ""); | 779 | passParameters(&e, parameters, phonenumber, ""); |
781 | 780 | ||
782 | 781 | ||
783 | #else | 782 | #else |
784 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 783 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
785 | #endif | 784 | #endif |
786 | 785 | ||
787 | 786 | ||
788 | return true; | 787 | return true; |
789 | } | 788 | } |
790 | 789 | ||
791 | /************************************************************************** | 790 | /************************************************************************** |
792 | * | 791 | * |
793 | **************************************************************************/ | 792 | **************************************************************************/ |
794 | 793 | ||
795 | //calls the pagerapplication with the number | 794 | //calls the pagerapplication with the number |
796 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 795 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
797 | { | 796 | { |
798 | #ifndef DESKTOP_VERSION | 797 | #ifndef DESKTOP_VERSION |
799 | QString channel; | 798 | QString channel; |
800 | QString message; | 799 | QString message; |
801 | QString parameters; | 800 | QString parameters; |
802 | 801 | ||
803 | 802 | ||
804 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 803 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
805 | if (client == KPimGlobalPrefs::OTHER_PAC) | 804 | if (client == KPimGlobalPrefs::OTHER_PAC) |
806 | { | 805 | { |
807 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 806 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
808 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 807 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
809 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 808 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
810 | } | 809 | } |
811 | else | 810 | else |
812 | { | 811 | { |
813 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 812 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
814 | if (!dai) | 813 | if (!dai) |
815 | { | 814 | { |
816 | qDebug("could not find configured pager application."); | 815 | qDebug("could not find configured pager application."); |
817 | return false; | 816 | return false; |
818 | } | 817 | } |
819 | channel = dai->_channel; | 818 | channel = dai->_channel; |
820 | message = dai->_message; | 819 | message = dai->_message; |
821 | parameters = dai->_parameters; | 820 | parameters = dai->_parameters; |
822 | } | 821 | } |
823 | 822 | ||
824 | 823 | ||
825 | //first check if one of the mailers need the emails right in the message. | 824 | //first check if one of the mailers need the emails right in the message. |
826 | message = translateMessage(message, pagernumber, ""); | 825 | message = translateMessage(message, pagernumber, ""); |
827 | 826 | ||
828 | 827 | ||
829 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 828 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
830 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 829 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
831 | 830 | ||
832 | QCopEnvelope e(channel.latin1(), message.latin1()); | 831 | QCopEnvelope e(channel.latin1(), message.latin1()); |
833 | //US we need no names in the To field. The emailadresses are enough | 832 | //US we need no names in the To field. The emailadresses are enough |
834 | 833 | ||
835 | passParameters(&e, parameters, pagernumber, ""); | 834 | passParameters(&e, parameters, pagernumber, ""); |
836 | 835 | ||
837 | 836 | ||
838 | #else | 837 | #else |
839 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 838 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
840 | #endif | 839 | #endif |
841 | 840 | ||
842 | 841 | ||
843 | return true; | 842 | return true; |
844 | } | 843 | } |
845 | 844 | ||
846 | /************************************************************************** | 845 | /************************************************************************** |
847 | * | 846 | * |
848 | **************************************************************************/ | 847 | **************************************************************************/ |
849 | 848 | ||
850 | //calls the faxapplication with the number | 849 | //calls the faxapplication with the number |
851 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 850 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
852 | { | 851 | { |
853 | #ifndef DESKTOP_VERSION | 852 | #ifndef DESKTOP_VERSION |
854 | QString channel; | 853 | QString channel; |
855 | QString message; | 854 | QString message; |
856 | QString parameters; | 855 | QString parameters; |
857 | 856 | ||
858 | 857 | ||
859 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 858 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
860 | if (client == KPimGlobalPrefs::OTHER_FAC) | 859 | if (client == KPimGlobalPrefs::OTHER_FAC) |
861 | { | 860 | { |
862 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 861 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
863 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 862 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
864 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 863 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
865 | } | 864 | } |
866 | else | 865 | else |
867 | { | 866 | { |
868 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 867 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
869 | if (!dai) | 868 | if (!dai) |
870 | { | 869 | { |
871 | qDebug("could not find configured fax application."); | 870 | qDebug("could not find configured fax application."); |
872 | return false; | 871 | return false; |
873 | } | 872 | } |
874 | channel = dai->_channel; | 873 | channel = dai->_channel; |
875 | message = dai->_message; | 874 | message = dai->_message; |
876 | parameters = dai->_parameters; | 875 | parameters = dai->_parameters; |
877 | } | 876 | } |
878 | 877 | ||
879 | 878 | ||
880 | //first check if one of the mailers need the emails right in the message. | 879 | //first check if one of the mailers need the emails right in the message. |
881 | message = translateMessage(message, faxnumber, ""); | 880 | message = translateMessage(message, faxnumber, ""); |
882 | 881 | ||
883 | 882 | ||
884 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 883 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
885 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 884 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
886 | 885 | ||
887 | QCopEnvelope e(channel.latin1(), message.latin1()); | 886 | QCopEnvelope e(channel.latin1(), message.latin1()); |
888 | //US we need no names in the To field. The emailadresses are enough | 887 | //US we need no names in the To field. The emailadresses are enough |
889 | 888 | ||
890 | passParameters(&e, parameters, faxnumber, ""); | 889 | passParameters(&e, parameters, faxnumber, ""); |
891 | 890 | ||
892 | 891 | ||
893 | #else | 892 | #else |
894 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 893 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
895 | #endif | 894 | #endif |
896 | 895 | ||
897 | 896 | ||
898 | return true; | 897 | return true; |
899 | } | 898 | } |
900 | 899 | ||
901 | /************************************************************************** | 900 | /************************************************************************** |
902 | * | 901 | * |
903 | **************************************************************************/ | 902 | **************************************************************************/ |
904 | 903 | ||
905 | 904 | ||
906 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 905 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
907 | { | 906 | { |
908 | message = message.replace( QRegExp("%1"), param1 ); | 907 | message = message.replace( QRegExp("%1"), param1 ); |
909 | return message.replace( QRegExp("%2"), param2 ); | 908 | return message.replace( QRegExp("%2"), param2 ); |
910 | } | 909 | } |
911 | 910 | ||
912 | /************************************************************************** | 911 | /************************************************************************** |
913 | * | 912 | * |
914 | **************************************************************************/ | 913 | **************************************************************************/ |
915 | 914 | ||
916 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 915 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
917 | { | 916 | { |
918 | #ifndef DESKTOP_VERSION | 917 | #ifndef DESKTOP_VERSION |
919 | QMap<QString, QString> valmap; | 918 | QMap<QString, QString> valmap; |
920 | bool useValMap = false; | 919 | bool useValMap = false; |
921 | 920 | ||
922 | // first extract all parts of the parameters. | 921 | // first extract all parts of the parameters. |
923 | QStringList paramlist = QStringList::split(";", parameters); | 922 | QStringList paramlist = QStringList::split(";", parameters); |
924 | 923 | ||
925 | //Now check how many parts we have. | 924 | //Now check how many parts we have. |
926 | //=0 :no params to pass | 925 | //=0 :no params to pass |
927 | //>0 :parameters to pass | 926 | //>0 :parameters to pass |
928 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 927 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
929 | { | 928 | { |
930 | QString param = (*it); | 929 | QString param = (*it); |
931 | QStringList keyvallist = QStringList::split("=", param); | 930 | QStringList keyvallist = QStringList::split("=", param); |
932 | 931 | ||
933 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 932 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
934 | QStringList::Iterator it2 = keyvallist.begin(); | 933 | QStringList::Iterator it2 = keyvallist.begin(); |
935 | QString key = (*it2); | 934 | QString key = (*it2); |
936 | key = key.replace( QRegExp("%1"), param1 ); | 935 | key = key.replace( QRegExp("%1"), param1 ); |
937 | key = key.replace( QRegExp("%2"), param2 ); | 936 | key = key.replace( QRegExp("%2"), param2 ); |
938 | ++it2; | 937 | ++it2; |
939 | 938 | ||
940 | if(it2 != keyvallist.end()) | 939 | if(it2 != keyvallist.end()) |
941 | { | 940 | { |
942 | QString value = (*it2); | 941 | QString value = (*it2); |
943 | value = value.replace( QRegExp("%1"), param1 ); | 942 | value = value.replace( QRegExp("%1"), param1 ); |
944 | value = value.replace( QRegExp("%2"), param2 ); | 943 | value = value.replace( QRegExp("%2"), param2 ); |
945 | 944 | ||
946 | valmap.insert(key, value); | 945 | valmap.insert(key, value); |
947 | useValMap = true; | 946 | useValMap = true; |
948 | } | 947 | } |
949 | else | 948 | else |
950 | { | 949 | { |
951 | // qDebug("pass parameter << %s", key.latin1()); | 950 | // qDebug("pass parameter << %s", key.latin1()); |
952 | (*e) << key; | 951 | (*e) << key; |
953 | } | 952 | } |
954 | } | 953 | } |
955 | 954 | ||
956 | if (useValMap == true) | 955 | if (useValMap == true) |
957 | (*e) << valmap; | 956 | (*e) << valmap; |
958 | 957 | ||
959 | #endif | 958 | #endif |
960 | 959 | ||
961 | } | 960 | } |
962 | 961 | ||
963 | 962 | ||
964 | 963 | ||
965 | /************************************************************************** | 964 | /************************************************************************** |
966 | * | 965 | * |
967 | **************************************************************************/ | 966 | **************************************************************************/ |
968 | 967 | ||
969 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 968 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) |
970 | { | 969 | { |
971 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 970 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
972 | if (!res) | 971 | if (!res) |
973 | res = mDisplayDetails->appMessage( cmsg, data ); | 972 | res = mDisplayDetails->appMessage( cmsg, data ); |
974 | 973 | ||
975 | // if (!res) | 974 | // if (!res) |
976 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 975 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
977 | } | 976 | } |
978 | 977 | ||
979 | 978 | ||
980 | 979 | ||
981 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 980 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
982 | { | 981 | { |
983 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 982 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
984 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | 983 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
985 | } | 984 | } |
986 | 985 | ||
987 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 986 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
988 | { | 987 | { |
989 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 988 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
990 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); | 989 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
991 | } | 990 | } |
992 | 991 | ||
993 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) | 992 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
994 | { | 993 | { |
995 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 994 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
996 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 995 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
997 | } | 996 | } |
998 | 997 | ||
999 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 998 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1000 | { | 999 | { |
1001 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1000 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1002 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); | 1001 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
1003 | } | 1002 | } |
1004 | 1003 | ||
1005 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) | 1004 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) |
1006 | { | 1005 | { |
1007 | mDisplayDetails->setSourceChannel(""); | 1006 | mDisplayDetails->setSourceChannel(""); |
1008 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); | 1007 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); |
1009 | } | 1008 | } |
1010 | 1009 | ||
1011 | 1010 | ||
1012 | 1011 | ||
1013 | 1012 | ||
1014 | 1013 | ||
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 4790980..7f683a8 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,89 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kstaticdeleter.h> | 35 | #include <kstaticdeleter.h> |
36 | 36 | ||
37 | #include "kpimglobalprefs.h" | 37 | #include "kpimglobalprefs.h" |
38 | 38 | ||
39 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 39 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
40 | static KStaticDeleter<KPimGlobalPrefs> staticDeleter; | 40 | static KStaticDeleter<KPimGlobalPrefs> staticDeleter; |
41 | 41 | ||
42 | 42 | ||
43 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 43 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
44 | : KPrefs("kkdepimrc") | 44 | : KPrefs("kkdepimrc") |
45 | { | 45 | { |
46 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 46 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
47 | 47 | ||
48 | addItemInt( "EmailChannelType", &mEmailClient, NONE_EMC ); | 48 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
49 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 49 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
50 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 50 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
51 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 51 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
52 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 52 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
53 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 53 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
54 | 54 | ||
55 | addItemInt( "PhoneChannelType", &mPhoneClient, NONE_PHC ); | 55 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
56 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 56 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
57 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 57 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
58 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 58 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
59 | 59 | ||
60 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 60 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
61 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 61 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
62 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 62 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
63 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 63 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
64 | 64 | ||
65 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 65 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
66 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 66 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
67 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 67 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
68 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 68 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
69 | 69 | ||
70 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 70 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
71 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 71 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
72 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 72 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
73 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 73 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | KPimGlobalPrefs::~KPimGlobalPrefs() | 77 | KPimGlobalPrefs::~KPimGlobalPrefs() |
78 | { | 78 | { |
79 | } | 79 | } |
80 | 80 | ||
81 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 81 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
82 | { | 82 | { |
83 | if ( !sInstance ) { | 83 | if ( !sInstance ) { |
84 | sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); | 84 | sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); |
85 | sInstance->readConfig(); | 85 | sInstance->readConfig(); |
86 | } | 86 | } |
87 | 87 | ||
88 | return sInstance; | 88 | return sInstance; |
89 | } | 89 | } |