summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp4
-rw-r--r--korganizer/mainwindow.cpp15
-rw-r--r--microkde/kdeui/ktoolbar.cpp4
4 files changed, 29 insertions, 16 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index af12f2b..4e2523e 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,2424 +1,2434 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 Async a special exception, permission is given to link this program 19 Async a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99#include <kprefsdialog.h> 99#include <kprefsdialog.h>
100 100
101 101
102//#include <qlabel.h> 102//#include <qlabel.h>
103 103
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106#include <qpe/ir.h> 106#include <qpe/ir.h>
107#include <qpe/qpemenubar.h> 107#include <qpe/qpemenubar.h>
108#include <qtopia/qcopenvelope_qws.h> 108#include <qtopia/qcopenvelope_qws.h>
109#else 109#else
110 110
111#include <qmenubar.h> 111#include <qmenubar.h>
112#endif 112#endif
113 113
114#endif // KAB_EMBEDDED 114#endif // KAB_EMBEDDED
115#include "kcmconfigs/kcmkabconfig.h" 115#include "kcmconfigs/kcmkabconfig.h"
116#include "kcmconfigs/kcmkdepimconfig.h" 116#include "kcmconfigs/kcmkdepimconfig.h"
117#include "kpimglobalprefs.h" 117#include "kpimglobalprefs.h"
118#include "externalapphandler.h" 118#include "externalapphandler.h"
119#include "xxportselectdialog.h" 119#include "xxportselectdialog.h"
120 120
121 121
122#include <kresources/selectdialog.h> 122#include <kresources/selectdialog.h>
123#include <kmessagebox.h> 123#include <kmessagebox.h>
124 124
125#include <picture.h> 125#include <picture.h>
126#include <resource.h> 126#include <resource.h>
127 127
128//US#include <qsplitter.h> 128//US#include <qsplitter.h>
129#include <qmap.h> 129#include <qmap.h>
130#include <qdir.h> 130#include <qdir.h>
131#include <qfile.h> 131#include <qfile.h>
132#include <qvbox.h> 132#include <qvbox.h>
133#include <qlayout.h> 133#include <qlayout.h>
134#include <qclipboard.h> 134#include <qclipboard.h>
135#include <qtextstream.h> 135#include <qtextstream.h>
136#include <qradiobutton.h> 136#include <qradiobutton.h>
137#include <qbuttongroup.h> 137#include <qbuttongroup.h>
138 138
139#include <libkdepim/categoryselectdialog.h> 139#include <libkdepim/categoryselectdialog.h>
140#include <libkdepim/categoryeditdialog.h> 140#include <libkdepim/categoryeditdialog.h>
141#include <kabc/vcardconverter.h> 141#include <kabc/vcardconverter.h>
142 142
143 143
144#include "addresseeutil.h" 144#include "addresseeutil.h"
145#include "undocmds.h" 145#include "undocmds.h"
146#include "addresseeeditordialog.h" 146#include "addresseeeditordialog.h"
147#include "viewmanager.h" 147#include "viewmanager.h"
148#include "details/detailsviewcontainer.h" 148#include "details/detailsviewcontainer.h"
149#include "kabprefs.h" 149#include "kabprefs.h"
150#include "xxportmanager.h" 150#include "xxportmanager.h"
151#include "incsearchwidget.h" 151#include "incsearchwidget.h"
152#include "jumpbuttonbar.h" 152#include "jumpbuttonbar.h"
153#include "extensionmanager.h" 153#include "extensionmanager.h"
154#include "addresseeconfig.h" 154#include "addresseeconfig.h"
155#include "nameeditdialog.h" 155#include "nameeditdialog.h"
156#include <kcmultidialog.h> 156#include <kcmultidialog.h>
157 157
158#ifdef _WIN32_ 158#ifdef _WIN32_
159#ifdef _OL_IMPORT_ 159#ifdef _OL_IMPORT_
160#include "kaimportoldialog.h" 160#include "kaimportoldialog.h"
161#endif 161#endif
162#else 162#else
163#include <unistd.h> 163#include <unistd.h>
164#endif 164#endif
165// sync includes 165// sync includes
166#include <libkdepim/ksyncprofile.h> 166#include <libkdepim/ksyncprofile.h>
167#include <libkdepim/ksyncprefsdialog.h> 167#include <libkdepim/ksyncprefsdialog.h>
168 168
169 169
170class KABCatPrefs : public QDialog 170class KABCatPrefs : public QDialog
171{ 171{
172 public: 172 public:
173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
174 QDialog( parent, name, true ) 174 QDialog( parent, name, true )
175 { 175 {
176 setCaption( i18n("Manage new Categories") ); 176 setCaption( i18n("Manage new Categories") );
177 QVBoxLayout* lay = new QVBoxLayout( this ); 177 QVBoxLayout* lay = new QVBoxLayout( this );
178 lay->setSpacing( 3 ); 178 lay->setSpacing( 3 );
179 lay->setMargin( 3 ); 179 lay->setMargin( 3 );
180 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 180 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
181 lay->addWidget( lab ); 181 lay->addWidget( lab );
182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
183 lay->addWidget( format ); 183 lay->addWidget( format );
184 format->setExclusive ( true ) ; 184 format->setExclusive ( true ) ;
185 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 185 addCatBut = new QRadioButton(i18n("Add to category list"), format );
186 new QRadioButton(i18n("Remove from addressees"), format ); 186 new QRadioButton(i18n("Remove from addressees"), format );
187 addCatBut->setChecked( true ); 187 addCatBut->setChecked( true );
188 QPushButton * ok = new QPushButton( i18n("OK"), this ); 188 QPushButton * ok = new QPushButton( i18n("OK"), this );
189 lay->addWidget( ok ); 189 lay->addWidget( ok );
190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
191 lay->addWidget( cancel ); 191 lay->addWidget( cancel );
192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
194 resize( 200, 200 ); 194 resize( 200, 200 );
195 } 195 }
196 196
197 bool addCat() { return addCatBut->isChecked(); } 197 bool addCat() { return addCatBut->isChecked(); }
198private: 198private:
199 QRadioButton* addCatBut; 199 QRadioButton* addCatBut;
200}; 200};
201 201
202class KABFormatPrefs : public QDialog 202class KABFormatPrefs : public QDialog
203{ 203{
204 public: 204 public:
205 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 205 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
206 QDialog( parent, name, true ) 206 QDialog( parent, name, true )
207 { 207 {
208 setCaption( i18n("Set formatted name") ); 208 setCaption( i18n("Set formatted name") );
209 QVBoxLayout* lay = new QVBoxLayout( this ); 209 QVBoxLayout* lay = new QVBoxLayout( this );
210 lay->setSpacing( 3 ); 210 lay->setSpacing( 3 );
211 lay->setMargin( 3 ); 211 lay->setMargin( 3 );
212 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 212 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
213 lay->addWidget( lab ); 213 lay->addWidget( lab );
214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
215 lay->addWidget( format ); 215 lay->addWidget( format );
216 format->setExclusive ( true ) ; 216 format->setExclusive ( true ) ;
217 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 217 simple = new QRadioButton(i18n("Simple: James Bond"), format );
218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
220 company = new QRadioButton(i18n("Organization: MI6"), format ); 220 company = new QRadioButton(i18n("Organization: MI6"), format );
221 simple->setChecked( true ); 221 simple->setChecked( true );
222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
223 lay->addWidget( setCompany ); 223 lay->addWidget( setCompany );
224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
225 lay->addWidget( ok ); 225 lay->addWidget( ok );
226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
227 lay->addWidget( cancel ); 227 lay->addWidget( cancel );
228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
230 //resize( 200, 200 ); 230 //resize( 200, 200 );
231 231
232 } 232 }
233public: 233public:
234 QRadioButton* simple, *full, *reverse, *company; 234 QRadioButton* simple, *full, *reverse, *company;
235 QCheckBox* setCompany; 235 QCheckBox* setCompany;
236}; 236};
237 237
238 238
239 239
240class KAex2phonePrefs : public QDialog 240class KAex2phonePrefs : public QDialog
241{ 241{
242 public: 242 public:
243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
244 QDialog( parent, name, true ) 244 QDialog( parent, name, true )
245 { 245 {
246 setCaption( i18n("Export to phone options") ); 246 setCaption( i18n("Export to phone options") );
247 QVBoxLayout* lay = new QVBoxLayout( this ); 247 QVBoxLayout* lay = new QVBoxLayout( this );
248 lay->setSpacing( 3 ); 248 lay->setSpacing( 3 );
249 lay->setMargin( 3 ); 249 lay->setMargin( 3 );
250 QLabel *lab; 250 QLabel *lab;
251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
252 lab->setAlignment (AlignHCenter ); 252 lab->setAlignment (AlignHCenter );
253 QHBox* temphb; 253 QHBox* temphb;
254 temphb = new QHBox( this ); 254 temphb = new QHBox( this );
255 new QLabel( i18n("I/O device: "), temphb ); 255 new QLabel( i18n("I/O device: "), temphb );
256 mPhoneDevice = new QLineEdit( temphb); 256 mPhoneDevice = new QLineEdit( temphb);
257 lay->addWidget( temphb ); 257 lay->addWidget( temphb );
258 temphb = new QHBox( this ); 258 temphb = new QHBox( this );
259 new QLabel( i18n("Connection: "), temphb ); 259 new QLabel( i18n("Connection: "), temphb );
260 mPhoneConnection = new QLineEdit( temphb); 260 mPhoneConnection = new QLineEdit( temphb);
261 lay->addWidget( temphb ); 261 lay->addWidget( temphb );
262 temphb = new QHBox( this ); 262 temphb = new QHBox( this );
263 new QLabel( i18n("Model(opt.): "), temphb ); 263 new QLabel( i18n("Model(opt.): "), temphb );
264 mPhoneModel = new QLineEdit( temphb); 264 mPhoneModel = new QLineEdit( temphb);
265 lay->addWidget( temphb ); 265 lay->addWidget( temphb );
266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
267 // lay->addWidget( mWriteToSim ); 267 // lay->addWidget( mWriteToSim );
268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
269 lab->setAlignment (AlignHCenter); 269 lab->setAlignment (AlignHCenter);
270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
271 lay->addWidget( ok ); 271 lay->addWidget( ok );
272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
273 lay->addWidget( cancel ); 273 lay->addWidget( cancel );
274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
276 resize( 220, 240 ); 276 resize( 220, 240 );
277 277
278 } 278 }
279 279
280public: 280public:
281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
282 QCheckBox* mWriteToSim; 282 QCheckBox* mWriteToSim;
283}; 283};
284 284
285 285
286bool pasteWithNewUid = true; 286bool pasteWithNewUid = true;
287 287
288#ifdef KAB_EMBEDDED 288#ifdef KAB_EMBEDDED
289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
293#else //KAB_EMBEDDED 293#else //KAB_EMBEDDED
294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
297 mReadWrite( readWrite ), mModified( false ) 297 mReadWrite( readWrite ), mModified( false )
298#endif //KAB_EMBEDDED 298#endif //KAB_EMBEDDED
299{ 299{
300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
301 // syncManager->setBlockSave(false); 301 // syncManager->setBlockSave(false);
302 mIncSearchWidget = 0; 302 mIncSearchWidget = 0;
303 mMiniSplitter = 0; 303 mMiniSplitter = 0;
304 mExtensionBarSplitter = 0; 304 mExtensionBarSplitter = 0;
305 mIsPart = !parent->inherits( "KAddressBookMain" ); 305 mIsPart = !parent->inherits( "KAddressBookMain" );
306 mAddressBook = KABC::StdAddressBook::selfNoLoad(); 306 mAddressBook = KABC::StdAddressBook::selfNoLoad();
307 KABC::StdAddressBook::setAutomaticSave( false ); 307 KABC::StdAddressBook::setAutomaticSave( false );
308 308
309#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
311#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
312 312
313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
314 SLOT( addressBookChanged() ) ); 314 SLOT( addressBookChanged() ) );
315 315
316#if 0 316#if 0
317 // LR moved to addressbook init method 317 // LR moved to addressbook init method
318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
319 "X-Department", "KADDRESSBOOK" ); 319 "X-Department", "KADDRESSBOOK" );
320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
321 "X-Profession", "KADDRESSBOOK" ); 321 "X-Profession", "KADDRESSBOOK" );
322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
323 "X-AssistantsName", "KADDRESSBOOK" ); 323 "X-AssistantsName", "KADDRESSBOOK" );
324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
325 "X-ManagersName", "KADDRESSBOOK" ); 325 "X-ManagersName", "KADDRESSBOOK" );
326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
327 "X-SpousesName", "KADDRESSBOOK" ); 327 "X-SpousesName", "KADDRESSBOOK" );
328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
329 "X-Office", "KADDRESSBOOK" ); 329 "X-Office", "KADDRESSBOOK" );
330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
331 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
333 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
334 334
335 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
336 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
338 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
340 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
342 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
343#endif 343#endif
344 initGUI(); 344 initGUI();
345 345
346 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
347 347
348 348
349 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
350 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
351 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
352 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
353 353
354 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
355 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
356 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
357 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
358 358
359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
361 361
362 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
363 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
364 364
365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
366 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
368 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
369 369
370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
371 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
372 372
373 373
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
375 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&))); 375 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&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); 378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
380 380
381 381
382#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
384 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 384 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
385 385
386 connect( mDetails, SIGNAL( browse( const QString& ) ), 386 connect( mDetails, SIGNAL( browse( const QString& ) ),
387 SLOT( browse( const QString& ) ) ); 387 SLOT( browse( const QString& ) ) );
388 388
389 389
390 mAddressBookService = new KAddressBookService( this ); 390 mAddressBookService = new KAddressBookService( this );
391 391
392#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
393 393
394 mMessageTimer = new QTimer( this ); 394 mMessageTimer = new QTimer( this );
395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
396 mEditorDialog = 0; 396 mEditorDialog = 0;
397 createAddresseeEditorDialog( this ); 397 createAddresseeEditorDialog( this );
398 setModified( false ); 398 setModified( false );
399 mBRdisabled = false; 399 mBRdisabled = false;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 infrared = 0; 401 infrared = 0;
402#endif 402#endif
403 //toggleBeamReceive( ); 403 //toggleBeamReceive( );
404 mMainWindow->toolBar()->show(); 404 mMainWindow->toolBar()->show();
405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
406 //QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 406 //QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
407 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() )); 407 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
408} 408}
409void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data ) 409void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data )
410{ 410{
411 //qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 411 //qDebug("KO: QCOP start message received: %s ", cmsg.data() );
412 mCStringMess = cmsg; 412 mCStringMess = cmsg;
413 mByteData = data; 413 mByteData = data;
414} 414}
415 415
416void KABCore::loadDataAfterStart() 416void KABCore::loadDataAfterStart()
417{ 417{
418 //qDebug("KABCore::loadDataAfterStart() "); 418 //qDebug("KABCore::loadDataAfterStart() ");
419 ((StdAddressBook*)mAddressBook)->init( true ); 419 ((StdAddressBook*)mAddressBook)->init( true );
420 mViewManager->refreshView(); 420 mViewManager->refreshView();
421 421
422#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
423 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & ))); 423 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & )));
424 424
425 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 425 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
426 if ( !mCStringMess.isEmpty() ) 426 if ( !mCStringMess.isEmpty() )
427 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData ); 427 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
428#endif 428#endif
429 // QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 429 // QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
430 setCaptionBack(); 430 setCaptionBack();
431} 431}
432void KABCore::updateToolBar() 432void KABCore::updateToolBar()
433{ 433{
434 static int iii = 0; 434 static int iii = 0;
435 ++iii; 435 ++iii;
436 mMainWindow->toolBar()->repaintMe(); 436 mMainWindow->toolBar()->repaintMe();
437 if ( iii < 4 ) 437 if ( iii < 4 )
438 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 438 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
439} 439}
440KABCore::~KABCore() 440KABCore::~KABCore()
441{ 441{
442 // save(); 442 // save();
443 //saveSettings(); 443 //saveSettings();
444 //KABPrefs::instance()->writeConfig(); 444 //KABPrefs::instance()->writeConfig();
445 delete AddresseeConfig::instance(); 445 delete AddresseeConfig::instance();
446 mAddressBook = 0; 446 mAddressBook = 0;
447 KABC::StdAddressBook::close(); 447 KABC::StdAddressBook::close();
448 448
449 delete syncManager; 449 delete syncManager;
450#ifndef DESKTOP_VERSION 450#ifndef DESKTOP_VERSION
451 if ( infrared ) 451 if ( infrared )
452 delete infrared; 452 delete infrared;
453#endif 453#endif
454} 454}
455void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 455void KABCore::receive( const QCString& cmsg, const QByteArray& data )
456{ 456{
457 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 457 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
458 if ( cmsg == "setDocument(QString)" ) { 458 if ( cmsg == "setDocument(QString)" ) {
459 QDataStream stream( data, IO_ReadOnly ); 459 QDataStream stream( data, IO_ReadOnly );
460 QString fileName; 460 QString fileName;
461 stream >> fileName; 461 stream >> fileName;
462 recieve( fileName ); 462 recieve( fileName );
463 return; 463 return;
464 } 464 }
465} 465}
466void KABCore::toggleBeamReceive( ) 466void KABCore::toggleBeamReceive( )
467{ 467{
468 if ( mBRdisabled ) 468 if ( mBRdisabled )
469 return; 469 return;
470#ifndef DESKTOP_VERSION 470#ifndef DESKTOP_VERSION
471 if ( infrared ) { 471 if ( infrared ) {
472 qDebug("KA: AB disable BeamReceive "); 472 qDebug("KA: AB disable BeamReceive ");
473 delete infrared; 473 delete infrared;
474 infrared = 0; 474 infrared = 0;
475 mActionBR->setChecked(false); 475 mActionBR->setChecked(false);
476 return; 476 return;
477 } 477 }
478 qDebug("KA: AB enable BeamReceive "); 478 qDebug("KA: AB enable BeamReceive ");
479 mActionBR->setChecked(true); 479 mActionBR->setChecked(true);
480 480
481 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 481 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
482 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 482 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
483#endif 483#endif
484} 484}
485 485
486 486
487void KABCore::disableBR(bool b) 487void KABCore::disableBR(bool b)
488{ 488{
489#ifndef DESKTOP_VERSION 489#ifndef DESKTOP_VERSION
490 if ( b ) { 490 if ( b ) {
491 if ( infrared ) { 491 if ( infrared ) {
492 toggleBeamReceive( ); 492 toggleBeamReceive( );
493 } 493 }
494 mBRdisabled = true; 494 mBRdisabled = true;
495 } else { 495 } else {
496 if ( mBRdisabled ) { 496 if ( mBRdisabled ) {
497 mBRdisabled = false; 497 mBRdisabled = false;
498 //toggleBeamReceive( ); 498 //toggleBeamReceive( );
499 } 499 }
500 } 500 }
501#endif 501#endif
502 502
503} 503}
504void KABCore::recieve( QString fn ) 504void KABCore::recieve( QString fn )
505{ 505{
506 //qDebug("KABCore::recieve "); 506 //qDebug("KABCore::recieve ");
507 int count = mAddressBook->importFromFile( fn, true ); 507 int count = mAddressBook->importFromFile( fn, true );
508 if ( count ) 508 if ( count )
509 setModified( true ); 509 setModified( true );
510 mViewManager->refreshView(); 510 mViewManager->refreshView();
511 message(i18n("%1 contact(s) received!").arg( count )); 511 message(i18n("%1 contact(s) received!").arg( count ));
512 topLevelWidget()->showMaximized(); 512 topLevelWidget()->showMaximized();
513 topLevelWidget()->raise(); 513 topLevelWidget()->raise();
514} 514}
515void KABCore::restoreSettings() 515void KABCore::restoreSettings()
516{ 516{
517 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 517 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
518 518
519 bool state; 519 bool state;
520 520
521 if (mMultipleViewsAtOnce) 521 if (mMultipleViewsAtOnce)
522 state = KABPrefs::instance()->mDetailsPageVisible; 522 state = KABPrefs::instance()->mDetailsPageVisible;
523 else 523 else
524 state = false; 524 state = false;
525 525
526 mActionDetails->setChecked( state ); 526 mActionDetails->setChecked( state );
527 setDetailsVisible( state ); 527 setDetailsVisible( state );
528 528
529 state = KABPrefs::instance()->mJumpButtonBarVisible; 529 state = KABPrefs::instance()->mJumpButtonBarVisible;
530 530
531 mActionJumpBar->setChecked( state ); 531 mActionJumpBar->setChecked( state );
532 setJumpButtonBarVisible( state ); 532 setJumpButtonBarVisible( state );
533/*US 533/*US
534 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 534 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
535 if ( splitterSize.count() == 0 ) { 535 if ( splitterSize.count() == 0 ) {
536 splitterSize.append( width() / 2 ); 536 splitterSize.append( width() / 2 );
537 splitterSize.append( width() / 2 ); 537 splitterSize.append( width() / 2 );
538 } 538 }
539 mMiniSplitter->setSizes( splitterSize ); 539 mMiniSplitter->setSizes( splitterSize );
540 if ( mExtensionBarSplitter ) { 540 if ( mExtensionBarSplitter ) {
541 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 541 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
542 if ( splitterSize.count() == 0 ) { 542 if ( splitterSize.count() == 0 ) {
543 splitterSize.append( width() / 2 ); 543 splitterSize.append( width() / 2 );
544 splitterSize.append( width() / 2 ); 544 splitterSize.append( width() / 2 );
545 } 545 }
546 mExtensionBarSplitter->setSizes( splitterSize ); 546 mExtensionBarSplitter->setSizes( splitterSize );
547 547
548 } 548 }
549*/ 549*/
550 mViewManager->restoreSettings(); 550 mViewManager->restoreSettings();
551 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 551 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
552 mExtensionManager->restoreSettings(); 552 mExtensionManager->restoreSettings();
553#ifdef DESKTOP_VERSION 553#ifdef DESKTOP_VERSION
554 int wid = width(); 554 int wid = width();
555 if ( wid < 10 ) 555 if ( wid < 10 )
556 wid = 400; 556 wid = 400;
557#else 557#else
558 int wid = QApplication::desktop()->width(); 558 int wid = QApplication::desktop()->width();
559 if ( wid < 640 ) 559 if ( wid < 640 )
560 wid = QApplication::desktop()->height(); 560 wid = QApplication::desktop()->height();
561#endif 561#endif
562 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 562 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
563 if ( true /*splitterSize.count() == 0*/ ) { 563 if ( true /*splitterSize.count() == 0*/ ) {
564 splitterSize.append( wid / 2 ); 564 splitterSize.append( wid / 2 );
565 splitterSize.append( wid / 2 ); 565 splitterSize.append( wid / 2 );
566 } 566 }
567 mMiniSplitter->setSizes( splitterSize ); 567 mMiniSplitter->setSizes( splitterSize );
568 if ( mExtensionBarSplitter ) { 568 if ( mExtensionBarSplitter ) {
569 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 569 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
570 if ( true /*splitterSize.count() == 0*/ ) { 570 if ( true /*splitterSize.count() == 0*/ ) {
571 splitterSize.append( wid / 2 ); 571 splitterSize.append( wid / 2 );
572 splitterSize.append( wid / 2 ); 572 splitterSize.append( wid / 2 );
573 } 573 }
574 mExtensionBarSplitter->setSizes( splitterSize ); 574 mExtensionBarSplitter->setSizes( splitterSize );
575 575
576 } 576 }
577#ifdef DESKTOP_VERSION 577#ifdef DESKTOP_VERSION
578 KConfig *config = KABPrefs::instance()->getConfig(); 578 KConfig *config = KABPrefs::instance()->getConfig();
579 config->setGroup("WidgetLayout"); 579 config->setGroup("WidgetLayout");
580 QStringList list; 580 QStringList list;
581 list = config->readListEntry("MainLayout"); 581 list = config->readListEntry("MainLayout");
582 int x,y,w,h; 582 int x,y,w,h;
583 if ( ! list.isEmpty() ) { 583 if ( ! list.isEmpty() ) {
584 x = list[0].toInt(); 584 x = list[0].toInt();
585 y = list[1].toInt(); 585 y = list[1].toInt();
586 w = list[2].toInt(); 586 w = list[2].toInt();
587 h = list[3].toInt(); 587 h = list[3].toInt();
588 KApplication::testCoords( &x,&y,&w,&h ); 588 KApplication::testCoords( &x,&y,&w,&h );
589 topLevelWidget()->setGeometry(x,y,w,h); 589 topLevelWidget()->setGeometry(x,y,w,h);
590 590
591 } else { 591 } else {
592 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 592 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
593 } 593 }
594#endif 594#endif
595} 595}
596 596
597void KABCore::saveSettings() 597void KABCore::saveSettings()
598{ 598{
599 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 599 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
600 if ( mExtensionBarSplitter ) 600 if ( mExtensionBarSplitter )
601 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 601 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
602 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 602 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
603 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 603 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
604#ifndef KAB_EMBEDDED 604#ifndef KAB_EMBEDDED
605 605
606 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 606 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
607 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 607 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
608#endif //KAB_EMBEDDED 608#endif //KAB_EMBEDDED
609 mExtensionManager->saveSettings(); 609 mExtensionManager->saveSettings();
610 mViewManager->saveSettings(); 610 mViewManager->saveSettings();
611 611
612 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 612 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
613 613
614 KABPrefs::instance()->writeConfig(); 614 KABPrefs::instance()->writeConfig();
615 qDebug("KA: KABCore::saveSettings() "); 615 //qDebug("KA: KABCore::saveSettings() ");
616} 616}
617 617
618KABC::AddressBook *KABCore::addressBook() const 618KABC::AddressBook *KABCore::addressBook() const
619{ 619{
620 return mAddressBook; 620 return mAddressBook;
621} 621}
622 622
623KConfig *KABCore::config() 623KConfig *KABCore::config()
624{ 624{
625#ifndef KAB_EMBEDDED 625#ifndef KAB_EMBEDDED
626 return KABPrefs::instance()->config(); 626 return KABPrefs::instance()->config();
627#else //KAB_EMBEDDED 627#else //KAB_EMBEDDED
628 return KABPrefs::instance()->getConfig(); 628 return KABPrefs::instance()->getConfig();
629#endif //KAB_EMBEDDED 629#endif //KAB_EMBEDDED
630} 630}
631 631
632KActionCollection *KABCore::actionCollection() const 632KActionCollection *KABCore::actionCollection() const
633{ 633{
634 return mGUIClient->actionCollection(); 634 return mGUIClient->actionCollection();
635} 635}
636 636
637KABC::Field *KABCore::currentSearchField() const 637KABC::Field *KABCore::currentSearchField() const
638{ 638{
639 if (mIncSearchWidget) 639 if (mIncSearchWidget)
640 return mIncSearchWidget->currentField(); 640 return mIncSearchWidget->currentField();
641 else 641 else
642 return 0; 642 return 0;
643} 643}
644 644
645QStringList KABCore::selectedUIDs() const 645QStringList KABCore::selectedUIDs() const
646{ 646{
647 return mViewManager->selectedUids(); 647 return mViewManager->selectedUids();
648} 648}
649 649
650KABC::Resource *KABCore::requestResource( QWidget *parent ) 650KABC::Resource *KABCore::requestResource( QWidget *parent )
651{ 651{
652 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 652 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
653 653
654 QPtrList<KRES::Resource> kresResources; 654 QPtrList<KRES::Resource> kresResources;
655 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 655 QPtrListIterator<KABC::Resource> resIt( kabcResources );
656 KABC::Resource *resource; 656 KABC::Resource *resource;
657 while ( ( resource = resIt.current() ) != 0 ) { 657 while ( ( resource = resIt.current() ) != 0 ) {
658 ++resIt; 658 ++resIt;
659 if ( !resource->readOnly() ) { 659 if ( !resource->readOnly() ) {
660 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 660 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
661 if ( res ) 661 if ( res )
662 kresResources.append( res ); 662 kresResources.append( res );
663 } 663 }
664 } 664 }
665 665
666 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 666 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
667 return static_cast<KABC::Resource*>( res ); 667 return static_cast<KABC::Resource*>( res );
668} 668}
669 669
670#ifndef KAB_EMBEDDED 670#ifndef KAB_EMBEDDED
671KAboutData *KABCore::createAboutData() 671KAboutData *KABCore::createAboutData()
672#else //KAB_EMBEDDED 672#else //KAB_EMBEDDED
673void KABCore::createAboutData() 673void KABCore::createAboutData()
674#endif //KAB_EMBEDDED 674#endif //KAB_EMBEDDED
675{ 675{
676 676
677 677
678 QString version; 678 QString version;
679#include <../version> 679#include <../version>
680 QMessageBox::about( this, "About KAddressbook/Pi", 680 QMessageBox::about( this, "About KAddressbook/Pi",
681 "KAddressbook/Platform-independent\n" 681 "KAddressbook/Platform-independent\n"
682 "(KA/Pi) " +version + " - " + 682 "(KA/Pi) " +version + " - " +
683#ifdef DESKTOP_VERSION 683#ifdef DESKTOP_VERSION
684 "Desktop Edition\n" 684 "Desktop Edition\n"
685#else 685#else
686 "PDA-Edition\n" 686 "PDA-Edition\n"
687 "for: Zaurus 5500 / 7x0 / 8x0\n" 687 "for: Zaurus 5500 / 7x0 / 8x0\n"
688#endif 688#endif
689 689
690 "(c) 2004 Ulf Schenk\n" 690 "(c) 2004 Ulf Schenk\n"
691 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" 691 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
692 "(c) 1997-2003, The KDE PIM Team\n" 692 "(c) 1997-2003, The KDE PIM Team\n"
693 "Tobias Koenig Maintainer\n" 693 "Tobias Koenig Maintainer\n"
694 "Don Sanders Original author\n" 694 "Don Sanders Original author\n"
695 "Cornelius Schumacher Co-maintainer\n" 695 "Cornelius Schumacher Co-maintainer\n"
696 "Mike Pilone GUI and framework redesign\n" 696 "Mike Pilone GUI and framework redesign\n"
697 "Greg Stern DCOP interface\n" 697 "Greg Stern DCOP interface\n"
698 "Mark Westcot Contact pinning\n" 698 "Mark Westcot Contact pinning\n"
699 "Michel Boyer de la Giroday LDAP Lookup\n" 699 "Michel Boyer de la Giroday LDAP Lookup\n"
700 "Steffen Hansen LDAP Lookup" 700 "Steffen Hansen LDAP Lookup"
701#ifdef _WIN32_ 701#ifdef _WIN32_
702 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 702 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
703#endif 703#endif
704 ); 704 );
705} 705}
706 706
707void KABCore::setContactSelected( const QString &uid ) 707void KABCore::setContactSelected( const QString &uid )
708{ 708{
709 KABC::Addressee addr = mAddressBook->findByUid( uid ); 709 KABC::Addressee addr = mAddressBook->findByUid( uid );
710 if ( !mDetails->isHidden() ) 710 if ( !mDetails->isHidden() )
711 mDetails->setAddressee( addr ); 711 mDetails->setAddressee( addr );
712 712
713 if ( !addr.isEmpty() ) { 713 if ( !addr.isEmpty() ) {
714 emit contactSelected( addr.formattedName() ); 714 emit contactSelected( addr.formattedName() );
715 KABC::Picture pic = addr.photo(); 715 KABC::Picture pic = addr.photo();
716 if ( pic.isIntern() ) { 716 if ( pic.isIntern() ) {
717//US emit contactSelected( pic.data() ); 717//US emit contactSelected( pic.data() );
718//US instead use: 718//US instead use:
719 QPixmap px; 719 QPixmap px;
720 if (pic.data().isNull() != true) 720 if (pic.data().isNull() != true)
721 { 721 {
722 px.convertFromImage(pic.data()); 722 px.convertFromImage(pic.data());
723 } 723 }
724 724
725 emit contactSelected( px ); 725 emit contactSelected( px );
726 } 726 }
727 } 727 }
728 728
729 729
730 mExtensionManager->setSelectionChanged(); 730 mExtensionManager->setSelectionChanged();
731 731
732 // update the actions 732 // update the actions
733 bool selected = !uid.isEmpty(); 733 bool selected = !uid.isEmpty();
734 734
735 if ( mReadWrite ) { 735 if ( mReadWrite ) {
736 mActionCut->setEnabled( selected ); 736 mActionCut->setEnabled( selected );
737 mActionPaste->setEnabled( selected ); 737 mActionPaste->setEnabled( selected );
738 } 738 }
739 739
740 mActionCopy->setEnabled( selected ); 740 mActionCopy->setEnabled( selected );
741 mActionDelete->setEnabled( selected ); 741 mActionDelete->setEnabled( selected );
742 mActionEditAddressee->setEnabled( selected ); 742 mActionEditAddressee->setEnabled( selected );
743 mActionMail->setEnabled( selected ); 743 mActionMail->setEnabled( selected );
744 mActionMailVCard->setEnabled( selected ); 744 mActionMailVCard->setEnabled( selected );
745 //if (mActionBeam) 745 //if (mActionBeam)
746 //mActionBeam->setEnabled( selected ); 746 //mActionBeam->setEnabled( selected );
747 mActionWhoAmI->setEnabled( selected ); 747 mActionWhoAmI->setEnabled( selected );
748} 748}
749 749
750void KABCore::sendMail() 750void KABCore::sendMail()
751{ 751{
752 sendMail( mViewManager->selectedEmails().join( ", " ) ); 752 sendMail( mViewManager->selectedEmails().join( ", " ) );
753} 753}
754 754
755void KABCore::sendMail( const QString& emaillist ) 755void KABCore::sendMail( const QString& emaillist )
756{ 756{
757 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 757 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
758 if (emaillist.contains(",") > 0) 758 if (emaillist.contains(",") > 0)
759 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 759 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
760 else 760 else
761 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 761 ExternalAppHandler::instance()->mailToOneContact( emaillist );
762} 762}
763 763
764 764
765 765
766void KABCore::mailVCard() 766void KABCore::mailVCard()
767{ 767{
768 QStringList uids = mViewManager->selectedUids(); 768 QStringList uids = mViewManager->selectedUids();
769 if ( !uids.isEmpty() ) 769 if ( !uids.isEmpty() )
770 mailVCard( uids ); 770 mailVCard( uids );
771} 771}
772 772
773void KABCore::mailVCard( const QStringList& uids ) 773void KABCore::mailVCard( const QStringList& uids )
774{ 774{
775 QStringList urls; 775 QStringList urls;
776 776
777// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 777// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
778 778
779 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 779 QString dirName = "/tmp/" + KApplication::randomString( 8 );
780 780
781 781
782 782
783 QDir().mkdir( dirName, true ); 783 QDir().mkdir( dirName, true );
784 784
785 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 785 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
786 KABC::Addressee a = mAddressBook->findByUid( *it ); 786 KABC::Addressee a = mAddressBook->findByUid( *it );
787 787
788 if ( a.isEmpty() ) 788 if ( a.isEmpty() )
789 continue; 789 continue;
790 790
791 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 791 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
792 792
793 QString fileName = dirName + "/" + name; 793 QString fileName = dirName + "/" + name;
794 794
795 QFile outFile(fileName); 795 QFile outFile(fileName);
796 796
797 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 797 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
798 KABC::VCardConverter converter; 798 KABC::VCardConverter converter;
799 QString vcard; 799 QString vcard;
800 800
801 converter.addresseeToVCard( a, vcard ); 801 converter.addresseeToVCard( a, vcard );
802 802
803 QTextStream t( &outFile ); // use a text stream 803 QTextStream t( &outFile ); // use a text stream
804 t.setEncoding( QTextStream::UnicodeUTF8 ); 804 t.setEncoding( QTextStream::UnicodeUTF8 );
805 t << vcard; 805 t << vcard;
806 806
807 outFile.close(); 807 outFile.close();
808 808
809 urls.append( fileName ); 809 urls.append( fileName );
810 } 810 }
811 } 811 }
812 812
813 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 813 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
814 814
815 815
816/*US 816/*US
817 kapp->invokeMailer( QString::null, QString::null, QString::null, 817 kapp->invokeMailer( QString::null, QString::null, QString::null,
818 QString::null, // subject 818 QString::null, // subject
819 QString::null, // body 819 QString::null, // body
820 QString::null, 820 QString::null,
821 urls ); // attachments 821 urls ); // attachments
822*/ 822*/
823 823
824} 824}
825 825
826/** 826/**
827 Beams the "WhoAmI contact. 827 Beams the "WhoAmI contact.
828*/ 828*/
829void KABCore::beamMySelf() 829void KABCore::beamMySelf()
830{ 830{
831 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 831 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
832 if (!a.isEmpty()) 832 if (!a.isEmpty())
833 { 833 {
834 QStringList uids; 834 QStringList uids;
835 uids << a.uid(); 835 uids << a.uid();
836 836
837 beamVCard(uids); 837 beamVCard(uids);
838 } else { 838 } else {
839 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 839 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
840 840
841 841
842 } 842 }
843} 843}
844void KABCore::updateMainWindow() 844void KABCore::updateMainWindow()
845{ 845{
846 mMainWindow->showMaximized(); 846 mMainWindow->showMaximized();
847 mMainWindow->update(); 847 //mMainWindow->repaint();
848} 848}
849void KABCore::resizeEvent(QResizeEvent* e ) 849void KABCore::resizeEvent(QResizeEvent* e )
850{ 850{
851 if ( !mMiniSplitter ) 851 if ( !mMiniSplitter )
852 return; 852 return;
853 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 853 static int desktop_width = 0;
854 if ( e->oldSize().width() != e->size().width() ) 854 //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() );
855 if ( desktop_width != QApplication::desktop()->width() )
855 if ( QApplication::desktop()->width() >= 480 ) { 856 if ( QApplication::desktop()->width() >= 480 ) {
856 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 857 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
858 //qDebug("640 ");
857 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 859 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
860 //qDebug("switch V->H ");
858 mMiniSplitter->setOrientation( Qt::Horizontal); 861 mMiniSplitter->setOrientation( Qt::Horizontal);
859 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 862 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
860 } 863 }
861 if ( QApplication::desktop()->width() <= 640 ) { 864 if ( QApplication::desktop()->width() <= 640 ) {
865 bool shot = mMainWindow->isVisible();
862 mMainWindow->showMinimized(); 866 mMainWindow->showMinimized();
863 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 867 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
864 mViewManager->getFilterAction()->setComboWidth( 150 ); 868 mViewManager->getFilterAction()->setComboWidth( 150 );
865 if ( mIncSearchWidget ) 869 if ( mIncSearchWidget )
866 mIncSearchWidget->setSize(); 870 mIncSearchWidget->setSize();
867 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 871 if ( shot )
872 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
868 } 873 }
869 874
870 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 875 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
876 //qDebug("480 ");
871 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 877 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
878 //qDebug("switch H->V ");
872 mMiniSplitter->setOrientation( Qt::Vertical ); 879 mMiniSplitter->setOrientation( Qt::Vertical );
873 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 880 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
874 } 881 }
875 if ( QApplication::desktop()->width() <= 640 ) { 882 if ( QApplication::desktop()->width() <= 640 ) {
876 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 883 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
884 bool shot = mMainWindow->isVisible();
877 mMainWindow->showMinimized(); 885 mMainWindow->showMinimized();
878 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 886 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
879 if ( mIncSearchWidget ) { 887 if ( mIncSearchWidget ) {
880 mIncSearchWidget->setSize(); 888 mIncSearchWidget->setSize();
881 } 889 }
882 } else { 890 } else {
883 mViewManager->getFilterAction()->setComboWidth( 0 ); 891 mViewManager->getFilterAction()->setComboWidth( 0 );
884 } 892 }
885 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 893 if ( shot )
894 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
886 } 895 }
887 } 896 }
888 } 897 }
898 desktop_width = QApplication::desktop()->width();
889 QWidget::resizeEvent( e ); 899 QWidget::resizeEvent( e );
890 900
891} 901}
892void KABCore::export2phone() 902void KABCore::export2phone()
893{ 903{
894 904
895 QStringList uids; 905 QStringList uids;
896 XXPortSelectDialog dlg( this, false, this ); 906 XXPortSelectDialog dlg( this, false, this );
897 if ( dlg.exec() ) 907 if ( dlg.exec() )
898 uids = dlg.uids(); 908 uids = dlg.uids();
899 else 909 else
900 return; 910 return;
901 if ( uids.isEmpty() ) 911 if ( uids.isEmpty() )
902 return; 912 return;
903 // qDebug("count %d ", uids.count()); 913 // qDebug("count %d ", uids.count());
904 914
905 KAex2phonePrefs ex2phone; 915 KAex2phonePrefs ex2phone;
906 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 916 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
907 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 917 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
908 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 918 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
909 919
910 if ( !ex2phone.exec() ) { 920 if ( !ex2phone.exec() ) {
911 return; 921 return;
912 } 922 }
913 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 923 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
914 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 924 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
915 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 925 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
916 926
917 927
918 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 928 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
919 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 929 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
920 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 930 KPimGlobalPrefs::instance()->mEx2PhoneModel );
921 931
922 QString fileName = getPhoneFile(); 932 QString fileName = getPhoneFile();
923 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 933 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
924 return; 934 return;
925 935
926 message(i18n("Exporting to phone...")); 936 message(i18n("Exporting to phone..."));
927 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 937 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
928 938
929} 939}
930QString KABCore::getPhoneFile() 940QString KABCore::getPhoneFile()
931{ 941{
932#ifdef DESKTOP_VERSION 942#ifdef DESKTOP_VERSION
933 return locateLocal("tmp", "phonefile.vcf"); 943 return locateLocal("tmp", "phonefile.vcf");
934#else 944#else
935 return "/tmp/phonefile.vcf"; 945 return "/tmp/phonefile.vcf";
936#endif 946#endif
937 947
938} 948}
939void KABCore::writeToPhone( ) 949void KABCore::writeToPhone( )
940{ 950{
941 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 951 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
942 message(i18n("Export to phone finished!")); 952 message(i18n("Export to phone finished!"));
943 else 953 else
944 qDebug(i18n("KA: Error exporting to phone")); 954 qDebug(i18n("KA: Error exporting to phone"));
945} 955}
946void KABCore::beamVCard() 956void KABCore::beamVCard()
947{ 957{
948 QStringList uids; 958 QStringList uids;
949 XXPortSelectDialog dlg( this, false, this ); 959 XXPortSelectDialog dlg( this, false, this );
950 if ( dlg.exec() ) 960 if ( dlg.exec() )
951 uids = dlg.uids(); 961 uids = dlg.uids();
952 else 962 else
953 return; 963 return;
954 if ( uids.isEmpty() ) 964 if ( uids.isEmpty() )
955 return; 965 return;
956 beamVCard( uids ); 966 beamVCard( uids );
957} 967}
958 968
959 969
960void KABCore::beamVCard(const QStringList& uids) 970void KABCore::beamVCard(const QStringList& uids)
961{ 971{
962 972
963 // LR: we should use the /tmp dir on the Zaurus, 973 // LR: we should use the /tmp dir on the Zaurus,
964 // because: /tmp = RAM, (HOME)/kdepim = flash memory 974 // because: /tmp = RAM, (HOME)/kdepim = flash memory
965 975
966#ifdef DESKTOP_VERSION 976#ifdef DESKTOP_VERSION
967 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 977 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
968#else 978#else
969 QString fileName = "/tmp/kapibeamfile.vcf"; 979 QString fileName = "/tmp/kapibeamfile.vcf";
970#endif 980#endif
971 981
972 KABC::VCardConverter converter; 982 KABC::VCardConverter converter;
973 QString description; 983 QString description;
974 QString datastream; 984 QString datastream;
975 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 985 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
976 KABC::Addressee a = mAddressBook->findByUid( *it ); 986 KABC::Addressee a = mAddressBook->findByUid( *it );
977 987
978 if ( a.isEmpty() ) 988 if ( a.isEmpty() )
979 continue; 989 continue;
980 990
981 if (description.isEmpty()) 991 if (description.isEmpty())
982 description = a.formattedName(); 992 description = a.formattedName();
983 993
984 QString vcard; 994 QString vcard;
985 converter.addresseeToVCard( a, vcard ); 995 converter.addresseeToVCard( a, vcard );
986 int start = 0; 996 int start = 0;
987 int next; 997 int next;
988 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 998 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
989 int semi = vcard.find(";", next); 999 int semi = vcard.find(";", next);
990 int dopp = vcard.find(":", next); 1000 int dopp = vcard.find(":", next);
991 int sep; 1001 int sep;
992 if ( semi < dopp && semi >= 0 ) 1002 if ( semi < dopp && semi >= 0 )
993 sep = semi ; 1003 sep = semi ;
994 else 1004 else
995 sep = dopp; 1005 sep = dopp;
996 datastream +=vcard.mid( start, next - start); 1006 datastream +=vcard.mid( start, next - start);
997 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 1007 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
998 start = sep; 1008 start = sep;
999 } 1009 }
1000 datastream += vcard.mid( start,vcard.length() ); 1010 datastream += vcard.mid( start,vcard.length() );
1001 } 1011 }
1002#ifndef DESKTOP_VERSION 1012#ifndef DESKTOP_VERSION
1003 QFile outFile(fileName); 1013 QFile outFile(fileName);
1004 if ( outFile.open(IO_WriteOnly) ) { 1014 if ( outFile.open(IO_WriteOnly) ) {
1005 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 1015 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
1006 QTextStream t( &outFile ); // use a text stream 1016 QTextStream t( &outFile ); // use a text stream
1007 //t.setEncoding( QTextStream::UnicodeUTF8 ); 1017 //t.setEncoding( QTextStream::UnicodeUTF8 );
1008 t.setEncoding( QTextStream::Latin1 ); 1018 t.setEncoding( QTextStream::Latin1 );
1009 t <<datastream.latin1(); 1019 t <<datastream.latin1();
1010 outFile.close(); 1020 outFile.close();
1011 Ir *ir = new Ir( this ); 1021 Ir *ir = new Ir( this );
1012 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 1022 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
1013 ir->send( fileName, description, "text/x-vCard" ); 1023 ir->send( fileName, description, "text/x-vCard" );
1014 } else { 1024 } else {
1015 qDebug("KA: Error open temp beam file "); 1025 qDebug("KA: Error open temp beam file ");
1016 return; 1026 return;
1017 } 1027 }
1018#endif 1028#endif
1019 1029
1020} 1030}
1021 1031
1022void KABCore::beamDone( Ir *ir ) 1032void KABCore::beamDone( Ir *ir )
1023{ 1033{
1024#ifndef DESKTOP_VERSION 1034#ifndef DESKTOP_VERSION
1025 delete ir; 1035 delete ir;
1026#endif 1036#endif
1027 topLevelWidget()->raise(); 1037 topLevelWidget()->raise();
1028 message( i18n("Beaming finished!") ); 1038 message( i18n("Beaming finished!") );
1029} 1039}
1030 1040
1031 1041
1032void KABCore::browse( const QString& url ) 1042void KABCore::browse( const QString& url )
1033{ 1043{
1034#ifndef KAB_EMBEDDED 1044#ifndef KAB_EMBEDDED
1035 kapp->invokeBrowser( url ); 1045 kapp->invokeBrowser( url );
1036#else //KAB_EMBEDDED 1046#else //KAB_EMBEDDED
1037 qDebug("KABCore::browse must be fixed"); 1047 qDebug("KABCore::browse must be fixed");
1038#endif //KAB_EMBEDDED 1048#endif //KAB_EMBEDDED
1039} 1049}
1040 1050
1041void KABCore::selectAllContacts() 1051void KABCore::selectAllContacts()
1042{ 1052{
1043 mViewManager->setSelected( QString::null, true ); 1053 mViewManager->setSelected( QString::null, true );
1044} 1054}
1045 1055
1046void KABCore::deleteContacts() 1056void KABCore::deleteContacts()
1047{ 1057{
1048 QStringList uidList = mViewManager->selectedUids(); 1058 QStringList uidList = mViewManager->selectedUids();
1049 deleteContacts( uidList ); 1059 deleteContacts( uidList );
1050} 1060}
1051 1061
1052void KABCore::deleteContacts( const QStringList &uids ) 1062void KABCore::deleteContacts( const QStringList &uids )
1053{ 1063{
1054 1064
1055 if ( uids.count() > 0 ) { 1065 if ( uids.count() > 0 ) {
1056 1066
1057 if ( KABPrefs::instance()->mAskForDelete ) { 1067 if ( KABPrefs::instance()->mAskForDelete ) {
1058 int count = uids.count(); 1068 int count = uids.count();
1059 if ( count > 5 ) count = 5; 1069 if ( count > 5 ) count = 5;
1060 QString cNames; 1070 QString cNames;
1061 int i; 1071 int i;
1062 for ( i = 0; i < count ; ++i ) { 1072 for ( i = 0; i < count ; ++i ) {
1063 cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n"; 1073 cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n";
1064 } 1074 }
1065 if ( uids.count() > 5 ) 1075 if ( uids.count() > 5 )
1066 cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 ); 1076 cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 );
1067 QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ; 1077 QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ;
1068 if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes ) 1078 if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes )
1069 return; 1079 return;
1070 } 1080 }
1071 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1081 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1072 UndoStack::instance()->push( command ); 1082 UndoStack::instance()->push( command );
1073 RedoStack::instance()->clear(); 1083 RedoStack::instance()->clear();
1074 1084
1075 // now if we deleted anything, refresh 1085 // now if we deleted anything, refresh
1076 setContactSelected( QString::null ); 1086 setContactSelected( QString::null );
1077 setModified( true ); 1087 setModified( true );
1078 } 1088 }
1079} 1089}
1080 1090
1081void KABCore::copyContacts() 1091void KABCore::copyContacts()
1082{ 1092{
1083 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1084 1094
1085 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1095 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1086 1096
1087 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1097 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1088 1098
1089 QClipboard *cb = QApplication::clipboard(); 1099 QClipboard *cb = QApplication::clipboard();
1090 cb->setText( clipText ); 1100 cb->setText( clipText );
1091} 1101}
1092 1102
1093void KABCore::cutContacts() 1103void KABCore::cutContacts()
1094{ 1104{
1095 QStringList uidList = mViewManager->selectedUids(); 1105 QStringList uidList = mViewManager->selectedUids();
1096 1106
1097//US if ( uidList.size() > 0 ) { 1107//US if ( uidList.size() > 0 ) {
1098 if ( uidList.count() > 0 ) { 1108 if ( uidList.count() > 0 ) {
1099 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1109 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1100 UndoStack::instance()->push( command ); 1110 UndoStack::instance()->push( command );
1101 RedoStack::instance()->clear(); 1111 RedoStack::instance()->clear();
1102 1112
1103 setModified( true ); 1113 setModified( true );
1104 } 1114 }
1105} 1115}
1106 1116
1107void KABCore::pasteContacts() 1117void KABCore::pasteContacts()
1108{ 1118{
1109 QClipboard *cb = QApplication::clipboard(); 1119 QClipboard *cb = QApplication::clipboard();
1110 1120
1111 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1121 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1112 1122
1113 pasteContacts( list ); 1123 pasteContacts( list );
1114} 1124}
1115 1125
1116void KABCore::pasteContacts( KABC::Addressee::List &list ) 1126void KABCore::pasteContacts( KABC::Addressee::List &list )
1117{ 1127{
1118 KABC::Resource *resource = requestResource( this ); 1128 KABC::Resource *resource = requestResource( this );
1119 KABC::Addressee::List::Iterator it; 1129 KABC::Addressee::List::Iterator it;
1120 for ( it = list.begin(); it != list.end(); ++it ) 1130 for ( it = list.begin(); it != list.end(); ++it )
1121 (*it).setResource( resource ); 1131 (*it).setResource( resource );
1122 1132
1123 PwPasteCommand *command = new PwPasteCommand( this, list ); 1133 PwPasteCommand *command = new PwPasteCommand( this, list );
1124 UndoStack::instance()->push( command ); 1134 UndoStack::instance()->push( command );
1125 RedoStack::instance()->clear(); 1135 RedoStack::instance()->clear();
1126 1136
1127 setModified( true ); 1137 setModified( true );
1128} 1138}
1129 1139
1130void KABCore::setWhoAmI() 1140void KABCore::setWhoAmI()
1131{ 1141{
1132 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1142 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1133 1143
1134 if ( addrList.count() > 1 ) { 1144 if ( addrList.count() > 1 ) {
1135 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1145 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1136 return; 1146 return;
1137 } 1147 }
1138 1148
1139 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1149 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1140 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes ) 1150 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes )
1141 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1151 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1142} 1152}
1143void KABCore::editCategories() 1153void KABCore::editCategories()
1144{ 1154{
1145 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1155 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1146 dlg.exec(); 1156 dlg.exec();
1147} 1157}
1148void KABCore::setCategories() 1158void KABCore::setCategories()
1149{ 1159{
1150 1160
1151 QStringList uids; 1161 QStringList uids;
1152 XXPortSelectDialog dlgx( this, false, this ); 1162 XXPortSelectDialog dlgx( this, false, this );
1153 if ( dlgx.exec() ) 1163 if ( dlgx.exec() )
1154 uids = dlgx.uids(); 1164 uids = dlgx.uids();
1155 else 1165 else
1156 return; 1166 return;
1157 if ( uids.isEmpty() ) 1167 if ( uids.isEmpty() )
1158 return; 1168 return;
1159 // qDebug("count %d ", uids.count()); 1169 // qDebug("count %d ", uids.count());
1160 1170
1161 1171
1162 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1172 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1163 if ( !dlg.exec() ) { 1173 if ( !dlg.exec() ) {
1164 message( i18n("Setting categories cancelled") ); 1174 message( i18n("Setting categories cancelled") );
1165 return; 1175 return;
1166 } 1176 }
1167 bool merge = false; 1177 bool merge = false;
1168 QString msg = i18n( "Merge with existing categories?" ); 1178 QString msg = i18n( "Merge with existing categories?" );
1169 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1179 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1170 merge = true; 1180 merge = true;
1171 1181
1172 message( i18n("Setting categories ... please wait!") ); 1182 message( i18n("Setting categories ... please wait!") );
1173 QStringList categories = dlg.selectedCategories(); 1183 QStringList categories = dlg.selectedCategories();
1174 1184
1175 //QStringList uids = mViewManager->selectedUids(); 1185 //QStringList uids = mViewManager->selectedUids();
1176 QStringList::Iterator it; 1186 QStringList::Iterator it;
1177 for ( it = uids.begin(); it != uids.end(); ++it ) { 1187 for ( it = uids.begin(); it != uids.end(); ++it ) {
1178 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1188 KABC::Addressee addr = mAddressBook->findByUid( *it );
1179 if ( !addr.isEmpty() ) { 1189 if ( !addr.isEmpty() ) {
1180 if ( !merge ) 1190 if ( !merge )
1181 addr.setCategories( categories ); 1191 addr.setCategories( categories );
1182 else { 1192 else {
1183 QStringList addrCategories = addr.categories(); 1193 QStringList addrCategories = addr.categories();
1184 QStringList::Iterator catIt; 1194 QStringList::Iterator catIt;
1185 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1195 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1186 if ( !addrCategories.contains( *catIt ) ) 1196 if ( !addrCategories.contains( *catIt ) )
1187 addrCategories.append( *catIt ); 1197 addrCategories.append( *catIt );
1188 } 1198 }
1189 addr.setCategories( addrCategories ); 1199 addr.setCategories( addrCategories );
1190 } 1200 }
1191 mAddressBook->insertAddressee( addr ); 1201 mAddressBook->insertAddressee( addr );
1192 } 1202 }
1193 } 1203 }
1194 1204
1195 if ( uids.count() > 0 ) 1205 if ( uids.count() > 0 )
1196 setModified( true ); 1206 setModified( true );
1197 message( i18n("Setting categories completed!") ); 1207 message( i18n("Setting categories completed!") );
1198} 1208}
1199 1209
1200void KABCore::setSearchFields( const KABC::Field::List &fields ) 1210void KABCore::setSearchFields( const KABC::Field::List &fields )
1201{ 1211{
1202 mIncSearchWidget->setFields( fields ); 1212 mIncSearchWidget->setFields( fields );
1203} 1213}
1204 1214
1205void KABCore::incrementalSearch( const QString& text ) 1215void KABCore::incrementalSearch( const QString& text )
1206{ 1216{
1207 QString stext; 1217 QString stext;
1208 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1218 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1209 stext = "*" + text; 1219 stext = "*" + text;
1210 } else { 1220 } else {
1211 stext = text; 1221 stext = text;
1212 } 1222 }
1213 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1223 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1214} 1224}
1215void KABCore::incrementalSearchJump( const QString& text ) 1225void KABCore::incrementalSearchJump( const QString& text )
1216{ 1226{
1217 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1227 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1218} 1228}
1219 1229
1220void KABCore::setModified() 1230void KABCore::setModified()
1221{ 1231{
1222 setModified( true ); 1232 setModified( true );
1223} 1233}
1224 1234
1225void KABCore::setModifiedWOrefresh() 1235void KABCore::setModifiedWOrefresh()
1226{ 1236{
1227 // qDebug("KABCore::setModifiedWOrefresh() "); 1237 // qDebug("KABCore::setModifiedWOrefresh() ");
1228 mModified = true; 1238 mModified = true;
1229 mActionSave->setEnabled( mModified ); 1239 mActionSave->setEnabled( mModified );
1230 1240
1231 1241
1232} 1242}
1233void KABCore::setModified( bool modified ) 1243void KABCore::setModified( bool modified )
1234{ 1244{
1235 mModified = modified; 1245 mModified = modified;
1236 mActionSave->setEnabled( mModified ); 1246 mActionSave->setEnabled( mModified );
1237 1247
1238 if ( modified ) 1248 if ( modified )
1239 mJumpButtonBar->recreateButtons(); 1249 mJumpButtonBar->recreateButtons();
1240 1250
1241 mViewManager->refreshView(); 1251 mViewManager->refreshView();
1242 1252
1243} 1253}
1244 1254
1245bool KABCore::modified() const 1255bool KABCore::modified() const
1246{ 1256{
1247 return mModified; 1257 return mModified;
1248} 1258}
1249 1259
1250void KABCore::contactModified( const KABC::Addressee &addr ) 1260void KABCore::contactModified( const KABC::Addressee &addr )
1251{ 1261{
1252 addrModified( addr ); 1262 addrModified( addr );
1253#if 0 // debug only 1263#if 0 // debug only
1254 KABC::Addressee ad = addr; 1264 KABC::Addressee ad = addr;
1255 ad.computeCsum( "123"); 1265 ad.computeCsum( "123");
1256#endif 1266#endif
1257} 1267}
1258 1268
1259void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1269void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1260{ 1270{
1261 1271
1262 Command *command = 0; 1272 Command *command = 0;
1263 QString uid; 1273 QString uid;
1264 1274
1265 // check if it exists already 1275 // check if it exists already
1266 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1276 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1267 if ( origAddr.isEmpty() ) 1277 if ( origAddr.isEmpty() )
1268 command = new PwNewCommand( mAddressBook, addr ); 1278 command = new PwNewCommand( mAddressBook, addr );
1269 else { 1279 else {
1270 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1280 command = new PwEditCommand( mAddressBook, origAddr, addr );
1271 uid = addr.uid(); 1281 uid = addr.uid();
1272 } 1282 }
1273 1283
1274 UndoStack::instance()->push( command ); 1284 UndoStack::instance()->push( command );
1275 RedoStack::instance()->clear(); 1285 RedoStack::instance()->clear();
1276 if ( updateDetails ) 1286 if ( updateDetails )
1277 mDetails->setAddressee( addr ); 1287 mDetails->setAddressee( addr );
1278 setModified( true ); 1288 setModified( true );
1279} 1289}
1280 1290
1281void KABCore::newContact() 1291void KABCore::newContact()
1282{ 1292{
1283 1293
1284 1294
1285 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1295 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1286 1296
1287 QPtrList<KRES::Resource> kresResources; 1297 QPtrList<KRES::Resource> kresResources;
1288 QPtrListIterator<KABC::Resource> it( kabcResources ); 1298 QPtrListIterator<KABC::Resource> it( kabcResources );
1289 KABC::Resource *resource; 1299 KABC::Resource *resource;
1290 while ( ( resource = it.current() ) != 0 ) { 1300 while ( ( resource = it.current() ) != 0 ) {
1291 ++it; 1301 ++it;
1292 if ( !resource->readOnly() ) { 1302 if ( !resource->readOnly() ) {
1293 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1303 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1294 if ( res ) 1304 if ( res )
1295 kresResources.append( res ); 1305 kresResources.append( res );
1296 } 1306 }
1297 } 1307 }
1298 1308
1299 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1309 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1300 resource = static_cast<KABC::Resource*>( res ); 1310 resource = static_cast<KABC::Resource*>( res );
1301 1311
1302 if ( resource ) { 1312 if ( resource ) {
1303 KABC::Addressee addr; 1313 KABC::Addressee addr;
1304 addr.setResource( resource ); 1314 addr.setResource( resource );
1305 mEditorDialog->setAddressee( addr ); 1315 mEditorDialog->setAddressee( addr );
1306 mEditorDialog->setCaption( i18n("Edit new contact")); 1316 mEditorDialog->setCaption( i18n("Edit new contact"));
1307 KApplication::execDialog ( mEditorDialog ); 1317 KApplication::execDialog ( mEditorDialog );
1308 1318
1309 } else 1319 } else
1310 return; 1320 return;
1311 1321
1312 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1322 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1313 1323
1314 1324
1315} 1325}
1316 1326
1317void KABCore::addEmail( QString aStr ) 1327void KABCore::addEmail( QString aStr )
1318{ 1328{
1319#ifndef KAB_EMBEDDED 1329#ifndef KAB_EMBEDDED
1320 QString fullName, email; 1330 QString fullName, email;
1321 1331
1322 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1332 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1323 1333
1324 // Try to lookup the addressee matching the email address 1334 // Try to lookup the addressee matching the email address
1325 bool found = false; 1335 bool found = false;
1326 QStringList emailList; 1336 QStringList emailList;
1327 KABC::AddressBook::Iterator it; 1337 KABC::AddressBook::Iterator it;
1328 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1338 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1329 emailList = (*it).emails(); 1339 emailList = (*it).emails();
1330 if ( emailList.contains( email ) > 0 ) { 1340 if ( emailList.contains( email ) > 0 ) {
1331 found = true; 1341 found = true;
1332 (*it).setNameFromString( fullName ); 1342 (*it).setNameFromString( fullName );
1333 editContact( (*it).uid() ); 1343 editContact( (*it).uid() );
1334 } 1344 }
1335 } 1345 }
1336 1346
1337 if ( !found ) { 1347 if ( !found ) {
1338 KABC::Addressee addr; 1348 KABC::Addressee addr;
1339 addr.setNameFromString( fullName ); 1349 addr.setNameFromString( fullName );
1340 addr.insertEmail( email, true ); 1350 addr.insertEmail( email, true );
1341 1351
1342 mAddressBook->insertAddressee( addr ); 1352 mAddressBook->insertAddressee( addr );
1343 mViewManager->refreshView( addr.uid() ); 1353 mViewManager->refreshView( addr.uid() );
1344 editContact( addr.uid() ); 1354 editContact( addr.uid() );
1345 } 1355 }
1346#else //KAB_EMBEDDED 1356#else //KAB_EMBEDDED
1347 qDebug("KABCore::addEmail finsih method"); 1357 qDebug("KABCore::addEmail finsih method");
1348#endif //KAB_EMBEDDED 1358#endif //KAB_EMBEDDED
1349} 1359}
1350 1360
1351void KABCore::importVCard( const KURL &url, bool showPreview ) 1361void KABCore::importVCard( const KURL &url, bool showPreview )
1352{ 1362{
1353 mXXPortManager->importVCard( url, showPreview ); 1363 mXXPortManager->importVCard( url, showPreview );
1354} 1364}
1355void KABCore::importFromOL() 1365void KABCore::importFromOL()
1356{ 1366{
1357#ifdef _OL_IMPORT_ 1367#ifdef _OL_IMPORT_
1358 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1368 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1359 idgl->exec(); 1369 idgl->exec();
1360 KABC::Addressee::List list = idgl->getAddressList(); 1370 KABC::Addressee::List list = idgl->getAddressList();
1361 if ( list.count() > 0 ) { 1371 if ( list.count() > 0 ) {
1362 KABC::Addressee::List listNew; 1372 KABC::Addressee::List listNew;
1363 KABC::Addressee::List listExisting; 1373 KABC::Addressee::List listExisting;
1364 KABC::Addressee::List::Iterator it; 1374 KABC::Addressee::List::Iterator it;
1365 KABC::AddressBook::Iterator iter; 1375 KABC::AddressBook::Iterator iter;
1366 for ( it = list.begin(); it != list.end(); ++it ) { 1376 for ( it = list.begin(); it != list.end(); ++it ) {
1367 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1377 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1368 listNew.append( (*it) ); 1378 listNew.append( (*it) );
1369 else 1379 else
1370 listExisting.append( (*it) ); 1380 listExisting.append( (*it) );
1371 } 1381 }
1372 if ( listExisting.count() > 0 ) 1382 if ( listExisting.count() > 0 )
1373 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1383 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1374 if ( listNew.count() > 0 ) { 1384 if ( listNew.count() > 0 ) {
1375 pasteWithNewUid = false; 1385 pasteWithNewUid = false;
1376 pasteContacts( listNew ); 1386 pasteContacts( listNew );
1377 pasteWithNewUid = true; 1387 pasteWithNewUid = true;
1378 } 1388 }
1379 } 1389 }
1380 delete idgl; 1390 delete idgl;
1381#endif 1391#endif
1382} 1392}
1383 1393
1384void KABCore::importVCard( const QString &vCard, bool showPreview ) 1394void KABCore::importVCard( const QString &vCard, bool showPreview )
1385{ 1395{
1386 mXXPortManager->importVCard( vCard, showPreview ); 1396 mXXPortManager->importVCard( vCard, showPreview );
1387} 1397}
1388 1398
1389//US added a second method without defaultparameter 1399//US added a second method without defaultparameter
1390void KABCore::editContact2() { 1400void KABCore::editContact2() {
1391 editContact( QString::null ); 1401 editContact( QString::null );
1392} 1402}
1393 1403
1394void KABCore::editContact( const QString &uid ) 1404void KABCore::editContact( const QString &uid )
1395{ 1405{
1396 1406
1397 if ( mExtensionManager->isQuickEditVisible() ) 1407 if ( mExtensionManager->isQuickEditVisible() )
1398 return; 1408 return;
1399 1409
1400 // First, locate the contact entry 1410 // First, locate the contact entry
1401 QString localUID = uid; 1411 QString localUID = uid;
1402 if ( localUID.isNull() ) { 1412 if ( localUID.isNull() ) {
1403 QStringList uidList = mViewManager->selectedUids(); 1413 QStringList uidList = mViewManager->selectedUids();
1404 if ( uidList.count() > 0 ) 1414 if ( uidList.count() > 0 )
1405 localUID = *( uidList.at( 0 ) ); 1415 localUID = *( uidList.at( 0 ) );
1406 } 1416 }
1407 1417
1408 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1418 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1409 if ( !addr.isEmpty() ) { 1419 if ( !addr.isEmpty() ) {
1410 mEditorDialog->setAddressee( addr ); 1420 mEditorDialog->setAddressee( addr );
1411 KApplication::execDialog ( mEditorDialog ); 1421 KApplication::execDialog ( mEditorDialog );
1412 } 1422 }
1413} 1423}
1414 1424
1415/** 1425/**
1416 Shows or edits the detail view for the given uid. If the uid is QString::null, 1426 Shows or edits the detail view for the given uid. If the uid is QString::null,
1417 the method will try to find a selected addressee in the view. 1427 the method will try to find a selected addressee in the view.
1418 */ 1428 */
1419void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1429void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1420{ 1430{
1421 if ( mMultipleViewsAtOnce ) 1431 if ( mMultipleViewsAtOnce )
1422 { 1432 {
1423 editContact( uid ); 1433 editContact( uid );
1424 } 1434 }
1425 else 1435 else
1426 { 1436 {
1427 setDetailsVisible( true ); 1437 setDetailsVisible( true );
1428 mActionDetails->setChecked(true); 1438 mActionDetails->setChecked(true);
1429 } 1439 }
1430 1440
1431} 1441}
1432 1442
1433void KABCore::save() 1443void KABCore::save()
1434{ 1444{
1435 if (syncManager->blockSave()) 1445 if (syncManager->blockSave())
1436 return; 1446 return;
1437 if ( !mModified ) 1447 if ( !mModified )
1438 return; 1448 return;
1439 1449
1440 syncManager->setBlockSave(true); 1450 syncManager->setBlockSave(true);
1441 QString text = i18n( "There was an error while attempting to save\n the " 1451 QString text = i18n( "There was an error while attempting to save\n the "
1442 "address book. Please check that some \nother application is " 1452 "address book. Please check that some \nother application is "
1443 "not using it. " ); 1453 "not using it. " );
1444 message(i18n("Saving ... please wait! "), false); 1454 message(i18n("Saving ... please wait! "), false);
1445 //qApp->processEvents(); 1455 //qApp->processEvents();
1446#ifndef KAB_EMBEDDED 1456#ifndef KAB_EMBEDDED
1447 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1457 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1448 if ( !b || !b->save() ) { 1458 if ( !b || !b->save() ) {
1449 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1459 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1450 } 1460 }
1451#else //KAB_EMBEDDED 1461#else //KAB_EMBEDDED
1452 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1462 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1453 if ( !b || !b->save() ) { 1463 if ( !b || !b->save() ) {
1454 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1464 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1455 } 1465 }
1456#endif //KAB_EMBEDDED 1466#endif //KAB_EMBEDDED
1457 1467
1458 message(i18n("Addressbook saved!")); 1468 message(i18n("Addressbook saved!"));
1459 setModified( false ); 1469 setModified( false );
1460 syncManager->setBlockSave(false); 1470 syncManager->setBlockSave(false);
1461} 1471}
1462 1472
1463 1473
1464void KABCore::undo() 1474void KABCore::undo()
1465{ 1475{
1466 UndoStack::instance()->undo(); 1476 UndoStack::instance()->undo();
1467 1477
1468 // Refresh the view 1478 // Refresh the view
1469 mViewManager->refreshView(); 1479 mViewManager->refreshView();
1470} 1480}
1471 1481
1472void KABCore::redo() 1482void KABCore::redo()
1473{ 1483{
1474 RedoStack::instance()->redo(); 1484 RedoStack::instance()->redo();
1475 1485
1476 // Refresh the view 1486 // Refresh the view
1477 mViewManager->refreshView(); 1487 mViewManager->refreshView();
1478} 1488}
1479void KABCore::setJumpButtonBar( bool visible ) 1489void KABCore::setJumpButtonBar( bool visible )
1480{ 1490{
1481 setJumpButtonBarVisible(visible ); 1491 setJumpButtonBarVisible(visible );
1482 saveSettings(); 1492 saveSettings();
1483} 1493}
1484void KABCore::setJumpButtonBarVisible( bool visible ) 1494void KABCore::setJumpButtonBarVisible( bool visible )
1485{ 1495{
1486 if (mMultipleViewsAtOnce) 1496 if (mMultipleViewsAtOnce)
1487 { 1497 {
1488 if ( visible ) 1498 if ( visible )
1489 mJumpButtonBar->show(); 1499 mJumpButtonBar->show();
1490 else 1500 else
1491 mJumpButtonBar->hide(); 1501 mJumpButtonBar->hide();
1492 } 1502 }
1493 else 1503 else
1494 { 1504 {
1495 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1505 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1496 if (mViewManager->isVisible()) 1506 if (mViewManager->isVisible())
1497 { 1507 {
1498 if ( visible ) 1508 if ( visible )
1499 mJumpButtonBar->show(); 1509 mJumpButtonBar->show();
1500 else 1510 else
1501 mJumpButtonBar->hide(); 1511 mJumpButtonBar->hide();
1502 } 1512 }
1503 else 1513 else
1504 { 1514 {
1505 mJumpButtonBar->hide(); 1515 mJumpButtonBar->hide();
1506 } 1516 }
1507 } 1517 }
1508 if ( visible ) { 1518 if ( visible ) {
1509 if ( mIncSearchWidget->currentItem() == 0 ) { 1519 if ( mIncSearchWidget->currentItem() == 0 ) {
1510 message( i18n("Change search field enable jump bar") ); 1520 message( i18n("Change search field enable jump bar") );
1511 } 1521 }
1512 } 1522 }
1513} 1523}
1514 1524
1515 1525
1516void KABCore::setDetailsToState() 1526void KABCore::setDetailsToState()
1517{ 1527{
1518 setDetailsVisible( mActionDetails->isChecked() ); 1528 setDetailsVisible( mActionDetails->isChecked() );
1519} 1529}
1520void KABCore::setDetailsToggle() 1530void KABCore::setDetailsToggle()
1521{ 1531{
1522 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1532 mActionDetails->setChecked( !mActionDetails->isChecked() );
1523 setDetailsToState(); 1533 setDetailsToState();
1524} 1534}
1525 1535
1526 1536
1527 1537
1528void KABCore::setDetailsVisible( bool visible ) 1538void KABCore::setDetailsVisible( bool visible )
1529{ 1539{
1530 if (visible && mDetails->isHidden()) 1540 if (visible && mDetails->isHidden())
1531 { 1541 {
1532 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1542 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1533 if ( addrList.count() > 0 ) 1543 if ( addrList.count() > 0 )
1534 mDetails->setAddressee( addrList[ 0 ] ); 1544 mDetails->setAddressee( addrList[ 0 ] );
1535 } 1545 }
1536 1546
1537 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1547 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1538 // the listview and the detailview. We do that by changing the splitbar size. 1548 // the listview and the detailview. We do that by changing the splitbar size.
1539 if (mMultipleViewsAtOnce) 1549 if (mMultipleViewsAtOnce)
1540 { 1550 {
1541 if ( visible ) 1551 if ( visible )
1542 mDetails->show(); 1552 mDetails->show();
1543 else 1553 else
1544 mDetails->hide(); 1554 mDetails->hide();
1545 } 1555 }
1546 else 1556 else
1547 { 1557 {
1548 if ( visible ) { 1558 if ( visible ) {
1549 mViewManager->hide(); 1559 mViewManager->hide();
1550 mDetails->show(); 1560 mDetails->show();
1551 mIncSearchWidget->setFocus(); 1561 mIncSearchWidget->setFocus();
1552 } 1562 }
1553 else { 1563 else {
1554 mViewManager->show(); 1564 mViewManager->show();
1555 mDetails->hide(); 1565 mDetails->hide();
1556 mViewManager->setFocusAV(); 1566 mViewManager->setFocusAV();
1557 } 1567 }
1558 setJumpButtonBarVisible( !visible ); 1568 setJumpButtonBarVisible( !visible );
1559 } 1569 }
1560 1570
1561} 1571}
1562 1572
1563void KABCore::extensionChanged( int id ) 1573void KABCore::extensionChanged( int id )
1564{ 1574{
1565 //change the details view only for non desktop systems 1575 //change the details view only for non desktop systems
1566#ifndef DESKTOP_VERSION 1576#ifndef DESKTOP_VERSION
1567 1577
1568 if (id == 0) 1578 if (id == 0)
1569 { 1579 {
1570 //the user disabled the extension. 1580 //the user disabled the extension.
1571 1581
1572 if (mMultipleViewsAtOnce) 1582 if (mMultipleViewsAtOnce)
1573 { // enable detailsview again 1583 { // enable detailsview again
1574 setDetailsVisible( true ); 1584 setDetailsVisible( true );
1575 mActionDetails->setChecked( true ); 1585 mActionDetails->setChecked( true );
1576 } 1586 }
1577 else 1587 else
1578 { //go back to the listview 1588 { //go back to the listview
1579 setDetailsVisible( false ); 1589 setDetailsVisible( false );
1580 mActionDetails->setChecked( false ); 1590 mActionDetails->setChecked( false );
1581 mActionDetails->setEnabled(true); 1591 mActionDetails->setEnabled(true);
1582 } 1592 }
1583 1593
1584 } 1594 }
1585 else 1595 else
1586 { 1596 {
1587 //the user enabled the extension. 1597 //the user enabled the extension.
1588 setDetailsVisible( false ); 1598 setDetailsVisible( false );
1589 mActionDetails->setChecked( false ); 1599 mActionDetails->setChecked( false );
1590 1600
1591 if (!mMultipleViewsAtOnce) 1601 if (!mMultipleViewsAtOnce)
1592 { 1602 {
1593 mActionDetails->setEnabled(false); 1603 mActionDetails->setEnabled(false);
1594 } 1604 }
1595 1605
1596 mExtensionManager->setSelectionChanged(); 1606 mExtensionManager->setSelectionChanged();
1597 1607
1598 } 1608 }
1599 1609
1600#endif// DESKTOP_VERSION 1610#endif// DESKTOP_VERSION
1601 1611
1602} 1612}
1603 1613
1604 1614
1605void KABCore::extensionModified( const KABC::Addressee::List &list ) 1615void KABCore::extensionModified( const KABC::Addressee::List &list )
1606{ 1616{
1607 1617
1608 if ( list.count() != 0 ) { 1618 if ( list.count() != 0 ) {
1609 KABC::Addressee::List::ConstIterator it; 1619 KABC::Addressee::List::ConstIterator it;
1610 for ( it = list.begin(); it != list.end(); ++it ) 1620 for ( it = list.begin(); it != list.end(); ++it )
1611 mAddressBook->insertAddressee( *it ); 1621 mAddressBook->insertAddressee( *it );
1612 if ( list.count() > 1 ) 1622 if ( list.count() > 1 )
1613 setModified(); 1623 setModified();
1614 else 1624 else
1615 setModifiedWOrefresh(); 1625 setModifiedWOrefresh();
1616 } 1626 }
1617 if ( list.count() == 0 ) 1627 if ( list.count() == 0 )
1618 mViewManager->refreshView(); 1628 mViewManager->refreshView();
1619 else 1629 else
1620 mViewManager->refreshView( list[ 0 ].uid() ); 1630 mViewManager->refreshView( list[ 0 ].uid() );
1621 1631
1622 1632
1623 1633
1624} 1634}
1625 1635
1626QString KABCore::getNameByPhone( const QString &phone ) 1636QString KABCore::getNameByPhone( const QString &phone )
1627{ 1637{
1628#ifndef KAB_EMBEDDED 1638#ifndef KAB_EMBEDDED
1629 QRegExp r( "[/*/-/ ]" ); 1639 QRegExp r( "[/*/-/ ]" );
1630 QString localPhone( phone ); 1640 QString localPhone( phone );
1631 1641
1632 bool found = false; 1642 bool found = false;
1633 QString ownerName = ""; 1643 QString ownerName = "";
1634 KABC::AddressBook::Iterator iter; 1644 KABC::AddressBook::Iterator iter;
1635 KABC::PhoneNumber::List::Iterator phoneIter; 1645 KABC::PhoneNumber::List::Iterator phoneIter;
1636 KABC::PhoneNumber::List phoneList; 1646 KABC::PhoneNumber::List phoneList;
1637 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1647 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1638 phoneList = (*iter).phoneNumbers(); 1648 phoneList = (*iter).phoneNumbers();
1639 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1649 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1640 ++phoneIter) { 1650 ++phoneIter) {
1641 // Get rid of separator chars so just the numbers are compared. 1651 // Get rid of separator chars so just the numbers are compared.
1642 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1652 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1643 ownerName = (*iter).formattedName(); 1653 ownerName = (*iter).formattedName();
1644 found = true; 1654 found = true;
1645 } 1655 }
1646 } 1656 }
1647 } 1657 }
1648 1658
1649 return ownerName; 1659 return ownerName;
1650#else //KAB_EMBEDDED 1660#else //KAB_EMBEDDED
1651 qDebug("KABCore::getNameByPhone finsih method"); 1661 qDebug("KABCore::getNameByPhone finsih method");
1652 return ""; 1662 return "";
1653#endif //KAB_EMBEDDED 1663#endif //KAB_EMBEDDED
1654 1664
1655} 1665}
1656void KABCore::openConfigGlobalDialog() 1666void KABCore::openConfigGlobalDialog()
1657{ 1667{
1658 KPimPrefsGlobalDialog gc ( this ); 1668 KPimPrefsGlobalDialog gc ( this );
1659 gc.exec(); 1669 gc.exec();
1660} 1670}
1661void KABCore::openConfigDialog() 1671void KABCore::openConfigDialog()
1662{ 1672{
1663 KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true); 1673 KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true);
1664 1674
1665 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" ); 1675 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" );
1666 ConfigureDialog->setMainWidget( kabcfg ); 1676 ConfigureDialog->setMainWidget( kabcfg );
1667 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1677 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1668 this, SLOT( configurationChanged() ) ); 1678 this, SLOT( configurationChanged() ) );
1669 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1679 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1670 kabcfg, SLOT( save() ) ); 1680 kabcfg, SLOT( save() ) );
1671 connect( ConfigureDialog, SIGNAL( acceptClicked() ), 1681 connect( ConfigureDialog, SIGNAL( acceptClicked() ),
1672 this, SLOT( configurationChanged() ) ); 1682 this, SLOT( configurationChanged() ) );
1673 connect( ConfigureDialog, SIGNAL( acceptClicked() ), 1683 connect( ConfigureDialog, SIGNAL( acceptClicked() ),
1674 kabcfg, SLOT( save() ) ); 1684 kabcfg, SLOT( save() ) );
1675 connect( ConfigureDialog, SIGNAL( defaultClicked() ), 1685 connect( ConfigureDialog, SIGNAL( defaultClicked() ),
1676 kabcfg, SLOT( defaults() ) ); 1686 kabcfg, SLOT( defaults() ) );
1677 saveSettings(); 1687 saveSettings();
1678 kabcfg->load(); 1688 kabcfg->load();
1679#ifndef DESKTOP_VERSION 1689#ifndef DESKTOP_VERSION
1680 if ( QApplication::desktop()->height() <= 480 ) 1690 if ( QApplication::desktop()->height() <= 480 )
1681 ConfigureDialog->hideButtons(); 1691 ConfigureDialog->hideButtons();
1682 ConfigureDialog->showMaximized(); 1692 ConfigureDialog->showMaximized();
1683#endif 1693#endif
1684 if ( ConfigureDialog->exec() ) 1694 if ( ConfigureDialog->exec() )
1685 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1695 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1686 delete ConfigureDialog; 1696 delete ConfigureDialog;
1687} 1697}
1688 1698
1689void KABCore::openLDAPDialog() 1699void KABCore::openLDAPDialog()
1690{ 1700{
1691#ifndef KAB_EMBEDDED 1701#ifndef KAB_EMBEDDED
1692 if ( !mLdapSearchDialog ) { 1702 if ( !mLdapSearchDialog ) {
1693 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1703 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1694 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1704 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1695 SLOT( refreshView() ) ); 1705 SLOT( refreshView() ) );
1696 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1706 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1697 SLOT( setModified() ) ); 1707 SLOT( setModified() ) );
1698 } else 1708 } else
1699 mLdapSearchDialog->restoreSettings(); 1709 mLdapSearchDialog->restoreSettings();
1700 1710
1701 if ( mLdapSearchDialog->isOK() ) 1711 if ( mLdapSearchDialog->isOK() )
1702 mLdapSearchDialog->exec(); 1712 mLdapSearchDialog->exec();
1703#else //KAB_EMBEDDED 1713#else //KAB_EMBEDDED
1704 qDebug("KABCore::openLDAPDialog() finsih method"); 1714 qDebug("KABCore::openLDAPDialog() finsih method");
1705#endif //KAB_EMBEDDED 1715#endif //KAB_EMBEDDED
1706} 1716}
1707 1717
1708void KABCore::print() 1718void KABCore::print()
1709{ 1719{
1710#ifndef KAB_EMBEDDED 1720#ifndef KAB_EMBEDDED
1711 KPrinter printer; 1721 KPrinter printer;
1712 if ( !printer.setup( this ) ) 1722 if ( !printer.setup( this ) )
1713 return; 1723 return;
1714 1724
1715 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1725 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1716 mViewManager->selectedUids(), this ); 1726 mViewManager->selectedUids(), this );
1717 1727
1718 wizard.exec(); 1728 wizard.exec();
1719#else //KAB_EMBEDDED 1729#else //KAB_EMBEDDED
1720 qDebug("KABCore::print() finsih method"); 1730 qDebug("KABCore::print() finsih method");
1721#endif //KAB_EMBEDDED 1731#endif //KAB_EMBEDDED
1722 1732
1723} 1733}
1724 1734
1725 1735
1726void KABCore::addGUIClient( KXMLGUIClient *client ) 1736void KABCore::addGUIClient( KXMLGUIClient *client )
1727{ 1737{
1728 if ( mGUIClient ) 1738 if ( mGUIClient )
1729 mGUIClient->insertChildClient( client ); 1739 mGUIClient->insertChildClient( client );
1730 else 1740 else
1731 KMessageBox::error( this, "no KXMLGUICLient"); 1741 KMessageBox::error( this, "no KXMLGUICLient");
1732} 1742}
1733 1743
1734 1744
1735void KABCore::configurationChanged() 1745void KABCore::configurationChanged()
1736{ 1746{
1737 mExtensionManager->reconfigure(); 1747 mExtensionManager->reconfigure();
1738} 1748}
1739 1749
1740void KABCore::addressBookChanged() 1750void KABCore::addressBookChanged()
1741{ 1751{
1742/*US 1752/*US
1743 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1753 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1744 while ( it.current() ) { 1754 while ( it.current() ) {
1745 if ( it.current()->dirty() ) { 1755 if ( it.current()->dirty() ) {
1746 QString text = i18n( "Data has been changed externally. Unsaved " 1756 QString text = i18n( "Data has been changed externally. Unsaved "
1747 "changes will be lost." ); 1757 "changes will be lost." );
1748 KMessageBox::information( this, text ); 1758 KMessageBox::information( this, text );
1749 } 1759 }
1750 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1760 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1751 ++it; 1761 ++it;
1752 } 1762 }
1753*/ 1763*/
1754 if (mEditorDialog) 1764 if (mEditorDialog)
1755 { 1765 {
1756 if (mEditorDialog->dirty()) 1766 if (mEditorDialog->dirty())
1757 { 1767 {
1758 QString text = i18n( "Data has been changed externally. Unsaved " 1768 QString text = i18n( "Data has been changed externally. Unsaved "
1759 "changes will be lost." ); 1769 "changes will be lost." );
1760 KMessageBox::information( this, text ); 1770 KMessageBox::information( this, text );
1761 } 1771 }
1762 QString currentuid = mEditorDialog->addressee().uid(); 1772 QString currentuid = mEditorDialog->addressee().uid();
1763 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1773 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1764 } 1774 }
1765 mViewManager->refreshView(); 1775 mViewManager->refreshView();
1766 1776
1767 1777
1768} 1778}
1769 1779
1770AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1780AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1771 const char *name ) 1781 const char *name )
1772{ 1782{
1773 1783
1774 if ( mEditorDialog == 0 ) { 1784 if ( mEditorDialog == 0 ) {
1775 mEditorDialog = new AddresseeEditorDialog( this, parent, 1785 mEditorDialog = new AddresseeEditorDialog( this, parent,
1776 name ? name : "editorDialog" ); 1786 name ? name : "editorDialog" );
1777 1787
1778 1788
1779 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1789 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1780 SLOT( contactModified( const KABC::Addressee& ) ) ); 1790 SLOT( contactModified( const KABC::Addressee& ) ) );
1781 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1791 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1782 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1792 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1783 } 1793 }
1784 1794
1785 return mEditorDialog; 1795 return mEditorDialog;
1786} 1796}
1787 1797
1788void KABCore::slotEditorDestroyed( const QString &uid ) 1798void KABCore::slotEditorDestroyed( const QString &uid )
1789{ 1799{
1790 //mEditorDict.remove( uid ); 1800 //mEditorDict.remove( uid );
1791} 1801}
1792 1802
1793void KABCore::initGUI() 1803void KABCore::initGUI()
1794{ 1804{
1795#ifndef KAB_EMBEDDED 1805#ifndef KAB_EMBEDDED
1796 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1806 QHBoxLayout *topLayout = new QHBoxLayout( this );
1797 topLayout->setSpacing( KDialogBase::spacingHint() ); 1807 topLayout->setSpacing( KDialogBase::spacingHint() );
1798 1808
1799 mExtensionBarSplitter = new QSplitter( this ); 1809 mExtensionBarSplitter = new QSplitter( this );
1800 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1810 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1801 1811
1802 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1812 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1803 1813
1804 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1814 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1805 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1815 mIncSearchWidget = new IncSearchWidget( viewSpace );
1806 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1816 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1807 SLOT( incrementalSearch( const QString& ) ) ); 1817 SLOT( incrementalSearch( const QString& ) ) );
1808 1818
1809 mViewManager = new ViewManager( this, viewSpace ); 1819 mViewManager = new ViewManager( this, viewSpace );
1810 viewSpace->setStretchFactor( mViewManager, 1 ); 1820 viewSpace->setStretchFactor( mViewManager, 1 );
1811 1821
1812 mDetails = new ViewContainer( mDetailsSplitter ); 1822 mDetails = new ViewContainer( mDetailsSplitter );
1813 1823
1814 mJumpButtonBar = new JumpButtonBar( this, this ); 1824 mJumpButtonBar = new JumpButtonBar( this, this );
1815 1825
1816 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1826 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1817 1827
1818 topLayout->addWidget( mExtensionBarSplitter ); 1828 topLayout->addWidget( mExtensionBarSplitter );
1819 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1829 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1820 topLayout->addWidget( mJumpButtonBar ); 1830 topLayout->addWidget( mJumpButtonBar );
1821 //topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1831 //topLayout->setStretchFactor( mJumpButtonBar, 1 );
1822 1832
1823 mXXPortManager = new XXPortManager( this, this ); 1833 mXXPortManager = new XXPortManager( this, this );
1824 1834
1825#else //KAB_EMBEDDED 1835#else //KAB_EMBEDDED
1826 //US initialize viewMenu before settingup viewmanager. 1836 //US initialize viewMenu before settingup viewmanager.
1827 // Viewmanager needs this menu to plugin submenues. 1837 // Viewmanager needs this menu to plugin submenues.
1828 viewMenu = new QPopupMenu( this ); 1838 viewMenu = new QPopupMenu( this );
1829 settingsMenu = new QPopupMenu( this ); 1839 settingsMenu = new QPopupMenu( this );
1830 //filterMenu = new QPopupMenu( this ); 1840 //filterMenu = new QPopupMenu( this );
1831 ImportMenu = new QPopupMenu( this ); 1841 ImportMenu = new QPopupMenu( this );
1832 ExportMenu = new QPopupMenu( this ); 1842 ExportMenu = new QPopupMenu( this );
1833 syncMenu = new QPopupMenu( this ); 1843 syncMenu = new QPopupMenu( this );
1834 changeMenu= new QPopupMenu( this ); 1844 changeMenu= new QPopupMenu( this );
1835 beamMenu= new QPopupMenu( this ); 1845 beamMenu= new QPopupMenu( this );
1836 1846
1837//US since we have no splitter for the embedded system, setup 1847//US since we have no splitter for the embedded system, setup
1838// a layout with two frames. One left and one right. 1848// a layout with two frames. One left and one right.
1839 1849
1840 QBoxLayout *topLayout; 1850 QBoxLayout *topLayout;
1841 1851
1842 // = new QHBoxLayout( this ); 1852 // = new QHBoxLayout( this );
1843// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1853// QBoxLayout *topLayout = (QBoxLayout*)layout();
1844 1854
1845// QWidget *mainBox = new QWidget( this ); 1855// QWidget *mainBox = new QWidget( this );
1846// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1856// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1847 1857
1848#ifdef DESKTOP_VERSION 1858#ifdef DESKTOP_VERSION
1849 topLayout = new QHBoxLayout( this ); 1859 topLayout = new QHBoxLayout( this );
1850 1860
1851 1861
1852 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1862 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1853 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1863 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1854 1864
1855 topLayout->addWidget(mMiniSplitter ); 1865 topLayout->addWidget(mMiniSplitter );
1856 1866
1857 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1867 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1858 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1868 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1859 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1869 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1860 mDetails = new ViewContainer( mMiniSplitter ); 1870 mDetails = new ViewContainer( mMiniSplitter );
1861 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1871 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1862#else 1872#else
1863 if ( QApplication::desktop()->width() > 480 ) { 1873 if ( QApplication::desktop()->width() > 480 ) {
1864 topLayout = new QHBoxLayout( this ); 1874 topLayout = new QHBoxLayout( this );
1865 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1875 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1866 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1876 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1867 } else { 1877 } else {
1868 1878
1869 topLayout = new QHBoxLayout( this ); 1879 topLayout = new QHBoxLayout( this );
1870 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1880 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1871 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1881 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1872 } 1882 }
1873 1883
1874 topLayout->addWidget(mMiniSplitter ); 1884 topLayout->addWidget(mMiniSplitter );
1875 mViewManager = new ViewManager( this, mMiniSplitter ); 1885 mViewManager = new ViewManager( this, mMiniSplitter );
1876 mDetails = new ViewContainer( mMiniSplitter ); 1886 mDetails = new ViewContainer( mMiniSplitter );
1877 1887
1878 1888
1879 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1889 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1880#endif 1890#endif
1881 //eh->hide(); 1891 //eh->hide();
1882 // topLayout->addWidget(mExtensionManager ); 1892 // topLayout->addWidget(mExtensionManager );
1883 1893
1884 1894
1885/*US 1895/*US
1886#ifndef KAB_NOSPLITTER 1896#ifndef KAB_NOSPLITTER
1887 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1897 QHBoxLayout *topLayout = new QHBoxLayout( this );
1888//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1898//US topLayout->setSpacing( KDialogBase::spacingHint() );
1889 topLayout->setSpacing( 10 ); 1899 topLayout->setSpacing( 10 );
1890 1900
1891 mDetailsSplitter = new QSplitter( this ); 1901 mDetailsSplitter = new QSplitter( this );
1892 1902
1893 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1903 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1894 1904
1895 mViewManager = new ViewManager( this, viewSpace ); 1905 mViewManager = new ViewManager( this, viewSpace );
1896 viewSpace->setStretchFactor( mViewManager, 1 ); 1906 viewSpace->setStretchFactor( mViewManager, 1 );
1897 1907
1898 mDetails = new ViewContainer( mDetailsSplitter ); 1908 mDetails = new ViewContainer( mDetailsSplitter );
1899 1909
1900 topLayout->addWidget( mDetailsSplitter ); 1910 topLayout->addWidget( mDetailsSplitter );
1901 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1911 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1902#else //KAB_NOSPLITTER 1912#else //KAB_NOSPLITTER
1903 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1913 QHBoxLayout *topLayout = new QHBoxLayout( this );
1904//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1914//US topLayout->setSpacing( KDialogBase::spacingHint() );
1905 topLayout->setSpacing( 10 ); 1915 topLayout->setSpacing( 10 );
1906 1916
1907// mDetailsSplitter = new QSplitter( this ); 1917// mDetailsSplitter = new QSplitter( this );
1908 1918
1909 QVBox *viewSpace = new QVBox( this ); 1919 QVBox *viewSpace = new QVBox( this );
1910 1920
1911 mViewManager = new ViewManager( this, viewSpace ); 1921 mViewManager = new ViewManager( this, viewSpace );
1912 viewSpace->setStretchFactor( mViewManager, 1 ); 1922 viewSpace->setStretchFactor( mViewManager, 1 );
1913 1923
1914 mDetails = new ViewContainer( this ); 1924 mDetails = new ViewContainer( this );
1915 1925
1916 topLayout->addWidget( viewSpace ); 1926 topLayout->addWidget( viewSpace );
1917// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1927// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1918 topLayout->addWidget( mDetails ); 1928 topLayout->addWidget( mDetails );
1919#endif //KAB_NOSPLITTER 1929#endif //KAB_NOSPLITTER
1920*/ 1930*/
1921 1931
1922 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1932 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1923 syncManager->setBlockSave(false); 1933 syncManager->setBlockSave(false);
1924 1934
1925 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1935 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1926 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1936 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1927 QString sync_file = sentSyncFile(); 1937 QString sync_file = sentSyncFile();
1928 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1938 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1929 syncManager->setDefaultFileName( sync_file ); 1939 syncManager->setDefaultFileName( sync_file );
1930 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1940 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1931 1941
1932#endif //KAB_EMBEDDED 1942#endif //KAB_EMBEDDED
1933 initActions(); 1943 initActions();
1934 1944
1935#ifdef KAB_EMBEDDED 1945#ifdef KAB_EMBEDDED
1936 addActionsManually(); 1946 addActionsManually();
1937 //US make sure the export and import menues are initialized before creating the xxPortManager. 1947 //US make sure the export and import menues are initialized before creating the xxPortManager.
1938 mXXPortManager = new XXPortManager( this, this ); 1948 mXXPortManager = new XXPortManager( this, this );
1939 1949
1940 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1950 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1941 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1951 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1942 // mActionQuit->plug ( mMainWindow->toolBar()); 1952 // mActionQuit->plug ( mMainWindow->toolBar());
1943 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1953 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1944 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1954 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1945 // mIncSearchWidget->hide(); 1955 // mIncSearchWidget->hide();
1946 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1956 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1947 SLOT( incrementalSearch( const QString& ) ) ); 1957 SLOT( incrementalSearch( const QString& ) ) );
1948 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1958 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1949 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1959 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1950 1960
1951 mJumpButtonBar = new JumpButtonBar( this, this ); 1961 mJumpButtonBar = new JumpButtonBar( this, this );
1952 1962
1953 topLayout->addWidget( mJumpButtonBar ); 1963 topLayout->addWidget( mJumpButtonBar );
1954//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1964//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1955 1965
1956// mMainWindow->getIconToolBar()->raise(); 1966// mMainWindow->getIconToolBar()->raise();
1957 1967
1958#endif //KAB_EMBEDDED 1968#endif //KAB_EMBEDDED
1959 1969
1960} 1970}
1961void KABCore::initActions() 1971void KABCore::initActions()
1962{ 1972{
1963//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1973//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1964 1974
1965#ifndef KAB_EMBEDDED 1975#ifndef KAB_EMBEDDED
1966 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1976 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1967 SLOT( clipboardDataChanged() ) ); 1977 SLOT( clipboardDataChanged() ) );
1968#endif //KAB_EMBEDDED 1978#endif //KAB_EMBEDDED
1969 1979
1970 // file menu 1980 // file menu
1971 1981
1972 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1982 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1973 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1983 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1974 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1984 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1975 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1985 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1976 1986
1977 1987
1978 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1988 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1979 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1989 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1980 1990
1981 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1991 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1982 SLOT( save() ), actionCollection(), "file_sync" ); 1992 SLOT( save() ), actionCollection(), "file_sync" );
1983 1993
1984 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1994 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1985 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1995 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1986 1996
1987 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1997 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1988 this, SLOT( mailVCard() ), 1998 this, SLOT( mailVCard() ),
1989 actionCollection(), "file_mail_vcard"); 1999 actionCollection(), "file_mail_vcard");
1990 2000
1991 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 2001 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1992 SLOT( export2phone() ), actionCollection(), 2002 SLOT( export2phone() ), actionCollection(),
1993 "kaddressbook_ex2phone" ); 2003 "kaddressbook_ex2phone" );
1994 2004
1995 mActionBeamVCard = 0; 2005 mActionBeamVCard = 0;
1996 mActionBeam = 0; 2006 mActionBeam = 0;
1997 2007
1998#ifndef DESKTOP_VERSION 2008#ifndef DESKTOP_VERSION
1999 if ( Ir::supported() ) { 2009 if ( Ir::supported() ) {
2000 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 2010 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
2001 SLOT( beamVCard() ), actionCollection(), 2011 SLOT( beamVCard() ), actionCollection(),
2002 "kaddressbook_beam_vcard" ); 2012 "kaddressbook_beam_vcard" );
2003 2013
2004 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 2014 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
2005 SLOT( beamMySelf() ), actionCollection(), 2015 SLOT( beamMySelf() ), actionCollection(),
2006 "kaddressbook_beam_myself" ); 2016 "kaddressbook_beam_myself" );
2007 } 2017 }
2008#endif 2018#endif
2009 2019
2010 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 2020 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
2011 this, SLOT( editContact2() ), 2021 this, SLOT( editContact2() ),
2012 actionCollection(), "file_properties" ); 2022 actionCollection(), "file_properties" );
2013 2023
2014#ifdef KAB_EMBEDDED 2024#ifdef KAB_EMBEDDED
2015 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 2025 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
2016 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 2026 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
2017 mMainWindow, SLOT( exit() ), 2027 mMainWindow, SLOT( exit() ),
2018 actionCollection(), "quit" ); 2028 actionCollection(), "quit" );
2019#endif //KAB_EMBEDDED 2029#endif //KAB_EMBEDDED
2020 2030
2021 // edit menu 2031 // edit menu
2022 if ( mIsPart ) { 2032 if ( mIsPart ) {
2023 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 2033 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
2024 SLOT( copyContacts() ), actionCollection(), 2034 SLOT( copyContacts() ), actionCollection(),
2025 "kaddressbook_copy" ); 2035 "kaddressbook_copy" );
2026 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 2036 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
2027 SLOT( cutContacts() ), actionCollection(), 2037 SLOT( cutContacts() ), actionCollection(),
2028 "kaddressbook_cut" ); 2038 "kaddressbook_cut" );
2029 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 2039 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
2030 SLOT( pasteContacts() ), actionCollection(), 2040 SLOT( pasteContacts() ), actionCollection(),
2031 "kaddressbook_paste" ); 2041 "kaddressbook_paste" );
2032 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 2042 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
2033 SLOT( selectAllContacts() ), actionCollection(), 2043 SLOT( selectAllContacts() ), actionCollection(),
2034 "kaddressbook_select_all" ); 2044 "kaddressbook_select_all" );
2035 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 2045 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
2036 SLOT( undo() ), actionCollection(), 2046 SLOT( undo() ), actionCollection(),
2037 "kaddressbook_undo" ); 2047 "kaddressbook_undo" );
2038 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 2048 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
2039 this, SLOT( redo() ), actionCollection(), 2049 this, SLOT( redo() ), actionCollection(),
2040 "kaddressbook_redo" ); 2050 "kaddressbook_redo" );
2041 } else { 2051 } else {
2042 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 2052 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
2043 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 2053 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
2044 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 2054 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
2045 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 2055 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
2046 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 2056 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
2047 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 2057 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
2048 } 2058 }
2049 2059
2050 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2060 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
2051 Key_Delete, this, SLOT( deleteContacts() ), 2061 Key_Delete, this, SLOT( deleteContacts() ),
2052 actionCollection(), "edit_delete" ); 2062 actionCollection(), "edit_delete" );
2053 2063
2054 mActionUndo->setEnabled( false ); 2064 mActionUndo->setEnabled( false );
2055 mActionRedo->setEnabled( false ); 2065 mActionRedo->setEnabled( false );
2056 2066
2057 // settings menu 2067 // settings menu
2058#ifdef KAB_EMBEDDED 2068#ifdef KAB_EMBEDDED
2059//US special menuentry to configure the addressbook resources. On KDE 2069//US special menuentry to configure the addressbook resources. On KDE
2060// you do that through the control center !!! 2070// you do that through the control center !!!
2061 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2071 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2062 SLOT( configureResources() ), actionCollection(), 2072 SLOT( configureResources() ), actionCollection(),
2063 "kaddressbook_configure_resources" ); 2073 "kaddressbook_configure_resources" );
2064#endif //KAB_EMBEDDED 2074#endif //KAB_EMBEDDED
2065 2075
2066 if ( mIsPart ) { 2076 if ( mIsPart ) {
2067 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 2077 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
2068 SLOT( openConfigDialog() ), actionCollection(), 2078 SLOT( openConfigDialog() ), actionCollection(),
2069 "kaddressbook_configure" ); 2079 "kaddressbook_configure" );
2070 2080
2071 //US not implemented yet 2081 //US not implemented yet
2072 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 2082 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
2073 // this, SLOT( configureKeyBindings() ), actionCollection(), 2083 // this, SLOT( configureKeyBindings() ), actionCollection(),
2074 // "kaddressbook_configure_shortcuts" ); 2084 // "kaddressbook_configure_shortcuts" );
2075#ifdef KAB_EMBEDDED 2085#ifdef KAB_EMBEDDED
2076 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 2086 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
2077 mActionConfigureToolbars->setEnabled( false ); 2087 mActionConfigureToolbars->setEnabled( false );
2078#endif //KAB_EMBEDDED 2088#endif //KAB_EMBEDDED
2079 2089
2080 } else { 2090 } else {
2081 mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this, 2091 mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this,
2082 SLOT( openConfigDialog() ), actionCollection(), 2092 SLOT( openConfigDialog() ), actionCollection(),
2083 "kaddressbook_configure" ); 2093 "kaddressbook_configure" );
2084 mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this, 2094 mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this,
2085 SLOT( openConfigGlobalDialog() ), actionCollection(), 2095 SLOT( openConfigGlobalDialog() ), actionCollection(),
2086 "kaddressbook_configure" ); 2096 "kaddressbook_configure" );
2087 } 2097 }
2088 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2098 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2089 actionCollection(), "options_show_jump_bar" ); 2099 actionCollection(), "options_show_jump_bar" );
2090 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); 2100 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
2091 2101
2092 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2102 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2093 actionCollection(), "options_show_details" ); 2103 actionCollection(), "options_show_details" );
2094 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2104 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2095 2105
2096 2106
2097 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2107 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2098 SLOT( toggleBeamReceive() ), actionCollection(), 2108 SLOT( toggleBeamReceive() ), actionCollection(),
2099 "kaddressbook_beam_rec" ); 2109 "kaddressbook_beam_rec" );
2100 2110
2101 2111
2102 // misc 2112 // misc
2103 // only enable LDAP lookup if we can handle the protocol 2113 // only enable LDAP lookup if we can handle the protocol
2104#ifndef KAB_EMBEDDED 2114#ifndef KAB_EMBEDDED
2105 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2115 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2106 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2116 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2107 this, SLOT( openLDAPDialog() ), actionCollection(), 2117 this, SLOT( openLDAPDialog() ), actionCollection(),
2108 "ldap_lookup" ); 2118 "ldap_lookup" );
2109 } 2119 }
2110#else //KAB_EMBEDDED 2120#else //KAB_EMBEDDED
2111 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2121 //qDebug("KABCore::initActions() LDAP has to be implemented");
2112#endif //KAB_EMBEDDED 2122#endif //KAB_EMBEDDED
2113 2123
2114 2124
2115 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2125 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2116 SLOT( setWhoAmI() ), actionCollection(), 2126 SLOT( setWhoAmI() ), actionCollection(),
2117 "set_personal" ); 2127 "set_personal" );
2118 2128
2119 2129
2120 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, 2130 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
2121 SLOT( setCategories() ), actionCollection(), 2131 SLOT( setCategories() ), actionCollection(),
2122 "edit_set_categories" ); 2132 "edit_set_categories" );
2123 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, 2133 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
2124 SLOT( editCategories() ), actionCollection(), 2134 SLOT( editCategories() ), actionCollection(),
2125 "edit__categories" ); 2135 "edit__categories" );
2126 2136
2127 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2137 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2128 SLOT( removeVoice() ), actionCollection(), 2138 SLOT( removeVoice() ), actionCollection(),
2129 "remove_voice" ); 2139 "remove_voice" );
2130 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2140 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2131 SLOT( setFormattedName() ), actionCollection(), 2141 SLOT( setFormattedName() ), actionCollection(),
2132 "set_formatted" ); 2142 "set_formatted" );
2133 2143
2134 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2144 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2135 SLOT( manageCategories() ), actionCollection(), 2145 SLOT( manageCategories() ), actionCollection(),
2136 "remove_voice" ); 2146 "remove_voice" );
2137 2147
2138 2148
2139 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2149 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2140 SLOT( importFromOL() ), actionCollection(), 2150 SLOT( importFromOL() ), actionCollection(),
2141 "import_OL" ); 2151 "import_OL" );
2142#ifdef KAB_EMBEDDED 2152#ifdef KAB_EMBEDDED
2143 mActionLicence = new KAction( i18n( "Licence" ), 0, 2153 mActionLicence = new KAction( i18n( "Licence" ), 0,
2144 this, SLOT( showLicence() ), actionCollection(), 2154 this, SLOT( showLicence() ), actionCollection(),
2145 "licence_about_data" ); 2155 "licence_about_data" );
2146 mActionFaq = new KAction( i18n( "Faq" ), 0, 2156 mActionFaq = new KAction( i18n( "Faq" ), 0,
2147 this, SLOT( faq() ), actionCollection(), 2157 this, SLOT( faq() ), actionCollection(),
2148 "faq_about_data" ); 2158 "faq_about_data" );
2149 mActionWN = new KAction( i18n( "What's New?" ), 0, 2159 mActionWN = new KAction( i18n( "What's New?" ), 0,
2150 this, SLOT( whatsnew() ), actionCollection(), 2160 this, SLOT( whatsnew() ), actionCollection(),
2151 "wn" ); 2161 "wn" );
2152 2162
2153 2163
2154 2164
2155 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, 2165 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
2156 this, SLOT( storagehowto() ), actionCollection(), 2166 this, SLOT( storagehowto() ), actionCollection(),
2157 "storage" ); 2167 "storage" );
2158 2168
2159 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2169 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2160 this, SLOT( synchowto() ), actionCollection(), 2170 this, SLOT( synchowto() ), actionCollection(),
2161 "sync" ); 2171 "sync" );
2162 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2172 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2163 this, SLOT( kdesynchowto() ), actionCollection(), 2173 this, SLOT( kdesynchowto() ), actionCollection(),
2164 "kdesync" ); 2174 "kdesync" );
2165 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2175 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2166 this, SLOT( multisynchowto() ), actionCollection(), 2176 this, SLOT( multisynchowto() ), actionCollection(),
2167 "multisync" ); 2177 "multisync" );
2168 2178
2169 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2179 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2170 this, SLOT( createAboutData() ), actionCollection(), 2180 this, SLOT( createAboutData() ), actionCollection(),
2171 "kaddressbook_about_data" ); 2181 "kaddressbook_about_data" );
2172#endif //KAB_EMBEDDED 2182#endif //KAB_EMBEDDED
2173 2183
2174 clipboardDataChanged(); 2184 clipboardDataChanged();
2175 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2185 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2176 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2186 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2177} 2187}
2178 2188
2179//US we need this function, to plug all actions into the correct menues. 2189//US we need this function, to plug all actions into the correct menues.
2180// KDE uses a XML format to plug the actions, but we work her without this overhead. 2190// KDE uses a XML format to plug the actions, but we work her without this overhead.
2181void KABCore::addActionsManually() 2191void KABCore::addActionsManually()
2182{ 2192{
2183//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2193//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2184 2194
2185#ifdef KAB_EMBEDDED 2195#ifdef KAB_EMBEDDED
2186 QPopupMenu *fileMenu = new QPopupMenu( this ); 2196 QPopupMenu *fileMenu = new QPopupMenu( this );
2187 QPopupMenu *editMenu = new QPopupMenu( this ); 2197 QPopupMenu *editMenu = new QPopupMenu( this );
2188 QPopupMenu *helpMenu = new QPopupMenu( this ); 2198 QPopupMenu *helpMenu = new QPopupMenu( this );
2189 2199
2190 KToolBar* tb = mMainWindow->toolBar(); 2200 KToolBar* tb = mMainWindow->toolBar();
2191 mMainWindow->setToolBarsMovable (false ); 2201 mMainWindow->setToolBarsMovable (false );
2192#ifndef DESKTOP_VERSION 2202#ifndef DESKTOP_VERSION
2193 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2203 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2194#endif 2204#endif
2195 QMenuBar* mb = mMainWindow->menuBar(); 2205 QMenuBar* mb = mMainWindow->menuBar();
2196 2206
2197 //US setup menubar. 2207 //US setup menubar.
2198 //Disable the following block if you do not want to have a menubar. 2208 //Disable the following block if you do not want to have a menubar.
2199 mb->insertItem( i18n("&File"), fileMenu ); 2209 mb->insertItem( i18n("&File"), fileMenu );
2200 mb->insertItem( i18n("&Edit"), editMenu ); 2210 mb->insertItem( i18n("&Edit"), editMenu );
2201 mb->insertItem( i18n("&View"), viewMenu ); 2211 mb->insertItem( i18n("&View"), viewMenu );
2202 mb->insertItem( i18n("&Settings"), settingsMenu ); 2212 mb->insertItem( i18n("&Settings"), settingsMenu );
2203#ifdef DESKTOP_VERSION 2213#ifdef DESKTOP_VERSION
2204 mb->insertItem( i18n("Synchronize"), syncMenu ); 2214 mb->insertItem( i18n("Synchronize"), syncMenu );
2205#else 2215#else
2206 mb->insertItem( i18n("Sync"), syncMenu ); 2216 mb->insertItem( i18n("Sync"), syncMenu );
2207#endif 2217#endif
2208 //mb->insertItem( i18n("&Change"), changeMenu ); 2218 //mb->insertItem( i18n("&Change"), changeMenu );
2209 mb->insertItem( i18n("&Help"), helpMenu ); 2219 mb->insertItem( i18n("&Help"), helpMenu );
2210 mIncSearchWidget = new IncSearchWidget( tb ); 2220 mIncSearchWidget = new IncSearchWidget( tb );
2211 // tb->insertWidget(-1, 0, mIncSearchWidget); 2221 // tb->insertWidget(-1, 0, mIncSearchWidget);
2212#ifndef DESKTOP_VERSION 2222#ifndef DESKTOP_VERSION
2213 } else { 2223 } else {
2214 //US setup toolbar 2224 //US setup toolbar
2215 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2225 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2216 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2226 QPopupMenu *popupBarTB = new QPopupMenu( this );
2217 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2227 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2218 tb->insertWidget(-1, 0, menuBarTB); 2228 tb->insertWidget(-1, 0, menuBarTB);
2219 mIncSearchWidget = new IncSearchWidget( tb ); 2229 mIncSearchWidget = new IncSearchWidget( tb );
2220 tb->enableMoving(false); 2230 tb->enableMoving(false);
2221 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2231 popupBarTB->insertItem( i18n("&File"), fileMenu );
2222 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2232 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2223 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2233 popupBarTB->insertItem( i18n("&View"), viewMenu );
2224 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2234 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2225 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2235 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2226 mViewManager->getFilterAction()->plug ( popupBarTB); 2236 mViewManager->getFilterAction()->plug ( popupBarTB);
2227 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2237 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2228 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2238 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2229 if (QApplication::desktop()->width() > 320 ) { 2239 if (QApplication::desktop()->width() > 320 ) {
2230 // mViewManager->getFilterAction()->plug ( tb); 2240 // mViewManager->getFilterAction()->plug ( tb);
2231 } 2241 }
2232 } 2242 }
2233#endif 2243#endif
2234 mIncSearchWidget->setSize(); 2244 mIncSearchWidget->setSize();
2235 // mActionQuit->plug ( mMainWindow->toolBar()); 2245 // mActionQuit->plug ( mMainWindow->toolBar());
2236 2246
2237 2247
2238 2248
2239 //US Now connect the actions with the menue entries. 2249 //US Now connect the actions with the menue entries.
2240#ifdef DESKTOP_VERSION 2250#ifdef DESKTOP_VERSION
2241 mActionPrint->plug( fileMenu ); 2251 mActionPrint->plug( fileMenu );
2242 mActionPrintDetails->plug( fileMenu ); 2252 mActionPrintDetails->plug( fileMenu );
2243 fileMenu->insertSeparator(); 2253 fileMenu->insertSeparator();
2244#endif 2254#endif
2245 mActionMail->plug( fileMenu ); 2255 mActionMail->plug( fileMenu );
2246 fileMenu->insertSeparator(); 2256 fileMenu->insertSeparator();
2247 2257
2248 mActionNewContact->plug( editMenu ); 2258 mActionNewContact->plug( editMenu );
2249 mActionNewContact->plug( tb ); 2259 mActionNewContact->plug( tb );
2250 2260
2251 mActionEditAddressee->plug( editMenu ); 2261 mActionEditAddressee->plug( editMenu );
2252 editMenu->insertSeparator(); 2262 editMenu->insertSeparator();
2253 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2263 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2254 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2264 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2255 mActionEditAddressee->plug( tb ); 2265 mActionEditAddressee->plug( tb );
2256 2266
2257 // fileMenu->insertSeparator(); 2267 // fileMenu->insertSeparator();
2258 mActionSave->plug( fileMenu ); 2268 mActionSave->plug( fileMenu );
2259 fileMenu->insertItem( "&Import", ImportMenu ); 2269 fileMenu->insertItem( "&Import", ImportMenu );
2260 fileMenu->insertItem( "&Export", ExportMenu ); 2270 fileMenu->insertItem( "&Export", ExportMenu );
2261 editMenu->insertItem( i18n("&Change"), changeMenu ); 2271 editMenu->insertItem( i18n("&Change"), changeMenu );
2262 editMenu->insertSeparator(); 2272 editMenu->insertSeparator();
2263#ifndef DESKTOP_VERSION 2273#ifndef DESKTOP_VERSION
2264 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2274 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2265#endif 2275#endif
2266#if 0 2276#if 0
2267 // PENDING fix MailVCard 2277 // PENDING fix MailVCard
2268 fileMenu->insertSeparator(); 2278 fileMenu->insertSeparator();
2269 mActionMailVCard->plug( fileMenu ); 2279 mActionMailVCard->plug( fileMenu );
2270#endif 2280#endif
2271#ifndef DESKTOP_VERSION 2281#ifndef DESKTOP_VERSION
2272 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2282 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2273 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2283 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2274 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2284 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2275#endif 2285#endif
2276 fileMenu->insertSeparator(); 2286 fileMenu->insertSeparator();
2277 mActionQuit->plug( fileMenu ); 2287 mActionQuit->plug( fileMenu );
2278#ifdef _OL_IMPORT_ 2288#ifdef _OL_IMPORT_
2279 mActionImportOL->plug( ImportMenu ); 2289 mActionImportOL->plug( ImportMenu );
2280#endif 2290#endif
2281 // edit menu 2291 // edit menu
2282 mActionUndo->plug( editMenu ); 2292 mActionUndo->plug( editMenu );
2283 mActionRedo->plug( editMenu ); 2293 mActionRedo->plug( editMenu );
2284 editMenu->insertSeparator(); 2294 editMenu->insertSeparator();
2285 mActionCut->plug( editMenu ); 2295 mActionCut->plug( editMenu );
2286 mActionCopy->plug( editMenu ); 2296 mActionCopy->plug( editMenu );
2287 mActionPaste->plug( editMenu ); 2297 mActionPaste->plug( editMenu );
2288 mActionDelete->plug( editMenu ); 2298 mActionDelete->plug( editMenu );
2289 editMenu->insertSeparator(); 2299 editMenu->insertSeparator();
2290 mActionSelectAll->plug( editMenu ); 2300 mActionSelectAll->plug( editMenu );
2291 2301
2292 mActionSetFormattedName->plug( changeMenu ); 2302 mActionSetFormattedName->plug( changeMenu );
2293 mActionRemoveVoice->plug( changeMenu ); 2303 mActionRemoveVoice->plug( changeMenu );
2294 // settingsmings menu 2304 // settingsmings menu
2295//US special menuentry to configure the addressbook resources. On KDE 2305//US special menuentry to configure the addressbook resources. On KDE
2296// you do that through the control center !!! 2306// you do that through the control center !!!
2297 // settingsMenu->insertSeparator(); 2307 // settingsMenu->insertSeparator();
2298 2308
2299 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2309 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2300 mActionConfigGlobal->plug( settingsMenu, 1 ); 2310 mActionConfigGlobal->plug( settingsMenu, 1 );
2301 mActionConfigResources->plug( settingsMenu,2 ); 2311 mActionConfigResources->plug( settingsMenu,2 );
2302 settingsMenu->insertSeparator(3); 2312 settingsMenu->insertSeparator(3);
2303 2313
2304 if ( mIsPart ) { 2314 if ( mIsPart ) {
2305 //US not implemented yet 2315 //US not implemented yet
2306 //mActionConfigShortcuts->plug( settingsMenu ); 2316 //mActionConfigShortcuts->plug( settingsMenu );
2307 //mActionConfigureToolbars->plug( settingsMenu ); 2317 //mActionConfigureToolbars->plug( settingsMenu );
2308 2318
2309 } else { 2319 } else {
2310 //US not implemented yet 2320 //US not implemented yet
2311 //mActionKeyBindings->plug( settingsMenu ); 2321 //mActionKeyBindings->plug( settingsMenu );
2312 } 2322 }
2313 2323
2314 mActionEditCategories->plug( settingsMenu ); 2324 mActionEditCategories->plug( settingsMenu );
2315 mActionManageCategories->plug( settingsMenu ); 2325 mActionManageCategories->plug( settingsMenu );
2316 mActionJumpBar->plug( viewMenu,0 ); 2326 mActionJumpBar->plug( viewMenu,0 );
2317 mActionDetails->plug( viewMenu,0 ); 2327 mActionDetails->plug( viewMenu,0 );
2318 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2328 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2319 mActionDetails->plug( tb ); 2329 mActionDetails->plug( tb );
2320 settingsMenu->insertSeparator(); 2330 settingsMenu->insertSeparator();
2321#ifndef DESKTOP_VERSION 2331#ifndef DESKTOP_VERSION
2322 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2332 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2323 settingsMenu->insertSeparator(); 2333 settingsMenu->insertSeparator();
2324#endif 2334#endif
2325 2335
2326 mActionWhoAmI->plug( settingsMenu ); 2336 mActionWhoAmI->plug( settingsMenu );
2327 //mActionEditCategories->plug( changeMenu ); 2337 //mActionEditCategories->plug( changeMenu );
2328 mActionCategories->plug( changeMenu ); 2338 mActionCategories->plug( changeMenu );
2329 //mActionManageCategories->plug( changeMenu ); 2339 //mActionManageCategories->plug( changeMenu );
2330 2340
2331 //mActionCategories->plug( settingsMenu ); 2341 //mActionCategories->plug( settingsMenu );
2332 2342
2333 2343
2334 mActionWN->plug( helpMenu ); 2344 mActionWN->plug( helpMenu );
2335 mActionStorageHowto->plug( helpMenu ); 2345 mActionStorageHowto->plug( helpMenu );
2336 mActionSyncHowto->plug( helpMenu ); 2346 mActionSyncHowto->plug( helpMenu );
2337 mActionKdeSyncHowto->plug( helpMenu ); 2347 mActionKdeSyncHowto->plug( helpMenu );
2338 mActionMultiSyncHowto->plug( helpMenu ); 2348 mActionMultiSyncHowto->plug( helpMenu );
2339 mActionFaq->plug( helpMenu ); 2349 mActionFaq->plug( helpMenu );
2340 mActionLicence->plug( helpMenu ); 2350 mActionLicence->plug( helpMenu );
2341 mActionAboutKAddressbook->plug( helpMenu ); 2351 mActionAboutKAddressbook->plug( helpMenu );
2342 2352
2343 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2353 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2344 2354
2345 mActionSave->plug( tb ); 2355 mActionSave->plug( tb );
2346 mViewManager->getFilterAction()->plug ( tb); 2356 mViewManager->getFilterAction()->plug ( tb);
2347 //LR hide filteraction on started in 480x640 2357 //LR hide filteraction on started in 480x640
2348 if (QApplication::desktop()->width() == 480 ) { 2358 if (QApplication::desktop()->width() == 480 ) {
2349 mViewManager->getFilterAction()->setComboWidth( 0 ); 2359 mViewManager->getFilterAction()->setComboWidth( 0 );
2350 } 2360 }
2351 mActionUndo->plug( tb ); 2361 mActionUndo->plug( tb );
2352 mActionDelete->plug( tb ); 2362 mActionDelete->plug( tb );
2353 mActionRedo->plug( tb ); 2363 mActionRedo->plug( tb );
2354 } else { 2364 } else {
2355 mActionSave->plug( tb ); 2365 mActionSave->plug( tb );
2356 tb->enableMoving(false); 2366 tb->enableMoving(false);
2357 } 2367 }
2358 //mActionQuit->plug ( tb ); 2368 //mActionQuit->plug ( tb );
2359 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2369 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2360 2370
2361 //US link the searchwidget first to this. 2371 //US link the searchwidget first to this.
2362 // The real linkage to the toolbar happens later. 2372 // The real linkage to the toolbar happens later.
2363//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2373//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2364//US tb->insertItem( mIncSearchWidget ); 2374//US tb->insertItem( mIncSearchWidget );
2365/*US 2375/*US
2366 mIncSearchWidget = new IncSearchWidget( tb ); 2376 mIncSearchWidget = new IncSearchWidget( tb );
2367 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2377 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2368 SLOT( incrementalSearch( const QString& ) ) ); 2378 SLOT( incrementalSearch( const QString& ) ) );
2369 2379
2370 mJumpButtonBar = new JumpButtonBar( this, this ); 2380 mJumpButtonBar = new JumpButtonBar( this, this );
2371 2381
2372//US topLayout->addWidget( mJumpButtonBar ); 2382//US topLayout->addWidget( mJumpButtonBar );
2373 this->layout()->add( mJumpButtonBar ); 2383 this->layout()->add( mJumpButtonBar );
2374*/ 2384*/
2375 2385
2376#endif //KAB_EMBEDDED 2386#endif //KAB_EMBEDDED
2377 2387
2378 mActionExport2phone->plug( ExportMenu ); 2388 mActionExport2phone->plug( ExportMenu );
2379 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2389 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2380 syncManager->fillSyncMenu(); 2390 syncManager->fillSyncMenu();
2381 2391
2382} 2392}
2383void KABCore::showLicence() 2393void KABCore::showLicence()
2384{ 2394{
2385 KApplication::showLicence(); 2395 KApplication::showLicence();
2386} 2396}
2387 2397
2388void KABCore::manageCategories( ) 2398void KABCore::manageCategories( )
2389{ 2399{
2390 KABCatPrefs* cp = new KABCatPrefs(); 2400 KABCatPrefs* cp = new KABCatPrefs();
2391 cp->show(); 2401 cp->show();
2392 int w =cp->sizeHint().width() ; 2402 int w =cp->sizeHint().width() ;
2393 int h = cp->sizeHint().height() ; 2403 int h = cp->sizeHint().height() ;
2394 int dw = QApplication::desktop()->width(); 2404 int dw = QApplication::desktop()->width();
2395 int dh = QApplication::desktop()->height(); 2405 int dh = QApplication::desktop()->height();
2396 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2406 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2397 if ( !cp->exec() ) { 2407 if ( !cp->exec() ) {
2398 delete cp; 2408 delete cp;
2399 return; 2409 return;
2400 } 2410 }
2401 int count = 0; 2411 int count = 0;
2402 int cc = 0; 2412 int cc = 0;
2403 message( i18n("Please wait, processing categories...")); 2413 message( i18n("Please wait, processing categories..."));
2404 if ( cp->addCat() ) { 2414 if ( cp->addCat() ) {
2405 KABC::AddressBook::Iterator it; 2415 KABC::AddressBook::Iterator it;
2406 QStringList catList = KABPrefs::instance()->mCustomCategories; 2416 QStringList catList = KABPrefs::instance()->mCustomCategories;
2407 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2417 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2408 ++cc; 2418 ++cc;
2409 if ( cc %10 == 0) 2419 if ( cc %10 == 0)
2410 message(i18n("Processing contact #%1").arg(cc)); 2420 message(i18n("Processing contact #%1").arg(cc));
2411 QStringList catIncList = (*it).categories(); 2421 QStringList catIncList = (*it).categories();
2412 int i; 2422 int i;
2413 for( i = 0; i< catIncList.count(); ++i ) { 2423 for( i = 0; i< catIncList.count(); ++i ) {
2414 if ( !catList.contains (catIncList[i])) { 2424 if ( !catList.contains (catIncList[i])) {
2415 catList.append( catIncList[i] ); 2425 catList.append( catIncList[i] );
2416 //qDebug("add cat %s ", catIncList[i].latin1()); 2426 //qDebug("add cat %s ", catIncList[i].latin1());
2417 ++count; 2427 ++count;
2418 } 2428 }
2419 } 2429 }
2420 } 2430 }
2421 catList.sort(); 2431 catList.sort();
2422 KABPrefs::instance()->mCustomCategories = catList; 2432 KABPrefs::instance()->mCustomCategories = catList;
2423 KABPrefs::instance()->writeConfig(); 2433 KABPrefs::instance()->writeConfig();
2424 message(QString::number( count )+ i18n(" categories added to list! ")); 2434 message(QString::number( count )+ i18n(" categories added to list! "));
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 02fc40a..272f2eb 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -1,490 +1,492 @@
1// $Id$ 1// $Id$
2 2
3#include <qvbox.h> 3#include <qvbox.h>
4#include <qlistbox.h> 4#include <qlistbox.h>
5#include <qwidget.h> 5#include <qwidget.h>
6#include <qfile.h> 6#include <qfile.h>
7#include <qimage.h> 7#include <qimage.h>
8#include <qcombobox.h> 8#include <qcombobox.h>
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qdragobject.h> 10#include <qdragobject.h>
11#include <qevent.h> 11#include <qevent.h>
12#include <qurl.h> 12#include <qurl.h>
13#include <qpixmap.h> 13#include <qpixmap.h>
14 14
15#include <kabc/addressbook.h> 15#include <kabc/addressbook.h>
16#include <kapplication.h> 16#include <kapplication.h>
17#include <kconfig.h> 17#include <kconfig.h>
18#include <kcolorbutton.h> 18#include <kcolorbutton.h>
19#include <kdebug.h> 19#include <kdebug.h>
20#include <kglobal.h> 20#include <kglobal.h>
21#include <kiconloader.h> 21#include <kiconloader.h>
22#include <klineedit.h> 22#include <klineedit.h>
23#include <klocale.h> 23#include <klocale.h>
24#include <kmessagebox.h> 24#include <kmessagebox.h>
25#include <kurl.h> 25#include <kurl.h>
26#include <kurlrequester.h> 26#include <kurlrequester.h>
27 27
28//US#include "configuretableviewdialog.h" 28//US#include "configuretableviewdialog.h"
29#include "contactlistview.h" 29#include "contactlistview.h"
30#include "kabprefs.h" 30#include "kabprefs.h"
31#include "undocmds.h" 31#include "undocmds.h"
32#include "viewmanager.h" 32#include "viewmanager.h"
33 33
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qheader.h> 35#include <qheader.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include "kaddressbooktableview.h" 38#include "kaddressbooktableview.h"
39 39
40 40
41KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, 41KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
42 QWidget *parent, const char *name ) 42 QWidget *parent, const char *name )
43 : KAddressBookView( ab, parent, name ) 43 : KAddressBookView( ab, parent, name )
44{ 44{
45 mainLayout = new QVBoxLayout( viewWidget(), 2 ); 45 mainLayout = new QVBoxLayout( viewWidget(), 2 );
46 46
47 // The list view will be created when the config is read. 47 // The list view will be created when the config is read.
48 mListView = 0; 48 mListView = 0;
49} 49}
50 50
51KAddressBookTableView::~KAddressBookTableView() 51KAddressBookTableView::~KAddressBookTableView()
52{ 52{
53} 53}
54void KAddressBookTableView::setFocusAV() 54void KAddressBookTableView::setFocusAV()
55{ 55{
56 if ( mListView ) 56 if ( mListView )
57 mListView->setFocus(); 57 mListView->setFocus();
58 58
59} 59}
60void KAddressBookTableView::scrollUP() 60void KAddressBookTableView::scrollUP()
61{ 61{
62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
63 QApplication::postEvent( mListView, ev ); 63 QApplication::postEvent( mListView, ev );
64 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 ); 64 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
65 QApplication::postEvent( mListView, ev ); 65 QApplication::postEvent( mListView, ev );
66} 66}
67void KAddressBookTableView::scrollDOWN() 67void KAddressBookTableView::scrollDOWN()
68{ 68{
69 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 69 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
70 QApplication::postEvent( mListView, ev ); 70 QApplication::postEvent( mListView, ev );
71 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); 71 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
72 QApplication::postEvent( mListView, ev ); 72 QApplication::postEvent( mListView, ev );
73} 73}
74void KAddressBookTableView::reconstructListView() 74void KAddressBookTableView::reconstructListView()
75{ 75{
76 if (mListView) 76 if (mListView)
77 { 77 {
78 disconnect(mListView, SIGNAL(selectionChanged()), 78 disconnect(mListView, SIGNAL(selectionChanged()),
79 this, SLOT(addresseeSelected())); 79 this, SLOT(addresseeSelected()));
80 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 80 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
81 this, SLOT(addresseeExecuted(QListViewItem*))); 81 this, SLOT(addresseeExecuted(QListViewItem*)));
82 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 82 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
83 this, SLOT(addresseeExecuted(QListViewItem*))); 83 this, SLOT(addresseeExecuted(QListViewItem*)));
84 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 84 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
85 SIGNAL(startDrag())); 85 SIGNAL(startDrag()));
86 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 86 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
87 this, SLOT(addresseeExecuted(QListViewItem*))); 87 this, SLOT(addresseeExecuted(QListViewItem*)));
88 88
89 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 89 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
90 SIGNAL(dropped(QDropEvent*))); 90 SIGNAL(dropped(QDropEvent*)));
91 delete mListView; 91 delete mListView;
92 } 92 }
93 93
94 mListView = new ContactListView( this, addressBook(), viewWidget() ); 94 mListView = new ContactListView( this, addressBook(), viewWidget() );
95 95
96 connect(this, SIGNAL(printView()), 96 connect(this, SIGNAL(printView()),
97 mListView , SLOT(printMe())); 97 mListView , SLOT(printMe()));
98 //US set singleClick manually, because it is no global configparameter in embedded space 98 //US set singleClick manually, because it is no global configparameter in embedded space
99 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); 99 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
100 100
101 // Add the columns 101 // Add the columns
102 KABC::Field::List fieldList = fields(); 102 KABC::Field::List fieldList = fields();
103 KABC::Field::List::ConstIterator it; 103 KABC::Field::List::ConstIterator it;
104 104
105 int c = 0; 105 int c = 0;
106 for( it = fieldList.begin(); it != fieldList.end(); ++it ) { 106 for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
107 mListView->addColumn( (*it)->label() ); 107 mListView->addColumn( (*it)->label() );
108 mListView->setColumnWidthMode(c++, QListView::Manual); 108 mListView->setColumnWidthMode(c++, QListView::Manual);
109//US 109//US
110 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); 110 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
111 } 111 }
112 112
113 connect(mListView, SIGNAL(selectionChanged()), 113 connect(mListView, SIGNAL(selectionChanged()),
114 this, SLOT(addresseeSelected())); 114 this, SLOT(addresseeSelected()));
115 connect(mListView, SIGNAL(startAddresseeDrag()), this, 115 connect(mListView, SIGNAL(startAddresseeDrag()), this,
116 SIGNAL(startDrag())); 116 SIGNAL(startDrag()));
117 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 117 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
118 SIGNAL(dropped(QDropEvent*))); 118 SIGNAL(dropped(QDropEvent*)));
119 119
120 if (KABPrefs::instance()->mHonorSingleClick) { 120 if (KABPrefs::instance()->mHonorSingleClick) {
121 // qDebug("KAddressBookTableView::reconstructListView single"); 121 // qDebug("KAddressBookTableView::reconstructListView single");
122 connect(mListView, SIGNAL(executed(QListViewItem*)), 122 connect(mListView, SIGNAL(executed(QListViewItem*)),
123 this, SLOT(addresseeExecuted(QListViewItem*))); 123 this, SLOT(addresseeExecuted(QListViewItem*)));
124 } else { 124 } else {
125 // qDebug("KAddressBookTableView::reconstructListView double"); 125 // qDebug("KAddressBookTableView::reconstructListView double");
126 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 126 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
127 this, SLOT(addresseeExecuted(QListViewItem*))); 127 this, SLOT(addresseeExecuted(QListViewItem*)));
128 } 128 }
129 connect(mListView, SIGNAL(returnPressed(QListViewItem*)), 129 connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
130 this, SLOT(addresseeExecuted(QListViewItem*))); 130 this, SLOT(addresseeExecuted(QListViewItem*)));
131 connect(mListView, SIGNAL(signalDelete()), 131 connect(mListView, SIGNAL(signalDelete()),
132 this, SLOT(addresseeDeleted())); 132 this, SLOT(addresseeDeleted()));
133 133
134//US performceimprovement. Refresh is done from the outside 134//US performceimprovement. Refresh is done from the outside
135//US refresh(); 135//US refresh();
136 136
137 mListView->setSorting( 0, true ); 137 mListView->setSorting( 0, true );
138 mainLayout->addWidget( mListView ); 138 mainLayout->addWidget( mListView );
139 mainLayout->activate(); 139 mainLayout->activate();
140 mListView->show(); 140 mListView->show();
141} 141}
142 142
143void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) 143void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
144{ 144{
145 mListView->clear(); 145 mListView->clear();
146 if ( s.isEmpty() || s == "*" ) { 146 if ( s.isEmpty() || s == "*" ) {
147 refresh(); 147 refresh();
148 return; 148 return;
149 } 149 }
150 QRegExp re = getRegExp( s ); 150 QRegExp re = getRegExp( s );
151 if (!re.isValid()) 151 if (!re.isValid())
152 return; 152 return;
153 KABC::Addressee::List addresseeList = addressees(); 153 KABC::Addressee::List addresseeList = addressees();
154 KABC::Addressee::List::Iterator it; 154 KABC::Addressee::List::Iterator it;
155 if ( field ) { 155 if ( field ) {
156 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 156 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
157 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 157 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
158 continue; 158 continue;
159#if QT_VERSION >= 0x030000 159#if QT_VERSION >= 0x030000
160 if (re.search(field->value( *it ).lower()) == 0) 160 if (re.search(field->value( *it ).lower()) == 0)
161#else 161#else
162 if (re.match(field->value( *it ).lower()) == 0) 162 if (re.match(field->value( *it ).lower()) == 0)
163#endif 163#endif
164 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 164 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
165 165
166 } 166 }
167 } else { 167 } else {
168 KABC::Field::List fieldList = allFields(); 168 KABC::Field::List fieldList = allFields();
169 KABC::Field::List::ConstIterator fieldIt; 169 KABC::Field::List::ConstIterator fieldIt;
170 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 170 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
171 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 171 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
172 continue; 172 continue;
173 bool match = false; 173 bool match = false;
174 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 174 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
175#if QT_VERSION >= 0x030000 175#if QT_VERSION >= 0x030000
176 if (re.search((*fieldIt)->value( *it ).lower()) == 0) 176 if (re.search((*fieldIt)->value( *it ).lower()) == 0)
177#else 177#else
178 if (re.match((*fieldIt)->value( *it ).lower()) == 0) 178 if (re.match((*fieldIt)->value( *it ).lower()) == 0)
179#endif 179#endif
180 { 180 {
181 //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); 181 //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() );
182 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 182 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
183 match = true; 183 match = true;
184 break; 184 break;
185 } 185 }
186 } 186 }
187 if ( ! match ) { 187 if ( ! match ) {
188 if ( (*it).matchPhoneNumber( &re ) ) { 188 if ( (*it).matchPhoneNumber( &re ) ) {
189 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 189 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
190 match = true; 190 match = true;
191 break; 191 break;
192 } 192 }
193 } 193 }
194 if ( ! match ) { 194 if ( ! match ) {
195 if ( (*it).matchAddress( &re ) ) { 195 if ( (*it).matchAddress( &re ) ) {
196 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 196 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
197 match = true; 197 match = true;
198 break; 198 break;
199 } 199 }
200 } 200 }
201 } 201 }
202 } 202 }
203 // Sometimes the background pixmap gets messed up when we add lots 203 // Sometimes the background pixmap gets messed up when we add lots
204 // of items. 204 // of items.
205 //mListView->repaint(); 205 //mListView->repaint();
206 if ( mListView->firstChild() ) { 206 if ( mListView->firstChild() ) {
207 mListView->setCurrentItem ( mListView->firstChild() ); 207 mListView->setCurrentItem ( mListView->firstChild() );
208 mListView->setSelected ( mListView->firstChild(), true ); 208 mListView->setSelected ( mListView->firstChild(), true );
209 } 209 }
210 else 210 else
211 emit selected(QString::null); 211 emit selected(QString::null);
212 212
213} 213}
214void KAddressBookTableView::writeConfig(KConfig *config) 214void KAddressBookTableView::writeConfig(KConfig *config)
215{ 215{
216 KAddressBookView::writeConfig(config); 216 KAddressBookView::writeConfig(config);
217 217
218 mListView->saveLayout(config, config->group()); 218 mListView->saveLayout(config, config->group());
219} 219}
220 220
221void KAddressBookTableView::readConfig(KConfig *config) 221void KAddressBookTableView::readConfig(KConfig *config)
222{ 222{
223 KAddressBookView::readConfig( config ); 223 KAddressBookView::readConfig( config );
224 // The config could have changed the fields, so we need to reconstruct 224 // The config could have changed the fields, so we need to reconstruct
225 // the listview. 225 // the listview.
226 reconstructListView(); 226 reconstructListView();
227 227
228 // costum colors? 228 // costum colors?
229 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 229 if ( config->readBoolEntry( "EnableCustomColors", false ) )
230 { 230 {
231 QPalette p( mListView->palette() ); 231 QPalette p( mListView->palette() );
232 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 232 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
233 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 233 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
234 c = p.color(QPalette::Normal, QColorGroup::Text ); 234 c = p.color(QPalette::Normal, QColorGroup::Text );
235 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); 235 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
236 c = p.color(QPalette::Normal, QColorGroup::Button ); 236 c = p.color(QPalette::Normal, QColorGroup::Button );
237 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); 237 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
238 c = p.color(QPalette::Normal, QColorGroup::ButtonText ); 238 c = p.color(QPalette::Normal, QColorGroup::ButtonText );
239 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); 239 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
240 c = p.color(QPalette::Normal, QColorGroup::Highlight ); 240 c = p.color(QPalette::Normal, QColorGroup::Highlight );
241 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); 241 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
242 c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); 242 c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
243 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); 243 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
244#ifndef KAB_EMBEDDED 244#ifndef KAB_EMBEDDED
245 c = KGlobalSettings::alternateBackgroundColor(); 245 c = KGlobalSettings::alternateBackgroundColor();
246#else //KAB_EMBEDDED 246#else //KAB_EMBEDDED
247 c = QColor(240, 240, 240); 247 c = QColor(240, 240, 240);
248#endif //KAB_EMBEDDED 248#endif //KAB_EMBEDDED
249 c = config->readColorEntry ("AlternatingBackgroundColor", &c); 249 c = config->readColorEntry ("AlternatingBackgroundColor", &c);
250 mListView->setAlternateColor(c); 250 mListView->setAlternateColor(c);
251 251
252 252
253 //US mListView->viewport()->setPalette( p ); 253 //US mListView->viewport()->setPalette( p );
254 mListView->setPalette( p ); 254 mListView->setPalette( p );
255 } 255 }
256 else 256 else
257 { 257 {
258 // needed if turned off during a session. 258 // needed if turned off during a session.
259 //US mListView->viewport()->setPalette( mListView->palette() ); 259 //US mListView->viewport()->setPalette( mListView->palette() );
260 mListView->setPalette( mListView->palette() ); 260 mListView->setPalette( mListView->palette() );
261 } 261 }
262 262
263 //custom fonts? 263 //custom fonts?
264 QFont f( font() ); 264 QFont f( font() );
265 if ( config->readBoolEntry( "EnableCustomFonts", false ) ) 265 if ( config->readBoolEntry( "EnableCustomFonts", false ) )
266 { 266 {
267 mListView->setFont( config->readFontEntry( "TextFont", &f) ); 267 mListView->setFont( config->readFontEntry( "TextFont", &f) );
268 f.setBold( true ); 268 f.setBold( true );
269 //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); 269 //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
270 mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); 270 mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) );
271 } 271 }
272 else 272 else
273 { 273 {
274 mListView->setFont( f ); 274 mListView->setFont( f );
275 f.setBold( true ); 275 f.setBold( true );
276 //US mListView->setHeaderFont( f ); 276 //US mListView->setHeaderFont( f );
277 mListView->header()->setFont( f ); 277 mListView->header()->setFont( f );
278 } 278 }
279 279
280 // Set the list view options 280 // Set the list view options
281 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", 281 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground",
282 true)); 282 true));
283 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); 283 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false));
284 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); 284 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true));
285 285
286 if (config->readBoolEntry("Background", false)) 286 if (config->readBoolEntry("Background", false))
287 mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); 287 mListView->setBackgroundPixmap(config->readEntry("BackgroundName"));
288 288
289 // Restore the layout of the listview 289 // Restore the layout of the listview
290 mListView->restoreLayout(config, config->group()); 290 mListView->restoreLayout(config, config->group());
291} 291}
292 292
293void KAddressBookTableView::refresh(QString uid) 293void KAddressBookTableView::refresh(QString uid)
294{ 294{
295 // For now just repopulate. In reality this method should 295 // For now just repopulate. In reality this method should
296 // check the value of uid, and if valid iterate through 296 // check the value of uid, and if valid iterate through
297 // the listview to find the entry, then tell it to refresh. 297 // the listview to find the entry, then tell it to refresh.
298 298
299 if (uid.isNull()) { 299 if (uid.isNull()) {
300 // Clear the list view 300 // Clear the list view
301 QString currentUID, nextUID; 301 QString currentUID, nextUID;
302#ifndef KAB_EMBEDDED 302#ifndef KAB_EMBEDDED
303 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); 303 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() );
304#else //KAB_EMBEDDED 304#else //KAB_EMBEDDED
305 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); 305 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() );
306#endif //KAB_EMBEDDED 306#endif //KAB_EMBEDDED
307 307
308 if ( currentItem ) { 308 if ( currentItem ) {
309#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
310 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); 310 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() );
311#else //KAB_EMBEDDED 311#else //KAB_EMBEDDED
312 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); 312 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() );
313#endif //KAB_EMBEDDED 313#endif //KAB_EMBEDDED
314 if ( nextItem ) 314 if ( nextItem )
315 nextUID = nextItem->addressee().uid(); 315 nextUID = nextItem->addressee().uid();
316 currentUID = currentItem->addressee().uid(); 316 currentUID = currentItem->addressee().uid();
317 } 317 }
318 318
319 mListView->clear(); 319 mListView->clear();
320 320
321 currentItem = 0; 321 currentItem = 0;
322 KABC::Addressee::List addresseeList = addressees(); 322 KABC::Addressee::List addresseeList = addressees();
323 KABC::Addressee::List::Iterator it; 323 KABC::Addressee::List::Iterator it;
324 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 324 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
325 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 325 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
326 continue; 326 continue;
327 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 327 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
328 if ( (*it).uid() == currentUID ) 328 if ( (*it).uid() == currentUID )
329 currentItem = item; 329 currentItem = item;
330 else if ( (*it).uid() == nextUID && !currentItem ) 330 else if ( (*it).uid() == nextUID && !currentItem )
331 currentItem = item; 331 currentItem = item;
332 } 332 }
333 333
334 // Sometimes the background pixmap gets messed up when we add lots 334 // Sometimes the background pixmap gets messed up when we add lots
335 // of items. 335 // of items.
336 mListView->repaint(); 336 mListView->repaint();
337 337 if ( !currentItem )
338 currentItem = (ContactListViewItem *)mListView->firstChild();
338 if ( currentItem ) { 339 if ( currentItem ) {
339 mListView->setCurrentItem( currentItem ); 340 mListView->setCurrentItem( currentItem );
340 mListView->ensureItemVisible( currentItem ); 341 mListView->ensureItemVisible( currentItem );
342 mListView->setSelected( currentItem, true );
341 } 343 }
342 } else { 344 } else {
343 // Only need to update on entry. Iterate through and try to find it 345 // Only need to update on entry. Iterate through and try to find it
344 ContactListViewItem *ceItem; 346 ContactListViewItem *ceItem;
345 QListViewItemIterator it( mListView ); 347 QListViewItemIterator it( mListView );
346 while ( it.current() ) { 348 while ( it.current() ) {
347#ifndef KAB_EMBEDDED 349#ifndef KAB_EMBEDDED
348 ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); 350 ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
349#else //KAB_EMBEDDED 351#else //KAB_EMBEDDED
350 ceItem = (ContactListViewItem*)( it.current() ); 352 ceItem = (ContactListViewItem*)( it.current() );
351#endif //KAB_EMBEDDED 353#endif //KAB_EMBEDDED
352 354
353 if ( ceItem && ceItem->addressee().uid() == uid ) { 355 if ( ceItem && ceItem->addressee().uid() == uid ) {
354 ceItem->refresh(); 356 ceItem->refresh();
355 return; 357 return;
356 } 358 }
357 ++it; 359 ++it;
358 } 360 }
359 361
360 refresh( QString::null ); 362 refresh( QString::null );
361 } 363 }
362} 364}
363 365
364QStringList KAddressBookTableView::selectedUids() 366QStringList KAddressBookTableView::selectedUids()
365{ 367{
366 QStringList uidList; 368 QStringList uidList;
367 QListViewItem *item; 369 QListViewItem *item;
368 ContactListViewItem *ceItem; 370 ContactListViewItem *ceItem;
369 371
370 for(item = mListView->firstChild(); item; item = item->itemBelow()) 372 for(item = mListView->firstChild(); item; item = item->itemBelow())
371 { 373 {
372 if (mListView->isSelected( item )) 374 if (mListView->isSelected( item ))
373 { 375 {
374#ifndef KAB_EMBEDDED 376#ifndef KAB_EMBEDDED
375 ceItem = dynamic_cast<ContactListViewItem*>(item); 377 ceItem = dynamic_cast<ContactListViewItem*>(item);
376#else //KAB_EMBEDDED 378#else //KAB_EMBEDDED
377 ceItem = (ContactListViewItem*)(item); 379 ceItem = (ContactListViewItem*)(item);
378#endif //KAB_EMBEDDED 380#endif //KAB_EMBEDDED
379 381
380 if (ceItem != 0L) 382 if (ceItem != 0L)
381 uidList << ceItem->addressee().uid(); 383 uidList << ceItem->addressee().uid();
382 } 384 }
383 } 385 }
384 if ( uidList.count() == 0 ) 386 if ( uidList.count() == 0 )
385 if ( mListView->currentItem() ) { 387 if ( mListView->currentItem() ) {
386 ceItem = (ContactListViewItem*)(mListView->currentItem()) ; 388 ceItem = (ContactListViewItem*)(mListView->currentItem()) ;
387 uidList << ceItem->addressee().uid(); 389 uidList << ceItem->addressee().uid();
388 } 390 }
389 391
390 return uidList; 392 return uidList;
391} 393}
392 394
393void KAddressBookTableView::setSelected(QString uid, bool selected) 395void KAddressBookTableView::setSelected(QString uid, bool selected)
394{ 396{
395 QListViewItem *item; 397 QListViewItem *item;
396 ContactListViewItem *ceItem; 398 ContactListViewItem *ceItem;
397 399
398 if (uid.isNull()) 400 if (uid.isNull())
399 { 401 {
400 mListView->selectAll(selected); 402 mListView->selectAll(selected);
401 } 403 }
402 else 404 else
403 { 405 {
404 for(item = mListView->firstChild(); item; item = item->itemBelow()) 406 for(item = mListView->firstChild(); item; item = item->itemBelow())
405 { 407 {
406#ifndef KAB_EMBEDDED 408#ifndef KAB_EMBEDDED
407 ceItem = dynamic_cast<ContactListViewItem*>(item); 409 ceItem = dynamic_cast<ContactListViewItem*>(item);
408#else //KAB_EMBEDDED 410#else //KAB_EMBEDDED
409 ceItem = (ContactListViewItem*)(item); 411 ceItem = (ContactListViewItem*)(item);
410#endif //KAB_EMBEDDED 412#endif //KAB_EMBEDDED
411 413
412 414
413 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) 415 if ((ceItem != 0L) && (ceItem->addressee().uid() == uid))
414 { 416 {
415 mListView->setSelected(item, selected); 417 mListView->setSelected(item, selected);
416 418
417 if (selected) 419 if (selected)
418 mListView->ensureItemVisible(item); 420 mListView->ensureItemVisible(item);
419 } 421 }
420 } 422 }
421 } 423 }
422} 424}
423 425
424void KAddressBookTableView::addresseeSelected() 426void KAddressBookTableView::addresseeSelected()
425{ 427{
426 // We need to try to find the first selected item. This might not be the 428 // We need to try to find the first selected item. This might not be the
427 // last selected item, but when QListView is in multiselection mode, 429 // last selected item, but when QListView is in multiselection mode,
428 // there is no way to figure out which one was 430 // there is no way to figure out which one was
429 // selected last. 431 // selected last.
430 QListViewItem *item; 432 QListViewItem *item;
431 bool found =false; 433 bool found =false;
432 for (item = mListView->firstChild(); item && !found; 434 for (item = mListView->firstChild(); item && !found;
433 item = item->nextSibling()) 435 item = item->nextSibling())
434 { 436 {
435 if (item->isSelected()) 437 if (item->isSelected())
436 { 438 {
437 found = true; 439 found = true;
438#ifndef KAB_EMBEDDED 440#ifndef KAB_EMBEDDED
439 ContactListViewItem *ceItem 441 ContactListViewItem *ceItem
440 = dynamic_cast<ContactListViewItem*>(item); 442 = dynamic_cast<ContactListViewItem*>(item);
441#else //KAB_EMBEDDED 443#else //KAB_EMBEDDED
442 ContactListViewItem *ceItem 444 ContactListViewItem *ceItem
443 = (ContactListViewItem*)(item); 445 = (ContactListViewItem*)(item);
444#endif //KAB_EMBEDDED 446#endif //KAB_EMBEDDED
445 447
446 if ( ceItem ) emit selected(ceItem->addressee().uid()); 448 if ( ceItem ) emit selected(ceItem->addressee().uid());
447 } 449 }
448 } 450 }
449 451
450 if (!found) 452 if (!found)
451 emit selected(QString::null); 453 emit selected(QString::null);
452} 454}
453 455
454void KAddressBookTableView::addresseeExecuted(QListViewItem *item) 456void KAddressBookTableView::addresseeExecuted(QListViewItem *item)
455{ 457{
456 if (item) 458 if (item)
457 { 459 {
458#ifndef KAB_EMBEDDED 460#ifndef KAB_EMBEDDED
459 ContactListViewItem *ceItem 461 ContactListViewItem *ceItem
460 = dynamic_cast<ContactListViewItem*>(item); 462 = dynamic_cast<ContactListViewItem*>(item);
461#else //KAB_EMBEDDED 463#else //KAB_EMBEDDED
462 ContactListViewItem *ceItem 464 ContactListViewItem *ceItem
463 = (ContactListViewItem*)(item); 465 = (ContactListViewItem*)(item);
464#endif //KAB_EMBEDDED 466#endif //KAB_EMBEDDED
465 467
466 if (ceItem) 468 if (ceItem)
467 { 469 {
468 emit executed(ceItem->addressee().uid()); 470 emit executed(ceItem->addressee().uid());
469 } 471 }
470 } 472 }
471 else 473 else
472 { 474 {
473 emit executed(QString::null); 475 emit executed(QString::null);
474 } 476 }
475} 477}
476 478
477void KAddressBookTableView::addresseeDeleted() 479void KAddressBookTableView::addresseeDeleted()
478{ 480{
479 481
480 emit deleteRequest(); 482 emit deleteRequest();
481 483
482} 484}
483 485
484 486
485 487
486 488
487 489
488#ifndef KAB_EMBEDDED 490#ifndef KAB_EMBEDDED
489#include "kaddressbooktableview.moc" 491#include "kaddressbooktableview.moc"
490#endif //KAB_EMBEDDED 492#endif //KAB_EMBEDDED
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 8c72d89..70baf5c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1901 +1,1902 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qtopia/alarmserver.h> 27#include <qtopia/alarmserver.h>
28#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
29#include <unistd.h> // for sleep 29#include <unistd.h> // for sleep
30#else 30#else
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qapplication.h> 32#include <qapplication.h>
33//#include <resource.h> 33//#include <resource.h>
34 34
35#endif 35#endif
36#include <libkcal/calendarlocal.h> 36#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 37#include <libkcal/todo.h>
38#include <libkcal/phoneformat.h> 38#include <libkcal/phoneformat.h>
39#include <libkdepim/ksyncprofile.h> 39#include <libkdepim/ksyncprofile.h>
40#include <libkdepim/phoneaccess.h> 40#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 41#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43 43
44#include "calendarview.h" 44#include "calendarview.h"
45#include "koviewmanager.h" 45#include "koviewmanager.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47#include "koagendaview.h" 47#include "koagendaview.h"
48#include "kojournalview.h" 48#include "kojournalview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "ktoolbar.h" 59#include "ktoolbar.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63#include <kglobalsettings.h> 63#include <kglobalsettings.h>
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
138{ 138{
139 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 145 //int size = 12;
146 { 146 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mClosed = false; 173 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 179 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 186 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Bottom; 190 tbd = Bottom;
191 else 191 else
192 tbd = Top; 192 tbd = Top;
193 } 193 }
194 else { 194 else {
195 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
196 tbd = Right; 196 tbd = Right;
197 else 197 else
198 tbd = Left; 198 tbd = Left;
199 } 199 }
200 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
202 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
203 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
204 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
205 205
206#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
207 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
208#else 208#else
209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) ) 209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
210#endif 210#endif
211 211
212{ 212{
213 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Bottom; 215 tbd = Bottom;
216 else 216 else
217 tbd = Top; 217 tbd = Top;
218 } 218 }
219 else { 219 else {
220 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
221 tbd = Right; 221 tbd = Right;
222 else 222 else
223 tbd = Left; 223 tbd = Left;
224 } 224 }
225 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
226 filterMenubar = new KMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
227 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
228#ifndef DESKTOP_VERSION 228#ifndef DESKTOP_VERSION
229 filterToolBar->setFocusPolicy( NoFocus ); 229 filterToolBar->setFocusPolicy( NoFocus );
230 filterMenubar->setFocusPolicy( NoFocus ); 230 filterMenubar->setFocusPolicy( NoFocus );
231#endif 231#endif
232 filterPopupMenu = new QPopupMenu( this ); 232 filterPopupMenu = new QPopupMenu( this );
233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
234 QString addTest = "A"; 234 QString addTest = "A";
235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
236#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
237 addTest = "AAAAAABBBCCCx"; 237 addTest = "AAAAAABBBCCCx";
238#else 238#else
239 addTest = "AAAAAx"; 239 addTest = "AAAAAx";
240#endif 240#endif
241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
242 addToolBar (filterToolBar , tbd ); 242 addToolBar (filterToolBar , tbd );
243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
246 filterToolBar->hide(); 246 filterToolBar->hide();
247 } else { 247 } else {
248 filterToolBar = 0; 248 filterToolBar = 0;
249 filterMenubar = 0; 249 filterMenubar = 0;
250 filterPopupMenu = 0; 250 filterPopupMenu = 0;
251 } 251 }
252 if ( p->mShowIconOnetoolbar ) { 252 if ( p->mShowIconOnetoolbar ) {
253 viewToolBar = iconToolBar ; 253 viewToolBar = iconToolBar ;
254 navigatorToolBar = iconToolBar ; 254 navigatorToolBar = iconToolBar ;
255 } else { 255 } else {
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 setToolBarsMovable( false ); 257 setToolBarsMovable( false );
258#endif 258#endif
259 if ( p->mToolBarHorV ) { 259 if ( p->mToolBarHorV ) {
260 if ( p->mToolBarUpV ) 260 if ( p->mToolBarUpV )
261 tbd = Bottom; 261 tbd = Bottom;
262 else 262 else
263 tbd = Top; 263 tbd = Top;
264 } 264 }
265 else { 265 else {
266 if ( p->mToolBarUpV ) 266 if ( p->mToolBarUpV )
267 tbd = Right; 267 tbd = Right;
268 else 268 else
269 tbd = Left; 269 tbd = Left;
270 } 270 }
271 viewToolBar = new QPEToolBar( this ); 271 viewToolBar = new QPEToolBar( this );
272 addToolBar (viewToolBar , tbd ); 272 addToolBar (viewToolBar , tbd );
273 if ( p->mToolBarHorN ) { 273 if ( p->mToolBarHorN ) {
274 if ( p->mToolBarUpN ) 274 if ( p->mToolBarUpN )
275 tbd = Bottom; 275 tbd = Bottom;
276 else 276 else
277 tbd = Top; 277 tbd = Top;
278 } 278 }
279 else { 279 else {
280 if ( p->mToolBarUpN ) 280 if ( p->mToolBarUpN )
281 tbd = Right; 281 tbd = Right;
282 else 282 else
283 tbd = Left; 283 tbd = Left;
284 } 284 }
285 navigatorToolBar = new QPEToolBar( this ); 285 navigatorToolBar = new QPEToolBar( this );
286 addToolBar (navigatorToolBar , tbd ); 286 addToolBar (navigatorToolBar , tbd );
287 } 287 }
288 288
289 289
290 290
291 mCalendarModifiedFlag = false; 291 mCalendarModifiedFlag = false;
292 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 292 // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
293 splash->setAlignment ( AlignCenter ); 293 //splash->setAlignment ( AlignCenter );
294 setCentralWidget( splash ); 294 //setCentralWidget( splash );
295#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
296 showMaximized(); 296 //showMaximized();
297#endif 297#endif
298 298
299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
300 setDefaultPreferences(); 300 setDefaultPreferences();
301 mCalendar = new CalendarLocal(); 301 mCalendar = new CalendarLocal();
302 mView = new CalendarView( mCalendar, this,"mCalendar " ); 302 mView = new CalendarView( mCalendar, this,"mCalendar " );
303 mView->hide(); 303 setCentralWidget( mView );
304 //mView->hide();
304 //mView->resize(splash->size() ); 305 //mView->resize(splash->size() );
305 initActions(); 306 initActions();
306 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 307 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
307 mSyncManager->setBlockSave(false); 308 mSyncManager->setBlockSave(false);
308 mView->setSyncManager(mSyncManager); 309 mView->setSyncManager(mSyncManager);
309#ifndef DESKTOP_VERSION 310#ifndef DESKTOP_VERSION
310 iconToolBar->show(); 311 iconToolBar->show();
311 qApp->processEvents(); 312 qApp->processEvents();
312#endif 313#endif
313 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 314 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
314 int vh = height() ; 315 int vh = height() ;
315 int vw = width(); 316 int vw = width();
316 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 317 //qDebug("Toolbar hei %d ",iconToolBar->height() );
317 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 318 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
318 vh -= iconToolBar->height(); 319 vh -= iconToolBar->height();
319 } else { 320 } else {
320 vw -= iconToolBar->height(); 321 vw -= iconToolBar->height();
321 } 322 }
322 //mView->setMaximumSize( splash->size() ); 323 //mView->setMaximumSize( splash->size() );
323 //mView->resize( splash->size() ); 324 //mView->resize( splash->size() );
324 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
325 mView->readSettings(); 326 mView->readSettings();
326 bool newFile = false; 327 bool newFile = false;
327 if( !QFile::exists( defaultFileName() ) ) { 328 if( !QFile::exists( defaultFileName() ) ) {
328 QFileInfo finfo ( defaultFileName() ); 329 QFileInfo finfo ( defaultFileName() );
329 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 330 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
330 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 331 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
331 finfo.setFile( oldFile ); 332 finfo.setFile( oldFile );
332 if (finfo.exists() ) { 333 if (finfo.exists() ) {
333 KMessageBox::information( this, message); 334 KMessageBox::information( this, message);
334 mView->openCalendar( oldFile ); 335 mView->openCalendar( oldFile );
335 qApp->processEvents(); 336 qApp->processEvents();
336 } else { 337 } else {
337 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 338 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
338 finfo.setFile( oldFile ); 339 finfo.setFile( oldFile );
339 if (finfo.exists() ) { 340 if (finfo.exists() ) {
340 KMessageBox::information( this, message); 341 KMessageBox::information( this, message);
341 mView->openCalendar( oldFile ); 342 mView->openCalendar( oldFile );
342 qApp->processEvents(); 343 qApp->processEvents();
343 } 344 }
344 } 345 }
345 mView->saveCalendar( defaultFileName() ); 346 mView->saveCalendar( defaultFileName() );
346 newFile = true; 347 newFile = true;
347 } 348 }
348 349
349 //QTime neededSaveTime = QDateTime::currentDateTime().time(); 350 //QTime neededSaveTime = QDateTime::currentDateTime().time();
350 //mView->loadCalendars(); 351 //mView->loadCalendars();
351 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 352 //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
352 //qDebug("KO: Calendar loading time: %d ms",msNeeded ); 353 //qDebug("KO: Calendar loading time: %d ms",msNeeded );
353 354
354 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 355 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
355 KOPrefs::instance()->setAllDefaults(); 356 KOPrefs::instance()->setAllDefaults();
356 } 357 }
357 358
358 359
359 connect( mView, SIGNAL( tempDisableBR(bool) ), 360 connect( mView, SIGNAL( tempDisableBR(bool) ),
360 SLOT( disableBR(bool) ) ); 361 SLOT( disableBR(bool) ) );
361 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 362 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
362 setCentralWidget( mView ); 363 setCentralWidget( mView );
363 globalFlagBlockStartup = 0; 364 globalFlagBlockStartup = 0;
364 mView->show(); 365 //mView->show();
365 delete splash; 366 //delete splash;
366 if ( newFile ) 367 if ( newFile )
367 mView->updateConfig(); 368 mView->updateConfig();
368 // qApp->processEvents(); 369 // qApp->processEvents();
369 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 370 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
370 //fillSyncMenu(); 371 //fillSyncMenu();
371 372
372 373
373 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 374 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
374 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 375 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
375 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 376 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
376 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 377 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
377 mSyncManager->setDefaultFileName( sentSyncFile()); 378 mSyncManager->setDefaultFileName( sentSyncFile());
378 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 379 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
379 mSyncManager->fillSyncMenu(); 380 mSyncManager->fillSyncMenu();
380 381
381 382
382 383
383 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 384 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
384 if ( showWarning ) { 385 if ( showWarning ) {
385 KMessageBox::information( this, 386 KMessageBox::information( this,
386 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 387 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
387 qApp->processEvents(); 388 qApp->processEvents();
388 mView->dialogManager()->showSyncOptions(); 389 mView->dialogManager()->showSyncOptions();
389 } 390 }
390 391
391 //US listen for result adressed from Ka/Pi 392 //US listen for result adressed from Ka/Pi
392 393
393#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
394 infrared = 0; 395 infrared = 0;
395#endif 396#endif
396 updateFilterToolbar(); 397 updateFilterToolbar();
397 updateWeek( mView->startDate() ); 398 updateWeek( mView->startDate() );
398 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 399 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
399 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 400 SLOT( updateWeekNum( const KCal::DateList & ) ) );
400 mBRdisabled = false; 401 mBRdisabled = false;
401 //toggleBeamReceive(); 402 //toggleBeamReceive();
402 403
403 setCaption(i18n("Loading calendar files ... please wait" )); 404 setCaption(i18n("Loading calendar files ... please wait" ));
404 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); 405 QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() ));
405} 406}
406MainWindow::~MainWindow() 407MainWindow::~MainWindow()
407{ 408{
408 //qDebug("MainWindow::~MainWindow() "); 409 //qDebug("MainWindow::~MainWindow() ");
409 //save toolbar location 410 //save toolbar location
410 delete mCalendar; 411 delete mCalendar;
411 delete mSyncManager; 412 delete mSyncManager;
412#ifndef DESKTOP_VERSION 413#ifndef DESKTOP_VERSION
413 if ( infrared ) 414 if ( infrared )
414 delete infrared; 415 delete infrared;
415#endif 416#endif
416 417
417 418
418} 419}
419 420
420void MainWindow::loadDataAfterStart() 421void MainWindow::loadDataAfterStart()
421{ 422{
422 423
423 qDebug("KO: Start loading files..." ); 424 qDebug("KO: Start loading files..." );
424 QTime neededSaveTime = QDateTime::currentDateTime().time(); 425 QTime neededSaveTime = QDateTime::currentDateTime().time();
425 mView->loadCalendars(); 426 mView->loadCalendars();
426 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 427 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
427 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 428 qDebug("KO: Calendar loading time: %d ms",msNeeded );
428 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 429 //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
429 mView->setModified( false ); 430 mView->setModified( false );
430 mBlockAtStartup = false; 431 mBlockAtStartup = false;
431 mView->setModified( false ); 432 mView->setModified( false );
432 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 433 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
433 processIncidenceSelection( 0 ); 434 processIncidenceSelection( 0 );
434 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
435 SLOT( processIncidenceSelection( Incidence * ) ) ); 436 SLOT( processIncidenceSelection( Incidence * ) ) );
436 connect( mView, SIGNAL( modifiedChanged( bool ) ), 437 connect( mView, SIGNAL( modifiedChanged( bool ) ),
437 SLOT( slotModifiedChanged( bool ) ) ); 438 SLOT( slotModifiedChanged( bool ) ) );
438 439
439#ifndef DESKTOP_VERSION 440#ifndef DESKTOP_VERSION
440 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 441 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
441 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); 442 connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
442 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); 443 disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
443 if ( !mCStringMess.isEmpty() ) 444 if ( !mCStringMess.isEmpty() )
444 recieve( mCStringMess, mByteData ); 445 recieve( mCStringMess, mByteData );
445#endif 446#endif
446 447
447 448
448 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 449 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
449} 450}
450 451
451void MainWindow::slotResetFocus() 452void MainWindow::slotResetFocus()
452{ 453{
453 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 454 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
454 mFocusLoop = 3; 455 mFocusLoop = 3;
455 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 456 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
456} 457}
457void MainWindow::slotResetFocusLoop() 458void MainWindow::slotResetFocusLoop()
458{ 459{
459 --mFocusLoop; 460 --mFocusLoop;
460 QWidget* fw = mView->viewManager()->currentView(); 461 QWidget* fw = mView->viewManager()->currentView();
461 if ( fw ) { 462 if ( fw ) {
462 //qDebug("loop "); 463 //qDebug("loop ");
463 fw->setFocus(); 464 fw->setFocus();
464 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 465 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
465 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 466 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
466 } 467 }
467 468
468} 469}
469void MainWindow::disableBR(bool b) 470void MainWindow::disableBR(bool b)
470{ 471{
471#ifndef DESKTOP_VERSION 472#ifndef DESKTOP_VERSION
472 if ( b ) { 473 if ( b ) {
473 if ( infrared ) { 474 if ( infrared ) {
474 toggleBeamReceive(); 475 toggleBeamReceive();
475 mBRdisabled = true; 476 mBRdisabled = true;
476 } 477 }
477 mBRdisabled = true; 478 mBRdisabled = true;
478 } else { 479 } else {
479 if ( mBRdisabled ) { 480 if ( mBRdisabled ) {
480 mBRdisabled = false; 481 mBRdisabled = false;
481 //makes no sense,because other cal ap is probably running 482 //makes no sense,because other cal ap is probably running
482 // toggleBeamReceive(); 483 // toggleBeamReceive();
483 } 484 }
484 } 485 }
485#endif 486#endif
486 487
487} 488}
488bool MainWindow::beamReceiveEnabled() 489bool MainWindow::beamReceiveEnabled()
489{ 490{
490#ifndef DESKTOP_VERSION 491#ifndef DESKTOP_VERSION
491 return ( infrared != 0 ); 492 return ( infrared != 0 );
492#endif 493#endif
493 return false; 494 return false;
494} 495}
495 496
496void MainWindow::toggleBeamReceive() 497void MainWindow::toggleBeamReceive()
497{ 498{
498 if ( mBRdisabled ) 499 if ( mBRdisabled )
499 return; 500 return;
500#ifndef DESKTOP_VERSION 501#ifndef DESKTOP_VERSION
501 if ( infrared ) { 502 if ( infrared ) {
502 qDebug("KO: Disable BeamReceive "); 503 qDebug("KO: Disable BeamReceive ");
503 delete infrared; 504 delete infrared;
504 infrared = 0; 505 infrared = 0;
505 brAction->setOn(false); 506 brAction->setOn(false);
506 return; 507 return;
507 } 508 }
508 qDebug("KO: Enable BeamReceive "); 509 qDebug("KO: Enable BeamReceive ");
509 brAction->setOn(true); 510 brAction->setOn(true);
510 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 511 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
511 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 512 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
512#endif 513#endif
513} 514}
514void MainWindow::showMaximized () 515void MainWindow::showMaximized ()
515{ 516{
516#ifndef DESKTOP_VERSION 517#ifndef DESKTOP_VERSION
517 if ( ! globalFlagBlockStartup ) 518 if ( ! globalFlagBlockStartup )
518 if ( mClosed ) 519 if ( mClosed )
519 mView->goToday(); 520 mView->goToday();
520#endif 521#endif
521 QWidget::showMaximized () ; 522 QWidget::showMaximized () ;
522 mClosed = false; 523 mClosed = false;
523} 524}
524void MainWindow::closeEvent( QCloseEvent* ce ) 525void MainWindow::closeEvent( QCloseEvent* ce )
525{ 526{
526 527
527 528
528 529
529 if ( ! KOPrefs::instance()->mAskForQuit ) { 530 if ( ! KOPrefs::instance()->mAskForQuit ) {
530 saveOnClose(); 531 saveOnClose();
531 if ( mCalendarModifiedFlag ) { 532 if ( mCalendarModifiedFlag ) {
532 ce->ignore(); 533 ce->ignore();
533 return; 534 return;
534 } 535 }
535 mClosed = true; 536 mClosed = true;
536 ce->accept(); 537 ce->accept();
537 return; 538 return;
538 539
539 } 540 }
540 541
541 switch( QMessageBox::information( this, "KO/Pi", 542 switch( QMessageBox::information( this, "KO/Pi",
542 i18n("Do you really want\nto close KO/Pi?"), 543 i18n("Do you really want\nto close KO/Pi?"),
543 i18n("Close"), i18n("No"), 544 i18n("Close"), i18n("No"),
544 0, 0 ) ) { 545 0, 0 ) ) {
545 case 0: 546 case 0:
546 saveOnClose(); 547 saveOnClose();
547 if ( mCalendarModifiedFlag ) { 548 if ( mCalendarModifiedFlag ) {
548 ce->ignore(); 549 ce->ignore();
549 return; 550 return;
550 } 551 }
551 mClosed = true; 552 mClosed = true;
552 ce->accept(); 553 ce->accept();
553 break; 554 break;
554 case 1: 555 case 1:
555 ce->ignore(); 556 ce->ignore();
556 break; 557 break;
557 case 2: 558 case 2:
558 559
559 default: 560 default:
560 break; 561 break;
561 } 562 }
562 563
563 564
564} 565}
565void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data ) 566void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
566{ 567{
567 qDebug("KO: QCOP start message received: %s ", cmsg.data() ); 568 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
568 mCStringMess = cmsg; 569 mCStringMess = cmsg;
569 mByteData = data; 570 mByteData = data;
570} 571}
571void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 572void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
572{ 573{
573 QDataStream stream( data, IO_ReadOnly ); 574 QDataStream stream( data, IO_ReadOnly );
574 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 575 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
575 //QString datamess; 576 //QString datamess;
576 //qDebug("message "); 577 //qDebug("message ");
577 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 578 qDebug("KO: QCOP message received: %s ", cmsg.data() );
578 579
579 if ( cmsg == "setDocument(QString)" ) { 580 if ( cmsg == "setDocument(QString)" ) {
580 QDataStream stream( data, IO_ReadOnly ); 581 QDataStream stream( data, IO_ReadOnly );
581 QString fileName; 582 QString fileName;
582 stream >> fileName; 583 stream >> fileName;
583 //qDebug("filename %s ", fileName.latin1()); 584 //qDebug("filename %s ", fileName.latin1());
584 showMaximized(); 585 showMaximized();
585 raise(); 586 raise();
586 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 587 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
587 mSyncManager->slotSyncMenu( 1002 ); 588 mSyncManager->slotSyncMenu( 1002 );
588 return; 589 return;
589 } 590 }
590 591
591 if ( cmsg == "-writeFile" ) { 592 if ( cmsg == "-writeFile" ) {
592 // I made from the "-writeFile" an "-writeAlarm" 593 // I made from the "-writeFile" an "-writeAlarm"
593 mView->viewManager()->showWhatsNextView(); 594 mView->viewManager()->showWhatsNextView();
594 mCalendar->checkAlarmForIncidence( 0, true); 595 mCalendar->checkAlarmForIncidence( 0, true);
595 showMaximized(); 596 showMaximized();
596 raise(); 597 raise();
597 return; 598 return;
598 599
599 } 600 }
600 if ( cmsg == "-writeFileSilent" ) { 601 if ( cmsg == "-writeFileSilent" ) {
601 // I made from the "-writeFile" an "-writeAlarm" 602 // I made from the "-writeFile" an "-writeAlarm"
602 // mView->viewManager()->showWhatsNextView(); 603 // mView->viewManager()->showWhatsNextView();
603 mCalendar->checkAlarmForIncidence( 0, true); 604 mCalendar->checkAlarmForIncidence( 0, true);
604 //showMaximized(); 605 //showMaximized();
605 //raise(); 606 //raise();
606 hide(); 607 hide();
607 return; 608 return;
608 } 609 }
609 if ( cmsg == "-newCountdown" ) { 610 if ( cmsg == "-newCountdown" ) {
610 qDebug("newCountdown "); 611 qDebug("newCountdown ");
611 612
612 } 613 }
613 QString msg ; 614 QString msg ;
614 QString allmsg = cmsg; 615 QString allmsg = cmsg;
615 while ( allmsg.length() > 0 ) { 616 while ( allmsg.length() > 0 ) {
616 int nextC = allmsg.find( "-", 1 ); 617 int nextC = allmsg.find( "-", 1 );
617 if ( nextC == -1 ) { 618 if ( nextC == -1 ) {
618 msg = allmsg; 619 msg = allmsg;
619 allmsg = ""; 620 allmsg = "";
620 } else{ 621 } else{
621 msg = allmsg.left( nextC ); 622 msg = allmsg.left( nextC );
622 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 623 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
623 } 624 }
624 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 625 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
625 if ( msg == "-newEvent" ) { 626 if ( msg == "-newEvent" ) {
626 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 627 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
627 } 628 }
628 if ( msg == "-newTodo" ) { 629 if ( msg == "-newTodo" ) {
629 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 630 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
630 } 631 }
631 if ( msg == "-showWN" ) { 632 if ( msg == "-showWN" ) {
632 mView->viewManager()->showWhatsNextView(); 633 mView->viewManager()->showWhatsNextView();
633 } 634 }
634 if ( msg == "-showTodo" ) { 635 if ( msg == "-showTodo" ) {
635 mView->viewManager()->showTodoView(); 636 mView->viewManager()->showTodoView();
636 } 637 }
637 if ( msg == "-showList" ) { 638 if ( msg == "-showList" ) {
638 mView->viewManager()->showListView(); 639 mView->viewManager()->showListView();
639 } 640 }
640 else if ( msg == "-showDay" ) { 641 else if ( msg == "-showDay" ) {
641 mView->viewManager()->showDayView(); 642 mView->viewManager()->showDayView();
642 } 643 }
643 else if ( msg == "-showWWeek" ) { 644 else if ( msg == "-showWWeek" ) {
644 mView->viewManager()->showWorkWeekView(); 645 mView->viewManager()->showWorkWeekView();
645 } 646 }
646 else if ( msg == "-ringSync" ) { 647 else if ( msg == "-ringSync" ) {
647 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 648 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
648 } 649 }
649 else if ( msg == "-showWeek" ) { 650 else if ( msg == "-showWeek" ) {
650 mView->viewManager()->showWeekView(); 651 mView->viewManager()->showWeekView();
651 } 652 }
652 else if ( msg == "-showTodo" ) { 653 else if ( msg == "-showTodo" ) {
653 mView->viewManager()->showTodoView(); 654 mView->viewManager()->showTodoView();
654 } 655 }
655 else if ( msg == "-showJournal" ) { 656 else if ( msg == "-showJournal" ) {
656 mView->dateNavigator()->selectDates( 1 ); 657 mView->dateNavigator()->selectDates( 1 );
657 mView->dateNavigator()->selectToday(); 658 mView->dateNavigator()->selectToday();
658 mView->viewManager()->showJournalView(); 659 mView->viewManager()->showJournalView();
659 } 660 }
660 else if ( msg == "-showKO" ) { 661 else if ( msg == "-showKO" ) {
661 mView->viewManager()->showNextXView(); 662 mView->viewManager()->showNextXView();
662 } 663 }
663 else if ( msg == "-showWNext" ) { 664 else if ( msg == "-showWNext" ) {
664 mView->viewManager()->showWhatsNextView(); 665 mView->viewManager()->showWhatsNextView();
665 } 666 }
666 else if ( msg == "nextView()" ) { 667 else if ( msg == "nextView()" ) {
667 mView->viewManager()->showNextView(); 668 mView->viewManager()->showNextView();
668 } 669 }
669 else if ( msg == "-showNextXView" ) { 670 else if ( msg == "-showNextXView" ) {
670 mView->viewManager()->showNextXView(); 671 mView->viewManager()->showNextXView();
671 } 672 }
672 673
673 674
674 } 675 }
675 676
676 showMaximized(); 677 showMaximized();
677 raise(); 678 raise();
678} 679}
679void MainWindow::startMultiSync() 680void MainWindow::startMultiSync()
680{ 681{
681 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 682 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
682 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 683 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
683 question, 684 question,
684 i18n("Yes"), i18n("No"), 685 i18n("Yes"), i18n("No"),
685 0, 0 ) != 0 ) { 686 0, 0 ) != 0 ) {
686 setCaption(i18n("Aborted! Nothing synced!")); 687 setCaption(i18n("Aborted! Nothing synced!"));
687 return; 688 return;
688 } 689 }
689 mSyncManager->multiSync( false ); 690 mSyncManager->multiSync( false );
690#ifndef DESKTOP_VERSION 691#ifndef DESKTOP_VERSION
691 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 692 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
692#endif 693#endif
693} 694}
694QPixmap MainWindow::loadPixmap( QString name ) 695QPixmap MainWindow::loadPixmap( QString name )
695{ 696{
696 return SmallIcon( name ); 697 return SmallIcon( name );
697 698
698} 699}
699void MainWindow::setUsesBigPixmaps ( bool b ) 700void MainWindow::setUsesBigPixmaps ( bool b )
700{ 701{
701 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 702 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
702 if ( b ) 703 if ( b )
703 qDebug("KO: BigPixmaps are not supported "); 704 qDebug("KO: BigPixmaps are not supported ");
704} 705}
705void MainWindow::initActions() 706void MainWindow::initActions()
706{ 707{
707 //KOPrefs::instance()->mShowFullMenu 708 //KOPrefs::instance()->mShowFullMenu
708 iconToolBar->clear(); 709 iconToolBar->clear();
709 KOPrefs *p = KOPrefs::instance(); 710 KOPrefs *p = KOPrefs::instance();
710 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 711 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
711 712
712 QPopupMenu *viewMenu = new QPopupMenu( this ); 713 QPopupMenu *viewMenu = new QPopupMenu( this );
713 QPopupMenu *actionMenu = new QPopupMenu( this ); 714 QPopupMenu *actionMenu = new QPopupMenu( this );
714 mCurrentItemMenu = new QPopupMenu ( this ); 715 mCurrentItemMenu = new QPopupMenu ( this );
715 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 716 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
716 QPopupMenu *importMenu = new QPopupMenu( this ); 717 QPopupMenu *importMenu = new QPopupMenu( this );
717 QPopupMenu *importMenu_X = new QPopupMenu( this ); 718 QPopupMenu *importMenu_X = new QPopupMenu( this );
718 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 719 QPopupMenu *exportMenu_X = new QPopupMenu( this );
719 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 720 QPopupMenu *beamMenu_X = new QPopupMenu( this );
720 selectFilterMenu = new QPopupMenu( this ); 721 selectFilterMenu = new QPopupMenu( this );
721 selectFilterMenu->setCheckable( true ); 722 selectFilterMenu->setCheckable( true );
722 syncMenu = new QPopupMenu( this ); 723 syncMenu = new QPopupMenu( this );
723 configureAgendaMenu = new QPopupMenu( this ); 724 configureAgendaMenu = new QPopupMenu( this );
724 configureToolBarMenu = new QPopupMenu( this ); 725 configureToolBarMenu = new QPopupMenu( this );
725 QPopupMenu *helpMenu = new QPopupMenu( this ); 726 QPopupMenu *helpMenu = new QPopupMenu( this );
726 QIconSet icon; 727 QIconSet icon;
727 int pixWid = 22, pixHei = 22; 728 int pixWid = 22, pixHei = 22;
728 QString pathString = ""; 729 QString pathString = "";
729 if ( !p->mToolBarMiniIcons ) { 730 if ( !p->mToolBarMiniIcons ) {
730 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 731 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
731 pathString += "icons16/"; 732 pathString += "icons16/";
732 pixWid = 18; pixHei = 16; 733 pixWid = 18; pixHei = 16;
733 } 734 }
734 } else { 735 } else {
735 pathString += "iconsmini/"; 736 pathString += "iconsmini/";
736 pixWid = 18; pixHei = 16; 737 pixWid = 18; pixHei = 16;
737 } 738 }
738 739
739 if ( KOPrefs::instance()->mShowFullMenu ) { 740 if ( KOPrefs::instance()->mShowFullMenu ) {
740 menuBar1 = new KMenuBar( this );//menuBar(); 741 menuBar1 = new KMenuBar( this );//menuBar();
741 //setMenuBar( menuBar1 ); 742 //setMenuBar( menuBar1 );
742 menuBar1->show(); 743 menuBar1->show();
743 menuBar1->insertItem( i18n("File"), importMenu ); 744 menuBar1->insertItem( i18n("File"), importMenu );
744 menuBar1->insertItem( i18n("View"), viewMenu ); 745 menuBar1->insertItem( i18n("View"), viewMenu );
745 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 746 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
746 menuBar1->insertItem( i18n("Action"), actionMenu ); 747 menuBar1->insertItem( i18n("Action"), actionMenu );
747#ifdef DESKTOP_VERSION 748#ifdef DESKTOP_VERSION
748 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 749 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
749 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 750 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
750#else 751#else
751 menuBar1->insertItem( i18n("Sync"), syncMenu ); 752 menuBar1->insertItem( i18n("Sync"), syncMenu );
752 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 753 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
753#endif 754#endif
754 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 755 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
755 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 756 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
756 menuBar1->insertItem( i18n("Help"), helpMenu ); 757 menuBar1->insertItem( i18n("Help"), helpMenu );
757 } else { 758 } else {
758 menuBar1 = new KMenuBar( iconToolBar ); 759 menuBar1 = new KMenuBar( iconToolBar );
759 QPopupMenu *menuBar = new QPopupMenu( this ); 760 QPopupMenu *menuBar = new QPopupMenu( this );
760 icon = loadPixmap( pathString + "z_menu" ); 761 icon = loadPixmap( pathString + "z_menu" );
761 menuBar1->insertItem( icon.pixmap(), menuBar); 762 menuBar1->insertItem( icon.pixmap(), menuBar);
762 //menuBar1->insertItem( i18n("ME"), menuBar); 763 //menuBar1->insertItem( i18n("ME"), menuBar);
763 menuBar->insertItem( i18n("File"), importMenu ); 764 menuBar->insertItem( i18n("File"), importMenu );
764 menuBar->insertItem( i18n("View"), viewMenu ); 765 menuBar->insertItem( i18n("View"), viewMenu );
765 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 766 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
766 menuBar->insertItem( i18n("Action"), actionMenu ); 767 menuBar->insertItem( i18n("Action"), actionMenu );
767 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 768 menuBar->insertItem( i18n("Synchronize"), syncMenu );
768 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 769 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
769 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 770 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
770 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 771 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
771 menuBar->insertItem( i18n("Help"), helpMenu ); 772 menuBar->insertItem( i18n("Help"), helpMenu );
772 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 773 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
773 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 774 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
774 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 775 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
775 } 776 }
776 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 777 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
777 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 778 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
778 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 779 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
779 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 780 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
780 781
781 782
782 mWeekBgColor = iconToolBar->backgroundColor(); 783 mWeekBgColor = iconToolBar->backgroundColor();
783 mWeekPixmap.resize( pixWid , pixHei ); 784 mWeekPixmap.resize( pixWid , pixHei );
784 mWeekPixmap.fill( mWeekBgColor ); 785 mWeekPixmap.fill( mWeekBgColor );
785 icon = mWeekPixmap; 786 icon = mWeekPixmap;
786 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 787 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
787 if ( p-> mShowIconWeekNum ) 788 if ( p-> mShowIconWeekNum )
788 mWeekAction->addTo( iconToolBar ); 789 mWeekAction->addTo( iconToolBar );
789 mWeekFont = font(); 790 mWeekFont = font();
790 791
791 int fontPoint = mWeekFont.pointSize(); 792 int fontPoint = mWeekFont.pointSize();
792 QFontMetrics f( mWeekFont ); 793 QFontMetrics f( mWeekFont );
793 int fontWid = f.width( "30" ); 794 int fontWid = f.width( "30" );
794 while ( fontWid > pixWid ) { 795 while ( fontWid > pixWid ) {
795 --fontPoint; 796 --fontPoint;
796 mWeekFont.setPointSize( fontPoint ); 797 mWeekFont.setPointSize( fontPoint );
797 QFontMetrics f( mWeekFont ); 798 QFontMetrics f( mWeekFont );
798 fontWid = f.width( "30" ); 799 fontWid = f.width( "30" );
799 //qDebug("dec-- "); 800 //qDebug("dec-- ");
800 } 801 }
801 802
802 connect( mWeekAction, SIGNAL( activated() ), 803 connect( mWeekAction, SIGNAL( activated() ),
803 this, SLOT( weekAction() ) ); 804 this, SLOT( weekAction() ) );
804 805
805 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 806 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
806 if ( p->mShowIconFilterview ) { 807 if ( p->mShowIconFilterview ) {
807 icon = loadPixmap( pathString + "filter" ); 808 icon = loadPixmap( pathString + "filter" );
808 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 809 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
809 connect( actionFilterMenuTB, SIGNAL( activated() ), 810 connect( actionFilterMenuTB, SIGNAL( activated() ),
810 this, SLOT( fillFilterMenuTB() ) ); 811 this, SLOT( fillFilterMenuTB() ) );
811 actionFilterMenuTB->addTo( iconToolBar ); 812 actionFilterMenuTB->addTo( iconToolBar );
812 selectFilterMenuTB = new QPopupMenu( this ); 813 selectFilterMenuTB = new QPopupMenu( this );
813 selectFilterMenuTB->setCheckable( true ); 814 selectFilterMenuTB->setCheckable( true );
814 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 815 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
815 } 816 }
816 817
817 //#endif 818 //#endif
818 // ****************** 819 // ******************
819 QAction *action; 820 QAction *action;
820 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 821 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
821 configureToolBarMenu->setCheckable( true ); 822 configureToolBarMenu->setCheckable( true );
822 823
823 824
824 configureAgendaMenu->setCheckable( true ); 825 configureAgendaMenu->setCheckable( true );
825 int iii ; 826 int iii ;
826 for ( iii = 1;iii<= 10 ;++iii ){ 827 for ( iii = 1;iii<= 10 ;++iii ){
827 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 828 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
828 } 829 }
829 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 830 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
830 831
831 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 832 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
832 this, SLOT( showConfigureAgenda( ) ) ); 833 this, SLOT( showConfigureAgenda( ) ) );
833 icon = loadPixmap( pathString + "today" ); 834 icon = loadPixmap( pathString + "today" );
834 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 835 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
835 today_action->addTo( actionMenu ); 836 today_action->addTo( actionMenu );
836 connect( today_action, SIGNAL( activated() ), 837 connect( today_action, SIGNAL( activated() ),
837 mView, SLOT( goToday() ) ); 838 mView, SLOT( goToday() ) );
838 839
839 icon = loadPixmap( pathString + "picker" ); 840 icon = loadPixmap( pathString + "picker" );
840 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 841 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
841 dPickerAction->addTo( actionMenu ); 842 dPickerAction->addTo( actionMenu );
842 connect( dPickerAction, SIGNAL( activated() ), 843 connect( dPickerAction, SIGNAL( activated() ),
843 mView, SLOT( showDatePicker() ) ); 844 mView, SLOT( showDatePicker() ) );
844 845
845 icon = loadPixmap( pathString + "search" ); 846 icon = loadPixmap( pathString + "search" );
846 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 847 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
847 search_action->addTo( actionMenu ); 848 search_action->addTo( actionMenu );
848 connect( search_action, SIGNAL( activated() ), 849 connect( search_action, SIGNAL( activated() ),
849 mView->dialogManager(), SLOT( showSearchDialog() ) ); 850 mView->dialogManager(), SLOT( showSearchDialog() ) );
850 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 851 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
851 852
852 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 853 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
853 action->addTo( nextConflictMenu ); 854 action->addTo( nextConflictMenu );
854 connect( action, SIGNAL( activated() ), 855 connect( action, SIGNAL( activated() ),
855 mView, SLOT( conflictAll() ) ); 856 mView, SLOT( conflictAll() ) );
856 857
857 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 858 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
858 action->addTo( nextConflictMenu ); 859 action->addTo( nextConflictMenu );
859 connect( action, SIGNAL( activated() ), 860 connect( action, SIGNAL( activated() ),
860 mView, SLOT( conflictAllday() ) ); 861 mView, SLOT( conflictAllday() ) );
861 862
862 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 863 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
863 action->addTo( nextConflictMenu ); 864 action->addTo( nextConflictMenu );
864 connect( action, SIGNAL( activated() ), 865 connect( action, SIGNAL( activated() ),
865 mView, SLOT( conflictNotAll() ) ); 866 mView, SLOT( conflictNotAll() ) );
866 867
867 actionMenu->insertSeparator(); 868 actionMenu->insertSeparator();
868 869
869 icon = loadPixmap( pathString + "newevent" ); 870 icon = loadPixmap( pathString + "newevent" );
870 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 871 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
871 ne_action->addTo( mCurrentItemMenu ); 872 ne_action->addTo( mCurrentItemMenu );
872 connect( ne_action, SIGNAL( activated() ), 873 connect( ne_action, SIGNAL( activated() ),
873 mView, SLOT( newEvent() ) ); 874 mView, SLOT( newEvent() ) );
874 icon = loadPixmap( pathString + "newtodo" ); 875 icon = loadPixmap( pathString + "newtodo" );
875 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 876 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
876 nt_action->addTo( mCurrentItemMenu ); 877 nt_action->addTo( mCurrentItemMenu );
877 connect( nt_action, SIGNAL( activated() ), 878 connect( nt_action, SIGNAL( activated() ),
878 mView, SLOT( newTodo() ) ); 879 mView, SLOT( newTodo() ) );
879 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 880 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
880 this ); 881 this );
881 mNewSubTodoAction->addTo( mCurrentItemMenu ); 882 mNewSubTodoAction->addTo( mCurrentItemMenu );
882 connect( mNewSubTodoAction, SIGNAL( activated() ), 883 connect( mNewSubTodoAction, SIGNAL( activated() ),
883 mView, SLOT( newSubTodo() ) ); 884 mView, SLOT( newSubTodo() ) );
884 885
885 mCurrentItemMenu->insertSeparator(); 886 mCurrentItemMenu->insertSeparator();
886 icon = loadPixmap( pathString + "newevent" ); 887 icon = loadPixmap( pathString + "newevent" );
887 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 888 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
888 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 889 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
889 configureToolBarMenu->insertSeparator(); 890 configureToolBarMenu->insertSeparator();
890 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 891 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
891 configureToolBarMenu->insertSeparator(); 892 configureToolBarMenu->insertSeparator();
892 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 893 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
893 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 894 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
894 icon = loadPixmap( pathString + "newtodo" ); 895 icon = loadPixmap( pathString + "newtodo" );
895 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 896 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
896 897
897 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 898 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
898 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 899 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
899 mShowAction->addTo( mCurrentItemMenu ); 900 mShowAction->addTo( mCurrentItemMenu );
900 connect( mShowAction, SIGNAL( activated() ), 901 connect( mShowAction, SIGNAL( activated() ),
901 mView, SLOT( showIncidence() ) ); 902 mView, SLOT( showIncidence() ) );
902 903
903 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 904 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
904 mEditAction->addTo( mCurrentItemMenu ); 905 mEditAction->addTo( mCurrentItemMenu );
905 connect( mEditAction, SIGNAL( activated() ), 906 connect( mEditAction, SIGNAL( activated() ),
906 mView, SLOT( editIncidence() ) ); 907 mView, SLOT( editIncidence() ) );
907 908
908 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 909 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
909 mDeleteAction->addTo( mCurrentItemMenu ); 910 mDeleteAction->addTo( mCurrentItemMenu );
910 connect( mDeleteAction, SIGNAL( activated() ), 911 connect( mDeleteAction, SIGNAL( activated() ),
911 mView, SLOT( deleteIncidence() ) ); 912 mView, SLOT( deleteIncidence() ) );
912 913
913 914
914 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 915 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
915 mCloneAction->addTo( mCurrentItemMenu ); 916 mCloneAction->addTo( mCurrentItemMenu );
916 connect( mCloneAction, SIGNAL( activated() ), 917 connect( mCloneAction, SIGNAL( activated() ),
917 mView, SLOT( cloneIncidence() ) ); 918 mView, SLOT( cloneIncidence() ) );
918 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 919 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
919 mMoveAction->addTo( mCurrentItemMenu ); 920 mMoveAction->addTo( mCurrentItemMenu );
920 connect( mMoveAction, SIGNAL( activated() ), 921 connect( mMoveAction, SIGNAL( activated() ),
921 mView, SLOT( moveIncidence() ) ); 922 mView, SLOT( moveIncidence() ) );
922#ifndef DESKTOP_VERSION 923#ifndef DESKTOP_VERSION
923 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
924 mBeamAction->addTo(mCurrentItemMenu ); 925 mBeamAction->addTo(mCurrentItemMenu );
925 connect( mBeamAction, SIGNAL( activated() ), 926 connect( mBeamAction, SIGNAL( activated() ),
926 mView, SLOT( beamIncidence() ) ); 927 mView, SLOT( beamIncidence() ) );
927#endif 928#endif
928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 929 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
929 mCancelAction->addTo( mCurrentItemMenu ); 930 mCancelAction->addTo( mCurrentItemMenu );
930 connect( mCancelAction, SIGNAL( activated() ), 931 connect( mCancelAction, SIGNAL( activated() ),
931 mView, SLOT( toggleCancelIncidence() ) ); 932 mView, SLOT( toggleCancelIncidence() ) );
932 933
933 934
934 mCurrentItemMenu->insertSeparator(); 935 mCurrentItemMenu->insertSeparator();
935 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 936 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
936 action->addTo( mCurrentItemMenu ); 937 action->addTo( mCurrentItemMenu );
937 connect( action, SIGNAL( activated() ), 938 connect( action, SIGNAL( activated() ),
938 mView, SLOT( undo_delete() ) ); 939 mView, SLOT( undo_delete() ) );
939 940
940 // *********************** 941 // ***********************
941 if ( KOPrefs::instance()->mVerticalScreen ) { 942 if ( KOPrefs::instance()->mVerticalScreen ) {
942 icon = SmallIcon( "1updownarrow" ); 943 icon = SmallIcon( "1updownarrow" );
943 } else { 944 } else {
944 icon = SmallIcon("1leftrightarrow" ); 945 icon = SmallIcon("1leftrightarrow" );
945 } 946 }
946 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 947 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
947 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 948 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
948 FSaction->addTo( viewMenu ); 949 FSaction->addTo( viewMenu );
949 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 950 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
950 951
951 952
952 icon = loadPixmap( pathString + "filter" ); 953 icon = loadPixmap( pathString + "filter" );
953 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 954 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
954 icon = loadPixmap( pathString + "configure" ); 955 icon = loadPixmap( pathString + "configure" );
955 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 956 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
956 action->addTo( viewMenu ); 957 action->addTo( viewMenu );
957 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
958 mView, SLOT( toggleFilter() ) ); 959 mView, SLOT( toggleFilter() ) );
959 mToggleFilter = action; 960 mToggleFilter = action;
960 icon = loadPixmap( pathString + "navi" ); 961 icon = loadPixmap( pathString + "navi" );
961 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 962 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
962 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 963 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
963 action->addTo( viewMenu ); 964 action->addTo( viewMenu );
964 connect( action, SIGNAL( activated() ), 965 connect( action, SIGNAL( activated() ),
965 mView, SLOT( toggleDateNavigatorWidget() ) ); 966 mView, SLOT( toggleDateNavigatorWidget() ) );
966 mToggleNav = action ; 967 mToggleNav = action ;
967 icon = loadPixmap( pathString + "allday" ); 968 icon = loadPixmap( pathString + "allday" );
968 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 969 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
969 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 970 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
970 action->addTo( viewMenu ); 971 action->addTo( viewMenu );
971 connect( action, SIGNAL( activated() ), 972 connect( action, SIGNAL( activated() ),
972 mView, SLOT( toggleAllDaySize() ) ); 973 mView, SLOT( toggleAllDaySize() ) );
973 mToggleAllday = action; 974 mToggleAllday = action;
974 975
975 976
976 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 977 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
977 mToggleNav, SLOT( setEnabled ( bool ) ) ); 978 mToggleNav, SLOT( setEnabled ( bool ) ) );
978 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 979 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
979 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 980 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
980 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 981 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
981 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 982 mToggleAllday, SLOT( setEnabled ( bool ) ) );
982 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 983 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
983 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 984 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
984 985
985 986
986 dPickerAction->addTo( iconToolBar ); 987 dPickerAction->addTo( iconToolBar );
987 viewMenu->insertSeparator(); 988 viewMenu->insertSeparator();
988 989
989 if ( p-> mShowIconToggleFull ) 990 if ( p-> mShowIconToggleFull )
990 FSaction->addTo( iconToolBar ); 991 FSaction->addTo( iconToolBar );
991 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 992 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
992 993
993 //******************** 994 //********************
994 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 995 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
995 996
996 997
997 icon = loadPixmap( pathString + "whatsnext" ); 998 icon = loadPixmap( pathString + "whatsnext" );
998 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 999 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
999 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 1000 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
1000 whatsnext_action->addTo( viewMenu ); 1001 whatsnext_action->addTo( viewMenu );
1001 connect( whatsnext_action, SIGNAL( activated() ), 1002 connect( whatsnext_action, SIGNAL( activated() ),
1002 mView->viewManager(), SLOT( showWhatsNextView() ) ); 1003 mView->viewManager(), SLOT( showWhatsNextView() ) );
1003 1004
1004 icon = loadPixmap( pathString + "xdays" ); 1005 icon = loadPixmap( pathString + "xdays" );
1005 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 1006 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
1006 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 1007 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
1007 xdays_action->addTo( viewMenu ); 1008 xdays_action->addTo( viewMenu );
1008 connect( xdays_action, SIGNAL( activated() ), 1009 connect( xdays_action, SIGNAL( activated() ),
1009 mView->viewManager(), SLOT( showNextXView() ) ); 1010 mView->viewManager(), SLOT( showNextXView() ) );
1010 1011
1011 1012
1012 icon = loadPixmap( pathString + "journal" ); 1013 icon = loadPixmap( pathString + "journal" );
1013 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 1014 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
1014 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 1015 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
1015 viewjournal_action->addTo( viewMenu ); 1016 viewjournal_action->addTo( viewMenu );
1016 connect( viewjournal_action, SIGNAL( activated() ), 1017 connect( viewjournal_action, SIGNAL( activated() ),
1017 mView->viewManager(), SLOT( showJournalView() ) ); 1018 mView->viewManager(), SLOT( showJournalView() ) );
1018 1019
1019 1020
1020 icon = loadPixmap( pathString + "day" ); 1021 icon = loadPixmap( pathString + "day" );
1021 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 1022 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
1022 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 1023 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
1023 day1_action->addTo( viewMenu ); 1024 day1_action->addTo( viewMenu );
1024 // action->addTo( toolBar ); 1025 // action->addTo( toolBar );
1025 connect( day1_action, SIGNAL( activated() ), 1026 connect( day1_action, SIGNAL( activated() ),
1026 mView->viewManager(), SLOT( showDayView() ) ); 1027 mView->viewManager(), SLOT( showDayView() ) );
1027 1028
1028 icon = loadPixmap( pathString + "workweek" ); 1029 icon = loadPixmap( pathString + "workweek" );
1029 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 1030 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
1030 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 1031 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
1031 day5_action->addTo( viewMenu ); 1032 day5_action->addTo( viewMenu );
1032 connect( day5_action, SIGNAL( activated() ), 1033 connect( day5_action, SIGNAL( activated() ),
1033 mView->viewManager(), SLOT( showWorkWeekView() ) ); 1034 mView->viewManager(), SLOT( showWorkWeekView() ) );
1034 1035
1035 icon = loadPixmap( pathString + "week" ); 1036 icon = loadPixmap( pathString + "week" );
1036 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1037 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1037 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1038 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
1038 day7_action->addTo( viewMenu ); 1039 day7_action->addTo( viewMenu );
1039 connect( day7_action, SIGNAL( activated() ), 1040 connect( day7_action, SIGNAL( activated() ),
1040 mView->viewManager(), SLOT( showWeekView() ) ); 1041 mView->viewManager(), SLOT( showWeekView() ) );
1041 1042
1042 icon = loadPixmap( pathString + "workweek2" ); 1043 icon = loadPixmap( pathString + "workweek2" );
1043 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1044 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1044 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1045 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
1045 day6_action->addTo( viewMenu ); 1046 day6_action->addTo( viewMenu );
1046 connect( day6_action, SIGNAL( activated() ), 1047 connect( day6_action, SIGNAL( activated() ),
1047 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1048 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1048 1049
1049 icon = loadPixmap( pathString + "month" ); 1050 icon = loadPixmap( pathString + "month" );
1050 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1051 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1051 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1052 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
1052 month_action->addTo( viewMenu ); 1053 month_action->addTo( viewMenu );
1053 connect( month_action, SIGNAL( activated() ), 1054 connect( month_action, SIGNAL( activated() ),
1054 mView->viewManager(), SLOT( showMonthView() ) ); 1055 mView->viewManager(), SLOT( showMonthView() ) );
1055 1056
1056 icon = loadPixmap( pathString + "list" ); 1057 icon = loadPixmap( pathString + "list" );
1057 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1058 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1058 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1059 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1059 showlist_action->addTo( viewMenu ); 1060 showlist_action->addTo( viewMenu );
1060 connect( showlist_action, SIGNAL( activated() ), 1061 connect( showlist_action, SIGNAL( activated() ),
1061 mView->viewManager(), SLOT( showListView() ) ); 1062 mView->viewManager(), SLOT( showListView() ) );
1062 1063
1063 icon = loadPixmap( pathString + "todo" ); 1064 icon = loadPixmap( pathString + "todo" );
1064 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1065 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1065 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1066 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1066 todoview_action->addTo( viewMenu ); 1067 todoview_action->addTo( viewMenu );
1067 connect( todoview_action, SIGNAL( activated() ), 1068 connect( todoview_action, SIGNAL( activated() ),
1068 mView->viewManager(), SLOT( showTodoView() ) ); 1069 mView->viewManager(), SLOT( showTodoView() ) );
1069 1070
1070 1071
1071 1072
1072#if 0 1073#if 0
1073 action = new QAction( "view_timespan", "Time Span", 0, this ); 1074 action = new QAction( "view_timespan", "Time Span", 0, this );
1074 action->addTo( viewMenu ); 1075 action->addTo( viewMenu );
1075 connect( action, SIGNAL( activated() ), 1076 connect( action, SIGNAL( activated() ),
1076 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1077 mView->viewManager(), SLOT( showTimeSpanView() ) );
1077#endif 1078#endif
1078 1079
1079 1080
1080 1081
1081 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1082 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1082 this ); 1083 this );
1083 action->addTo( actionMenu ); 1084 action->addTo( actionMenu );
1084 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1085 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1085 1086
1086 1087
1087 icon = loadPixmap( pathString + "search" ); 1088 icon = loadPixmap( pathString + "search" );
1088 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1089 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1089 1090
1090 1091
1091 1092
1092 actionMenu->insertSeparator(); 1093 actionMenu->insertSeparator();
1093 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1094 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1094 this ); 1095 this );
1095 action->addTo( actionMenu ); 1096 action->addTo( actionMenu );
1096 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1097 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1097 1098
1098 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1099 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1099 this ); 1100 this );
1100 action->addTo( actionMenu ); 1101 action->addTo( actionMenu );
1101 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1102 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1102 1103
1103 1104
1104 actionMenu->insertSeparator(); 1105 actionMenu->insertSeparator();
1105 icon = loadPixmap( pathString + "configure" ); 1106 icon = loadPixmap( pathString + "configure" );
1106 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1107 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1107 action->addTo( actionMenu ); 1108 action->addTo( actionMenu );
1108 connect( action, SIGNAL( activated() ), 1109 connect( action, SIGNAL( activated() ),
1109 mView, SLOT( edit_options() ) ); 1110 mView, SLOT( edit_options() ) );
1110 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1111 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1111 action->addTo( actionMenu ); 1112 action->addTo( actionMenu );
1112 connect( action, SIGNAL( activated() ), 1113 connect( action, SIGNAL( activated() ),
1113 this, SLOT( calHint() ) ); 1114 this, SLOT( calHint() ) );
1114 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1115 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1115 action->addTo( actionMenu ); 1116 action->addTo( actionMenu );
1116 connect( action, SIGNAL( activated() ), 1117 connect( action, SIGNAL( activated() ),
1117 mView, SLOT( edit_global_options() ) ); 1118 mView, SLOT( edit_global_options() ) );
1118 if ( KOPrefs::instance()->mShowFullMenu ) { 1119 if ( KOPrefs::instance()->mShowFullMenu ) {
1119 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1120 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1120 1121
1121 } 1122 }
1122 // actionMenu->insertSeparator(); 1123 // actionMenu->insertSeparator();
1123 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1124 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1124 this ); 1125 this );
1125 action->addTo( importMenu_X ); 1126 action->addTo( importMenu_X );
1126 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1127 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1127 action = new QAction( "import_quick", i18n("Import last file"), 0, 1128 action = new QAction( "import_quick", i18n("Import last file"), 0,
1128 this ); 1129 this );
1129 action->addTo( importMenu_X ); 1130 action->addTo( importMenu_X );
1130 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1131 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1131 importMenu_X->insertSeparator(); 1132 importMenu_X->insertSeparator();
1132 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1133 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1133 this ); 1134 this );
1134 action->addTo( importMenu_X ); 1135 action->addTo( importMenu_X );
1135 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1136 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1136 //#ifndef DESKTOP_VERSION 1137 //#ifndef DESKTOP_VERSION
1137 importMenu_X->insertSeparator(); 1138 importMenu_X->insertSeparator();
1138 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1139 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1139 this ); 1140 this );
1140 action->addTo( importMenu_X ); 1141 action->addTo( importMenu_X );
1141 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1142 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1142 //#else 1143 //#else
1143#ifdef _OL_IMPORT_ 1144#ifdef _OL_IMPORT_
1144 importMenu_X->insertSeparator(); 1145 importMenu_X->insertSeparator();
1145 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1146 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1146 this ); 1147 this );
1147 action->addTo( importMenu_X ); 1148 action->addTo( importMenu_X );
1148 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1149 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1149#endif 1150#endif
1150 //#endif 1151 //#endif
1151 1152
1152 //importMenu->insertSeparator(); 1153 //importMenu->insertSeparator();
1153#if 0 1154#if 0
1154 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1155 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1155 this ); 1156 this );
1156 action->addTo( importMenu ); 1157 action->addTo( importMenu );
1157 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1158 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1158#endif 1159#endif
1159 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1160 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1160 this ); 1161 this );
1161 action->addTo( importMenu ); 1162 action->addTo( importMenu );
1162 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1163 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1163 importMenu->insertSeparator(); 1164 importMenu->insertSeparator();
1164 importMenu->insertItem( i18n("Import"), importMenu_X ); 1165 importMenu->insertItem( i18n("Import"), importMenu_X );
1165 //importMenu->insertSeparator(); 1166 //importMenu->insertSeparator();
1166 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1167 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1167 this ); 1168 this );
1168 action->addTo( exportMenu_X ); 1169 action->addTo( exportMenu_X );
1169 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1170 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1170 1171
1171 1172
1172 //LR 1173 //LR
1173 QPopupMenu *ex2phone = new QPopupMenu( this ); 1174 QPopupMenu *ex2phone = new QPopupMenu( this );
1174 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1175 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1175 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1176 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1176 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1177 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1177 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1178 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1178 1179
1179 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1180 importMenu->insertItem( i18n("Export"), exportMenu_X );
1180 mPrintSelAction = 0; 1181 mPrintSelAction = 0;
1181#ifndef DESKTOP_VERSION 1182#ifndef DESKTOP_VERSION
1182 //importMenu->insertSeparator(); 1183 //importMenu->insertSeparator();
1183 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1184 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1184 this ); 1185 this );
1185 brAction->addTo( beamMenu_X ); 1186 brAction->addTo( beamMenu_X );
1186 brAction->setToggleAction (true ) ; 1187 brAction->setToggleAction (true ) ;
1187 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1188 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1188 1189
1189 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1190 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1190 this ); 1191 this );
1191 action->addTo( beamMenu_X ); 1192 action->addTo( beamMenu_X );
1192 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1193 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1193 1194
1194 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1195 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1195 this ); 1196 this );
1196 action->addTo( beamMenu_X ); 1197 action->addTo( beamMenu_X );
1197 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1198 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1198 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1199 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1199#else 1200#else
1200 //importMenu->insertSeparator(); 1201 //importMenu->insertSeparator();
1201 icon = loadPixmap( pathString + "print" ); 1202 icon = loadPixmap( pathString + "print" );
1202 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1203 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1203 action->addTo( beamMenu_X ); 1204 action->addTo( beamMenu_X );
1204 connect( action, SIGNAL( activated() ), 1205 connect( action, SIGNAL( activated() ),
1205 this, SLOT( printCal() ) ); 1206 this, SLOT( printCal() ) );
1206 1207
1207 icon = loadPixmap( pathString + "week" ); 1208 icon = loadPixmap( pathString + "week" );
1208 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1209 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1209 action->addTo( beamMenu_X ); 1210 action->addTo( beamMenu_X );
1210 connect( action, SIGNAL( activated() ), 1211 connect( action, SIGNAL( activated() ),
1211 this, SLOT( printSel() ) ); 1212 this, SLOT( printSel() ) );
1212 icon = loadPixmap( pathString + "whatsnext" ); 1213 icon = loadPixmap( pathString + "whatsnext" );
1213 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1214 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1214 action->addTo( beamMenu_X ); 1215 action->addTo( beamMenu_X );
1215 connect( action, SIGNAL( activated() ), 1216 connect( action, SIGNAL( activated() ),
1216 mView->viewManager(), SLOT( slotprintWNV() ) ); 1217 mView->viewManager(), SLOT( slotprintWNV() ) );
1217 1218
1218 1219
1219 icon = loadPixmap( pathString + "list" ); 1220 icon = loadPixmap( pathString + "list" );
1220 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1221 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1221 action->addTo( beamMenu_X ); 1222 action->addTo( beamMenu_X );
1222 connect( action, SIGNAL( activated() ), 1223 connect( action, SIGNAL( activated() ),
1223 this, SLOT( printListView() ) ); 1224 this, SLOT( printListView() ) );
1224 1225
1225 icon = loadPixmap( pathString + "newevent" ); 1226 icon = loadPixmap( pathString + "newevent" );
1226 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1227 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1227 action->addTo( beamMenu_X ); 1228 action->addTo( beamMenu_X );
1228 connect( action, SIGNAL( activated() ), 1229 connect( action, SIGNAL( activated() ),
1229 mView, SLOT( slotprintSelInc() ) ); 1230 mView, SLOT( slotprintSelInc() ) );
1230 mPrintSelAction = action; 1231 mPrintSelAction = action;
1231 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1232 importMenu->insertItem( i18n("Print"), beamMenu_X );
1232#endif 1233#endif
1233 1234
1234 importMenu->insertSeparator(); 1235 importMenu->insertSeparator();
1235 action = new QAction( "beam all", i18n("Save"), 0, 1236 action = new QAction( "beam all", i18n("Save"), 0,
1236 this ); 1237 this );
1237 action->addTo( importMenu ); 1238 action->addTo( importMenu );
1238 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1239 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1239 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1240 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1240 this ); 1241 this );
1241 action->addTo( importMenu ); 1242 action->addTo( importMenu );
1242 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1243 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1243 1244
1244 //menuBar->insertItem( "Configure",configureMenu ); 1245 //menuBar->insertItem( "Configure",configureMenu );
1245 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1246 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1246 icon = loadPixmap( "korganizer/korganizer" ); 1247 icon = loadPixmap( "korganizer/korganizer" );
1247 1248
1248 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1249 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1249 action->addTo( helpMenu ); 1250 action->addTo( helpMenu );
1250 connect( action, SIGNAL( activated() ), 1251 connect( action, SIGNAL( activated() ),
1251 SLOT( whatsNew() ) ); 1252 SLOT( whatsNew() ) );
1252 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1253 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1253 action->addTo( helpMenu ); 1254 action->addTo( helpMenu );
1254 connect( action, SIGNAL( activated() ), 1255 connect( action, SIGNAL( activated() ),
1255 SLOT( features() ) ); 1256 SLOT( features() ) );
1256 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1257 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1257 action->addTo( helpMenu ); 1258 action->addTo( helpMenu );
1258 connect( action, SIGNAL( activated() ), 1259 connect( action, SIGNAL( activated() ),
1259 SLOT( keyBindings() ) ); 1260 SLOT( keyBindings() ) );
1260 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1261 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1261 action->addTo( helpMenu ); 1262 action->addTo( helpMenu );
1262 connect( action, SIGNAL( activated() ), 1263 connect( action, SIGNAL( activated() ),
1263 SLOT( storagehowto() ) ); 1264 SLOT( storagehowto() ) );
1264 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1265 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1265 action->addTo( helpMenu ); 1266 action->addTo( helpMenu );
1266 connect( action, SIGNAL( activated() ), 1267 connect( action, SIGNAL( activated() ),
1267 SLOT( timetrackinghowto() ) ); 1268 SLOT( timetrackinghowto() ) );
1268 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1269 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1269 action->addTo( helpMenu ); 1270 action->addTo( helpMenu );
1270 connect( action, SIGNAL( activated() ), 1271 connect( action, SIGNAL( activated() ),
1271 SLOT( synchowto() ) ); 1272 SLOT( synchowto() ) );
1272 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1273 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1273 action->addTo( helpMenu ); 1274 action->addTo( helpMenu );
1274 connect( action, SIGNAL( activated() ), 1275 connect( action, SIGNAL( activated() ),
1275 SLOT( kdesynchowto() ) ); 1276 SLOT( kdesynchowto() ) );
1276 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1277 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1277 action->addTo( helpMenu ); 1278 action->addTo( helpMenu );
1278 connect( action, SIGNAL( activated() ), 1279 connect( action, SIGNAL( activated() ),
1279 SLOT( multisynchowto() ) ); 1280 SLOT( multisynchowto() ) );
1280 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1281 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1281 action->addTo( helpMenu ); 1282 action->addTo( helpMenu );
1282 connect( action, SIGNAL( activated() ), 1283 connect( action, SIGNAL( activated() ),
1283 SLOT( aboutAutoSaving() ) ); 1284 SLOT( aboutAutoSaving() ) );
1284 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1285 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1285 action->addTo( helpMenu ); 1286 action->addTo( helpMenu );
1286 connect( action, SIGNAL( activated() ), 1287 connect( action, SIGNAL( activated() ),
1287 SLOT( aboutKnownBugs() ) ); 1288 SLOT( aboutKnownBugs() ) );
1288 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1289 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1289 action->addTo( helpMenu ); 1290 action->addTo( helpMenu );
1290 connect( action, SIGNAL( activated() ), 1291 connect( action, SIGNAL( activated() ),
1291 SLOT( usertrans() ) ); 1292 SLOT( usertrans() ) );
1292 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1293 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1293 action->addTo( helpMenu ); 1294 action->addTo( helpMenu );
1294 connect( action, SIGNAL( activated() ), 1295 connect( action, SIGNAL( activated() ),
1295 SLOT( faq() ) ); 1296 SLOT( faq() ) );
1296 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1297 action = new QAction( "licence", i18n("Licence..."), 0, this );
1297 action->addTo( helpMenu ); 1298 action->addTo( helpMenu );
1298 connect( action, SIGNAL( activated() ), 1299 connect( action, SIGNAL( activated() ),
1299 SLOT( licence() ) ); 1300 SLOT( licence() ) );
1300 action = new QAction( "about", i18n("About..."), 0, this ); 1301 action = new QAction( "about", i18n("About..."), 0, this );
1301 action->addTo( helpMenu ); 1302 action->addTo( helpMenu );
1302 connect( action, SIGNAL( activated() ), 1303 connect( action, SIGNAL( activated() ),
1303 SLOT( about() ) ); 1304 SLOT( about() ) );
1304 //menuBar->insertSeparator(); 1305 //menuBar->insertSeparator();
1305 1306
1306 // ****************************************************** 1307 // ******************************************************
1307 // menubar icons 1308 // menubar icons
1308 1309
1309 1310
1310 1311
1311 //menuBar->insertItem( iconToolBar ); 1312 //menuBar->insertItem( iconToolBar );
1312 //xdays_action 1313 //xdays_action
1313 if (p-> mShowIconNewEvent) 1314 if (p-> mShowIconNewEvent)
1314 ne_action->addTo( iconToolBar ); 1315 ne_action->addTo( iconToolBar );
1315 if (p->mShowIconNewTodo ) 1316 if (p->mShowIconNewTodo )
1316 nt_action->addTo( iconToolBar ); 1317 nt_action->addTo( iconToolBar );
1317 if (p-> mShowIconSearch) 1318 if (p-> mShowIconSearch)
1318 search_action->addTo( iconToolBar ); 1319 search_action->addTo( iconToolBar );
1319 if (p-> mShowIconWhatsThis) 1320 if (p-> mShowIconWhatsThis)
1320 QWhatsThis::whatsThisButton ( iconToolBar ); 1321 QWhatsThis::whatsThisButton ( iconToolBar );
1321 if (p-> mShowIconNext) 1322 if (p-> mShowIconNext)
1322 whatsnext_action->addTo( viewToolBar ); 1323 whatsnext_action->addTo( viewToolBar );
1323 if (p-> mShowIconNextDays) 1324 if (p-> mShowIconNextDays)
1324 xdays_action->addTo( viewToolBar ); 1325 xdays_action->addTo( viewToolBar );
1325 if (p-> mShowIconJournal) 1326 if (p-> mShowIconJournal)
1326 viewjournal_action->addTo( viewToolBar ); 1327 viewjournal_action->addTo( viewToolBar );
1327 if (p-> mShowIconDay1) 1328 if (p-> mShowIconDay1)
1328 day1_action->addTo( viewToolBar ); 1329 day1_action->addTo( viewToolBar );
1329 if (p-> mShowIconDay5) 1330 if (p-> mShowIconDay5)
1330 day5_action->addTo( viewToolBar ); 1331 day5_action->addTo( viewToolBar );
1331 if (p-> mShowIconDay7) 1332 if (p-> mShowIconDay7)
1332 day7_action->addTo( viewToolBar ); 1333 day7_action->addTo( viewToolBar );
1333 if (p-> mShowIconDay6) 1334 if (p-> mShowIconDay6)
1334 day6_action->addTo( viewToolBar ); 1335 day6_action->addTo( viewToolBar );
1335 if (p-> mShowIconMonth) 1336 if (p-> mShowIconMonth)
1336 month_action->addTo( viewToolBar ); 1337 month_action->addTo( viewToolBar );
1337 if (p-> mShowIconList) 1338 if (p-> mShowIconList)
1338 showlist_action->addTo( viewToolBar ); 1339 showlist_action->addTo( viewToolBar );
1339 if (p-> mShowIconTodoview) 1340 if (p-> mShowIconTodoview)
1340 todoview_action->addTo( viewToolBar ); 1341 todoview_action->addTo( viewToolBar );
1341 1342
1342 icon = loadPixmap( pathString + "2leftarrowB" ); 1343 icon = loadPixmap( pathString + "2leftarrowB" );
1343 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1344 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1344 if (p-> mShowIconBackFast) { 1345 if (p-> mShowIconBackFast) {
1345 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1346 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1346 connect( action, SIGNAL( activated() ), 1347 connect( action, SIGNAL( activated() ),
1347 mView, SLOT( goPreviousMonth() ) ); 1348 mView, SLOT( goPreviousMonth() ) );
1348 action->addTo( navigatorToolBar ); 1349 action->addTo( navigatorToolBar );
1349 } 1350 }
1350 icon = loadPixmap( pathString + "1leftarrowB" ); 1351 icon = loadPixmap( pathString + "1leftarrowB" );
1351 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1352 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1352 if (p-> mShowIconBack) { 1353 if (p-> mShowIconBack) {
1353 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1354 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1354 connect( action, SIGNAL( activated() ), 1355 connect( action, SIGNAL( activated() ),
1355 mView, SLOT( goPrevious() ) ); 1356 mView, SLOT( goPrevious() ) );
1356 action->addTo( navigatorToolBar ); 1357 action->addTo( navigatorToolBar );
1357 } 1358 }
1358 icon = loadPixmap( pathString + "today" ); 1359 icon = loadPixmap( pathString + "today" );
1359 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1360 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1360 if (p-> mShowIconToday) 1361 if (p-> mShowIconToday)
1361 today_action->addTo( navigatorToolBar ); 1362 today_action->addTo( navigatorToolBar );
1362 icon = loadPixmap( pathString + "1rightarrowB" ); 1363 icon = loadPixmap( pathString + "1rightarrowB" );
1363 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1364 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1364 if (p-> mShowIconForward) { 1365 if (p-> mShowIconForward) {
1365 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1366 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1366 connect( action, SIGNAL( activated() ), 1367 connect( action, SIGNAL( activated() ),
1367 mView, SLOT( goNext() ) ); 1368 mView, SLOT( goNext() ) );
1368 action->addTo( navigatorToolBar ); 1369 action->addTo( navigatorToolBar );
1369 } 1370 }
1370 icon = loadPixmap( pathString + "2rightarrowB" ); 1371 icon = loadPixmap( pathString + "2rightarrowB" );
1371 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1372 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1372 if (p-> mShowIconForwardFast) { 1373 if (p-> mShowIconForwardFast) {
1373 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1374 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1374 connect( action, SIGNAL( activated() ), 1375 connect( action, SIGNAL( activated() ),
1375 mView, SLOT( goNextMonth() ) ); 1376 mView, SLOT( goNextMonth() ) );
1376 action->addTo( navigatorToolBar ); 1377 action->addTo( navigatorToolBar );
1377 } 1378 }
1378 1379
1379 1380
1380 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1381 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1381 1382
1382 1383
1383 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1384 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1384 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1385 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1385 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1386 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1386 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1387 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1387 1388
1388 if (p-> mShowIconNewEvent) 1389 if (p-> mShowIconNewEvent)
1389 configureToolBarMenu->setItemChecked( 10, true ); 1390 configureToolBarMenu->setItemChecked( 10, true );
1390 if (p->mShowIconNewTodo ) 1391 if (p->mShowIconNewTodo )
1391 configureToolBarMenu->setItemChecked( 20, true ); 1392 configureToolBarMenu->setItemChecked( 20, true );
1392 if (p-> mShowIconSearch) 1393 if (p-> mShowIconSearch)
1393 configureToolBarMenu->setItemChecked( 120, true ); 1394 configureToolBarMenu->setItemChecked( 120, true );
1394 if (p-> mShowIconList) 1395 if (p-> mShowIconList)
1395 configureToolBarMenu->setItemChecked( 30, true ); 1396 configureToolBarMenu->setItemChecked( 30, true );
1396 if (p-> mShowIconDay1) 1397 if (p-> mShowIconDay1)
1397 configureToolBarMenu->setItemChecked( 40, true ); 1398 configureToolBarMenu->setItemChecked( 40, true );
1398 if (p-> mShowIconDay5) 1399 if (p-> mShowIconDay5)
1399 configureToolBarMenu->setItemChecked( 50, true ); 1400 configureToolBarMenu->setItemChecked( 50, true );
1400 if (p-> mShowIconDay6) 1401 if (p-> mShowIconDay6)
1401 configureToolBarMenu->setItemChecked( 75, true ); 1402 configureToolBarMenu->setItemChecked( 75, true );
1402 if (p-> mShowIconDay7) 1403 if (p-> mShowIconDay7)
1403 configureToolBarMenu->setItemChecked( 60, true ); 1404 configureToolBarMenu->setItemChecked( 60, true );
1404 if (p-> mShowIconMonth) 1405 if (p-> mShowIconMonth)
1405 configureToolBarMenu->setItemChecked( 70, true ); 1406 configureToolBarMenu->setItemChecked( 70, true );
1406 if (p-> mShowIconTodoview) 1407 if (p-> mShowIconTodoview)
1407 configureToolBarMenu->setItemChecked( 80, true ); 1408 configureToolBarMenu->setItemChecked( 80, true );
1408 if (p-> mShowIconBackFast) 1409 if (p-> mShowIconBackFast)
1409 configureToolBarMenu->setItemChecked( 200, true ); 1410 configureToolBarMenu->setItemChecked( 200, true );
1410 if (p-> mShowIconBack) 1411 if (p-> mShowIconBack)
1411 configureToolBarMenu->setItemChecked( 210, true ); 1412 configureToolBarMenu->setItemChecked( 210, true );
1412 if (p-> mShowIconToday) 1413 if (p-> mShowIconToday)
1413 configureToolBarMenu->setItemChecked( 130, true ); 1414 configureToolBarMenu->setItemChecked( 130, true );
1414 if (p-> mShowIconForward) 1415 if (p-> mShowIconForward)
1415 configureToolBarMenu->setItemChecked( 220, true ); 1416 configureToolBarMenu->setItemChecked( 220, true );
1416 if (p-> mShowIconForwardFast) 1417 if (p-> mShowIconForwardFast)
1417 configureToolBarMenu->setItemChecked( 230, true ); 1418 configureToolBarMenu->setItemChecked( 230, true );
1418 if (p-> mShowIconNextDays) 1419 if (p-> mShowIconNextDays)
1419 configureToolBarMenu->setItemChecked( 100, true ); 1420 configureToolBarMenu->setItemChecked( 100, true );
1420 if (p-> mShowIconNext) 1421 if (p-> mShowIconNext)
1421 configureToolBarMenu->setItemChecked( 110, true ); 1422 configureToolBarMenu->setItemChecked( 110, true );
1422 if (p-> mShowIconJournal) 1423 if (p-> mShowIconJournal)
1423 configureToolBarMenu->setItemChecked( 90, true ); 1424 configureToolBarMenu->setItemChecked( 90, true );
1424 if (p-> mShowIconWhatsThis) 1425 if (p-> mShowIconWhatsThis)
1425 configureToolBarMenu->setItemChecked( 300, true ); 1426 configureToolBarMenu->setItemChecked( 300, true );
1426 if (p-> mShowIconWeekNum) 1427 if (p-> mShowIconWeekNum)
1427 configureToolBarMenu->setItemChecked( 400, true ); 1428 configureToolBarMenu->setItemChecked( 400, true );
1428 if (!p-> mShowIconStretch) { 1429 if (!p-> mShowIconStretch) {
1429 QLabel* dummy = new QLabel( iconToolBar ); 1430 QLabel* dummy = new QLabel( iconToolBar );
1430 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1431 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1431 dummy->setMinimumWidth( 0 ); 1432 dummy->setMinimumWidth( 0 );
1432 iconToolBar->setStretchableWidget ( dummy ) ; 1433 iconToolBar->setStretchableWidget ( dummy ) ;
1433 } 1434 }
1434 else { 1435 else {
1435 iconToolBar->setHorizontalStretchable (true ); 1436 iconToolBar->setHorizontalStretchable (true );
1436 viewToolBar->setHorizontalStretchable (true ); 1437 viewToolBar->setHorizontalStretchable (true );
1437 navigatorToolBar->setHorizontalStretchable (true ); 1438 navigatorToolBar->setHorizontalStretchable (true );
1438 iconToolBar->setVerticalStretchable (true ); 1439 iconToolBar->setVerticalStretchable (true );
1439 viewToolBar->setVerticalStretchable (true ); 1440 viewToolBar->setVerticalStretchable (true );
1440 navigatorToolBar->setVerticalStretchable (true ); 1441 navigatorToolBar->setVerticalStretchable (true );
1441 configureToolBarMenu->setItemChecked( 5, true ); 1442 configureToolBarMenu->setItemChecked( 5, true );
1442 } 1443 }
1443 if (p-> mShowIconFilter) 1444 if (p-> mShowIconFilter)
1444 configureToolBarMenu->setItemChecked( 7, true ); 1445 configureToolBarMenu->setItemChecked( 7, true );
1445 if (p-> mShowIconOnetoolbar) 1446 if (p-> mShowIconOnetoolbar)
1446 configureToolBarMenu->setItemChecked( 6, true ); 1447 configureToolBarMenu->setItemChecked( 6, true );
1447 1448
1448 1449
1449 if ( filterMenubar ) { 1450 if ( filterMenubar ) {
1450 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1451 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1451 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1452 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1452 } 1453 }
1453 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1454 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1454 configureAgenda( p->mHourSize ); 1455 configureAgenda( p->mHourSize );
1455 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1456 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1456} 1457}
1457void MainWindow::calHint() 1458void MainWindow::calHint()
1458{ 1459{
1459 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); 1460 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.");
1460 1461
1461 KMessageBox::information( this, message); 1462 KMessageBox::information( this, message);
1462} 1463}
1463void MainWindow::exportToPhone( int mode ) 1464void MainWindow::exportToPhone( int mode )
1464{ 1465{
1465 1466
1466 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1467 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1467 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1468 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1468 KOex2phonePrefs ex2phone; 1469 KOex2phonePrefs ex2phone;
1469 1470
1470 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1471 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1471 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1472 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1472 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1473 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1473 if ( mode == 1 ) 1474 if ( mode == 1 )
1474 ex2phone.setCaption(i18n("Export complete calendar")); 1475 ex2phone.setCaption(i18n("Export complete calendar"));
1475 if ( mode == 2 ) 1476 if ( mode == 2 )
1476 ex2phone.setCaption(i18n("Export filtered calendar")); 1477 ex2phone.setCaption(i18n("Export filtered calendar"));
1477 1478
1478 if ( !ex2phone.exec() ) { 1479 if ( !ex2phone.exec() ) {
1479 return; 1480 return;
1480 } 1481 }
1481 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1482 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1482 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1483 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1483 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1484 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1484 1485
1485 int inFuture = 0; 1486 int inFuture = 0;
1486 if ( ex2phone.mWriteBackFuture->isChecked() ) 1487 if ( ex2phone.mWriteBackFuture->isChecked() )
1487 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1488 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1488 QPtrList<Incidence> delSel; 1489 QPtrList<Incidence> delSel;
1489 if ( mode == 1 ) 1490 if ( mode == 1 )
1490 delSel = mCalendar->rawIncidences(); 1491 delSel = mCalendar->rawIncidences();
1491 if ( mode == 2 ) 1492 if ( mode == 2 )
1492 delSel = mCalendar->incidences(); 1493 delSel = mCalendar->incidences();
1493 CalendarLocal* cal = new CalendarLocal(); 1494 CalendarLocal* cal = new CalendarLocal();
1494 cal->setLocalTime(); 1495 cal->setLocalTime();
1495 Incidence *incidence = delSel.first(); 1496 Incidence *incidence = delSel.first();
1496 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1497 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1497 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1498 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1498 while ( incidence ) { 1499 while ( incidence ) {
1499 if ( incidence->typeID() != journalID ) { 1500 if ( incidence->typeID() != journalID ) {
1500 bool add = true; 1501 bool add = true;
1501 if ( inFuture ) { 1502 if ( inFuture ) {
1502 QDateTime dt; 1503 QDateTime dt;
1503 if ( incidence->typeID() == todoID ) { 1504 if ( incidence->typeID() == todoID ) {
1504 Todo * t = (Todo*)incidence; 1505 Todo * t = (Todo*)incidence;
1505 if ( t->hasDueDate() ) 1506 if ( t->hasDueDate() )
1506 dt = t->dtDue(); 1507 dt = t->dtDue();
1507 else 1508 else
1508 dt = cur.addSecs( 62 ); 1509 dt = cur.addSecs( 62 );
1509 } 1510 }
1510 else { 1511 else {
1511 bool ok; 1512 bool ok;
1512 dt = incidence->getNextOccurence( cur, &ok ); 1513 dt = incidence->getNextOccurence( cur, &ok );
1513 if ( !ok ) 1514 if ( !ok )
1514 dt = cur.addSecs( -62 ); 1515 dt = cur.addSecs( -62 );
1515 } 1516 }
1516 if ( dt < cur || dt > end ) { 1517 if ( dt < cur || dt > end ) {
1517 add = false; 1518 add = false;
1518 } 1519 }
1519 } 1520 }
1520 if ( add ) { 1521 if ( add ) {
1521 Incidence *in = incidence->clone(); 1522 Incidence *in = incidence->clone();
1522 cal->addIncidence( in ); 1523 cal->addIncidence( in );
1523 } 1524 }
1524 } 1525 }
1525 incidence = delSel.next(); 1526 incidence = delSel.next();
1526 } 1527 }
1527 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1528 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1528 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1529 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1529 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1530 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1530 1531
1531 setCaption( i18n("Writing to phone...")); 1532 setCaption( i18n("Writing to phone..."));
1532 if ( PhoneFormat::writeToPhone( cal ) ) 1533 if ( PhoneFormat::writeToPhone( cal ) )
1533 setCaption( i18n("Export to phone successful!")); 1534 setCaption( i18n("Export to phone successful!"));
1534 else 1535 else
1535 setCaption( i18n("Error exporting to phone!")); 1536 setCaption( i18n("Error exporting to phone!"));
1536 delete cal; 1537 delete cal;
1537} 1538}
1538 1539
1539 1540
1540void MainWindow::setDefaultPreferences() 1541void MainWindow::setDefaultPreferences()
1541{ 1542{
1542 KOPrefs *p = KOPrefs::instance(); 1543 KOPrefs *p = KOPrefs::instance();
1543 1544
1544 p->mCompactDialogs = true; 1545 p->mCompactDialogs = true;
1545 p->mConfirm = true; 1546 p->mConfirm = true;
1546 // p->mEnableQuickTodo = false; 1547 // p->mEnableQuickTodo = false;
1547 1548
1548} 1549}
1549 1550
1550QString MainWindow::resourcePath() 1551QString MainWindow::resourcePath()
1551{ 1552{
1552 return KGlobal::iconLoader()->iconPath(); 1553 return KGlobal::iconLoader()->iconPath();
1553} 1554}
1554 1555
1555void MainWindow::displayText( QString text ,QString cap ) 1556void MainWindow::displayText( QString text ,QString cap )
1556{ 1557{
1557 QDialog dia( this, "name", true ); ; 1558 QDialog dia( this, "name", true ); ;
1558 dia.setCaption( cap ); 1559 dia.setCaption( cap );
1559 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1560 QVBoxLayout* lay = new QVBoxLayout( &dia );
1560 lay->setSpacing( 3 ); 1561 lay->setSpacing( 3 );
1561 lay->setMargin( 3 ); 1562 lay->setMargin( 3 );
1562 QTextBrowser tb ( &dia ); 1563 QTextBrowser tb ( &dia );
1563 lay->addWidget( &tb ); 1564 lay->addWidget( &tb );
1564 tb.setText( text ); 1565 tb.setText( text );
1565#ifdef DESKTOP_VERSION 1566#ifdef DESKTOP_VERSION
1566 dia.resize( 640, 480); 1567 dia.resize( 640, 480);
1567#else 1568#else
1568 dia.showMaximized(); 1569 dia.showMaximized();
1569#endif 1570#endif
1570 dia.exec(); 1571 dia.exec();
1571} 1572}
1572 1573
1573void MainWindow::features() 1574void MainWindow::features()
1574{ 1575{
1575 1576
1576 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1577 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1577} 1578}
1578 1579
1579void MainWindow::usertrans() 1580void MainWindow::usertrans()
1580{ 1581{
1581 1582
1582 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1583 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1583} 1584}
1584 1585
1585void MainWindow::storagehowto() 1586void MainWindow::storagehowto()
1586{ 1587{
1587 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1588 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1588} 1589}
1589void MainWindow::timetrackinghowto() 1590void MainWindow::timetrackinghowto()
1590{ 1591{
1591 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1592 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1592} 1593}
1593void MainWindow::kdesynchowto() 1594void MainWindow::kdesynchowto()
1594{ 1595{
1595 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1596 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1596} 1597}
1597void MainWindow::multisynchowto() 1598void MainWindow::multisynchowto()
1598{ 1599{
1599 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1600 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1600} 1601}
1601void MainWindow::synchowto() 1602void MainWindow::synchowto()
1602{ 1603{
1603 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1604 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1604} 1605}
1605void MainWindow::faq() 1606void MainWindow::faq()
1606{ 1607{
1607 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1608 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1608 1609
1609} 1610}
1610void MainWindow::whatsNew() 1611void MainWindow::whatsNew()
1611{ 1612{
1612 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1613 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1613 1614
1614} 1615}
1615void MainWindow::licence() 1616void MainWindow::licence()
1616{ 1617{
1617 KApplication::showLicence(); 1618 KApplication::showLicence();
1618 1619
1619} 1620}
1620void MainWindow::about() 1621void MainWindow::about()
1621{ 1622{
1622 QString version; 1623 QString version;
1623#include <../version> 1624#include <../version>
1624 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1625 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1625 i18n("KOrganizer/Platform-independent\n") + 1626 i18n("KOrganizer/Platform-independent\n") +
1626 "(KO/Pi) " + version + " - " + 1627 "(KO/Pi) " + version + " - " +
1627 1628
1628#ifdef DESKTOP_VERSION 1629#ifdef DESKTOP_VERSION
1629 i18n("Desktop Edition\n") + 1630 i18n("Desktop Edition\n") +
1630#else 1631#else
1631 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1632 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1632#endif 1633#endif
1633 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1634 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1634} 1635}
1635void MainWindow::keyBindings() 1636void MainWindow::keyBindings()
1636{ 1637{
1637 QString cap = i18n("KO/Pi Keys + Colors"); 1638 QString cap = i18n("KO/Pi Keys + Colors");
1638 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1639 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1639 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1640 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1640 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1641 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1641 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1642 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1642 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1643 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1643 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1644 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1644 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1645 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1645 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1646 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1646 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1647 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1647 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1648 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1648 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ 1649 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
1649 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1650 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1650 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1651 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1651 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1652 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1652 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1653 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1653 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1654 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1654 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1655 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1655 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1656 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1656 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1657 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1657 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1658 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1658 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1659 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1659 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1660 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1660 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1661 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1661 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1662 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1662 i18n("<p><h3>In agenda view:</h3></p>\n") + 1663 i18n("<p><h3>In agenda view:</h3></p>\n") +
1663 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1664 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1664 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1665 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1665 i18n("<p><h3>In todo view:</h3></p>\n") + 1666 i18n("<p><h3>In todo view:</h3></p>\n") +
1666 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1667 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1667 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1668 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1668 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1669 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1669 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1670 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1670 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1671 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1671 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1672 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1672 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1673 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1673 i18n("<p><h3>In list view:</h3></p>\n") + 1674 i18n("<p><h3>In list view:</h3></p>\n") +
1674 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1675 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1675 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1676 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1676 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1677 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1677 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1678 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1678 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1679 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1679 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1680 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1680 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1681 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1681 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1682 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1682 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1683 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1683 i18n("<p><b>E</b>: Edit item</p>\n") + 1684 i18n("<p><b>E</b>: Edit item</p>\n") +
1684 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1685 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1685 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1686 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1686 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1687 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1687 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1688 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1688 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1689 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1689 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1690 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1690 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1691 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1691 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1692 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1692 i18n("<p><b>White</b>: Item readonly</p>\n"); 1693 i18n("<p><b>White</b>: Item readonly</p>\n");
1693 displayText( text, cap); 1694 displayText( text, cap);
1694} 1695}
1695void MainWindow::aboutAutoSaving() 1696void MainWindow::aboutAutoSaving()
1696{ 1697{
1697 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1698 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1698 1699
1699 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1700 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1700 1701
1701} 1702}
1702void MainWindow::aboutKnownBugs() 1703void MainWindow::aboutKnownBugs()
1703{ 1704{
1704 QMessageBox* msg; 1705 QMessageBox* msg;
1705 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1706 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1706 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1707 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1707 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1708 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1708 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1709 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1709 i18n("\nor report them in the bugtracker on\n") + 1710 i18n("\nor report them in the bugtracker on\n") +
1710 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1711 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1711 QMessageBox::NoIcon, 1712 QMessageBox::NoIcon,
1712 QMessageBox::Ok, 1713 QMessageBox::Ok,
1713 QMessageBox::NoButton, 1714 QMessageBox::NoButton,
1714 QMessageBox::NoButton); 1715 QMessageBox::NoButton);
1715 msg->exec(); 1716 msg->exec();
1716 delete msg; 1717 delete msg;
1717 1718
1718} 1719}
1719 1720
1720QString MainWindow::defaultFileName() 1721QString MainWindow::defaultFileName()
1721{ 1722{
1722 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); 1723 return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) );
1723} 1724}
1724QString MainWindow::syncFileName() 1725QString MainWindow::syncFileName()
1725{ 1726{
1726#ifdef DESKTOP_VERSION 1727#ifdef DESKTOP_VERSION
1727 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); 1728 return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) );
1728#else 1729#else
1729 return QString( "/tmp/synccalendar.ics" ); 1730 return QString( "/tmp/synccalendar.ics" );
1730#endif 1731#endif
1731} 1732}
1732#include "koglobals.h" 1733#include "koglobals.h"
1733#include <kcalendarsystem.h> 1734#include <kcalendarsystem.h>
1734void MainWindow::updateWeek(QDate seda) 1735void MainWindow::updateWeek(QDate seda)
1735{ 1736{
1736 int weekNum = KGlobal::locale()->weekNum ( seda ); 1737 int weekNum = KGlobal::locale()->weekNum ( seda );
1737 mWeekPixmap.fill( mWeekBgColor ); 1738 mWeekPixmap.fill( mWeekBgColor );
1738 QPainter p ( &mWeekPixmap ); 1739 QPainter p ( &mWeekPixmap );
1739 p.setFont( mWeekFont ); 1740 p.setFont( mWeekFont );
1740 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1741 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1741 p.end(); 1742 p.end();
1742 QIconSet icon3 ( mWeekPixmap ); 1743 QIconSet icon3 ( mWeekPixmap );
1743 mWeekAction->setIconSet ( icon3 ); 1744 mWeekAction->setIconSet ( icon3 );
1744 1745
1745} 1746}
1746void MainWindow::updateWeekNum(const DateList &selectedDates) 1747void MainWindow::updateWeekNum(const DateList &selectedDates)
1747{ 1748{
1748 updateWeek( selectedDates.first() ); 1749 updateWeek( selectedDates.first() );
1749} 1750}
1750void MainWindow::processIncidenceSelection( Incidence *incidence ) 1751void MainWindow::processIncidenceSelection( Incidence *incidence )
1751{ 1752{
1752 if ( !incidence ) { 1753 if ( !incidence ) {
1753 mShowAction->setMenuText( i18n("Show") ); 1754 mShowAction->setMenuText( i18n("Show") );
1754 enableIncidenceActions( false ); 1755 enableIncidenceActions( false );
1755 mNewSubTodoAction->setEnabled( false ); 1756 mNewSubTodoAction->setEnabled( false );
1756 setCaptionToDates(); 1757 setCaptionToDates();
1757 return; 1758 return;
1758 } 1759 }
1759 QString startString = ""; 1760 QString startString = "";
1760 if ( incidence->typeID() != todoID ) { 1761 if ( incidence->typeID() != todoID ) {
1761 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1762 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1762 if ( incidence->doesFloat() ) { 1763 if ( incidence->doesFloat() ) {
1763 startString += ": "+incidence->dtStartDateStr( true ); 1764 startString += ": "+incidence->dtStartDateStr( true );
1764 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1765 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1765 } else { 1766 } else {
1766 startString = ": "+incidence->dtStartStr(true); 1767 startString = ": "+incidence->dtStartStr(true);
1767 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1768 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1768 } 1769 }
1769 } else { 1770 } else {
1770 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1771 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1771 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1772 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1772 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1773 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1773 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1774 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1774 bool ok; 1775 bool ok;
1775 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1776 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1776 if ( ok ) { 1777 if ( ok ) {
1777 int years = noc.date().year() - incidence->dtStart().date().year(); 1778 int years = noc.date().year() - incidence->dtStart().date().year();
1778 startString += i18n(" (%1 y.)"). arg( years ); 1779 startString += i18n(" (%1 y.)"). arg( years );
1779 } 1780 }
1780 } 1781 }
1781 else 1782 else
1782 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1783 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1783 } 1784 }
1784 } 1785 }
1785 else { 1786 else {
1786 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1787 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1787 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1788 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1788 else 1789 else
1789 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1790 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1790 } 1791 }
1791 if ( !incidence->location().isEmpty() ) 1792 if ( !incidence->location().isEmpty() )
1792 startString += " (" +incidence->location()+")"; 1793 startString += " (" +incidence->location()+")";
1793 setCaption( incidence->summary()+startString); 1794 setCaption( incidence->summary()+startString);
1794 enableIncidenceActions( true ); 1795 enableIncidenceActions( true );
1795 if ( incidence->typeID() == eventID ) { 1796 if ( incidence->typeID() == eventID ) {
1796 mShowAction->setMenuText( i18n("Show Event") ); 1797 mShowAction->setMenuText( i18n("Show Event") );
1797 mNewSubTodoAction->setEnabled( false ); 1798 mNewSubTodoAction->setEnabled( false );
1798 } else if ( incidence->typeID() == todoID ) { 1799 } else if ( incidence->typeID() == todoID ) {
1799 mShowAction->setMenuText( i18n("Show Todo") ); 1800 mShowAction->setMenuText( i18n("Show Todo") );
1800 mNewSubTodoAction->setEnabled( true ); 1801 mNewSubTodoAction->setEnabled( true );
1801 } else { 1802 } else {
1802 mShowAction->setMenuText( i18n("Show") ); 1803 mShowAction->setMenuText( i18n("Show") );
1803 mNewSubTodoAction->setEnabled( false ); 1804 mNewSubTodoAction->setEnabled( false );
1804 } 1805 }
1805#ifdef DESKTOP_VERSION 1806#ifdef DESKTOP_VERSION
1806 static QPixmap jP = SmallIcon( "journal" ); 1807 static QPixmap jP = SmallIcon( "journal" );
1807 static QPixmap eP = SmallIcon( "newevent" ); 1808 static QPixmap eP = SmallIcon( "newevent" );
1808 static QPixmap tP = SmallIcon( "newtodo" ); 1809 static QPixmap tP = SmallIcon( "newtodo" );
1809 QIconSet icon; 1810 QIconSet icon;
1810 if ( incidence->typeID() == todoID ) 1811 if ( incidence->typeID() == todoID )
1811 icon = QIconSet ( tP ); 1812 icon = QIconSet ( tP );
1812 else if ( incidence->typeID() == eventID ) 1813 else if ( incidence->typeID() == eventID )
1813 icon = QIconSet ( eP ); 1814 icon = QIconSet ( eP );
1814 else if ( incidence->typeID() == journalID ) 1815 else if ( incidence->typeID() == journalID )
1815 icon = QIconSet ( jP ); 1816 icon = QIconSet ( jP );
1816 mPrintSelAction->setIconSet ( icon ); 1817 mPrintSelAction->setIconSet ( icon );
1817#endif 1818#endif
1818} 1819}
1819 1820
1820void MainWindow::enableIncidenceActions( bool enabled ) 1821void MainWindow::enableIncidenceActions( bool enabled )
1821{ 1822{
1822 mShowAction->setEnabled( enabled ); 1823 mShowAction->setEnabled( enabled );
1823 mEditAction->setEnabled( enabled ); 1824 mEditAction->setEnabled( enabled );
1824 mDeleteAction->setEnabled( enabled ); 1825 mDeleteAction->setEnabled( enabled );
1825 1826
1826 mCloneAction->setEnabled( enabled ); 1827 mCloneAction->setEnabled( enabled );
1827 mMoveAction->setEnabled( enabled ); 1828 mMoveAction->setEnabled( enabled );
1828#ifndef DESKTOP_VERSION 1829#ifndef DESKTOP_VERSION
1829 mBeamAction->setEnabled( enabled ); 1830 mBeamAction->setEnabled( enabled );
1830#else 1831#else
1831 mPrintSelAction->setEnabled( enabled ); 1832 mPrintSelAction->setEnabled( enabled );
1832#endif 1833#endif
1833 mCancelAction->setEnabled( enabled ); 1834 mCancelAction->setEnabled( enabled );
1834} 1835}
1835 1836
1836void MainWindow::importOL() 1837void MainWindow::importOL()
1837{ 1838{
1838#ifdef _OL_IMPORT_ 1839#ifdef _OL_IMPORT_
1839 mView->clearAllViews(); 1840 mView->clearAllViews();
1840 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1841 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1841 id->exec(); 1842 id->exec();
1842 delete id; 1843 delete id;
1843 mView->calendar()->checkAlarmForIncidence( 0, true ); 1844 mView->calendar()->checkAlarmForIncidence( 0, true );
1844 mView->updateView(); 1845 mView->updateView();
1845#endif 1846#endif
1846} 1847}
1847void MainWindow::importBday() 1848void MainWindow::importBday()
1848{ 1849{
1849 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1850 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1850 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1851 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1851 i18n("Import!"), i18n("Cancel"), 0, 1852 i18n("Import!"), i18n("Cancel"), 0,
1852 0, 1 ); 1853 0, 1 );
1853 if ( result == 0 ) { 1854 if ( result == 0 ) {
1854 mView->importBday(); 1855 mView->importBday();
1855 1856
1856 } 1857 }
1857 1858
1858 1859
1859} 1860}
1860void MainWindow::importQtopia() 1861void MainWindow::importQtopia()
1861{ 1862{
1862 //#ifndef DESKTOP_VERSION 1863 //#ifndef DESKTOP_VERSION
1863 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1864 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1864#ifdef DESKTOP_VERSION 1865#ifdef DESKTOP_VERSION
1865 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1866 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1866#endif 1867#endif
1867 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1868 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1868 i18n("Import!"), i18n("Cancel"), 0, 1869 i18n("Import!"), i18n("Cancel"), 0,
1869 0, 1 ); 1870 0, 1 );
1870 if ( result == 0 ) { 1871 if ( result == 0 ) {
1871#ifndef DESKTOP_VERSION 1872#ifndef DESKTOP_VERSION
1872 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1873 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1873 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1874 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1874 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1875 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1875#else 1876#else
1876 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1877 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1877 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1878 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1878 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1879 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1879#endif 1880#endif
1880 mView->importQtopia( categories, datebook, todolist ); 1881 mView->importQtopia( categories, datebook, todolist );
1881 } 1882 }
1882 mView->calendar()->reInitAlarmSettings(); 1883 mView->calendar()->reInitAlarmSettings();
1883#if 0 1884#if 0
1884 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1885 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1885 i18n("Not supported \non desktop!\n"), 1886 i18n("Not supported \non desktop!\n"),
1886 i18n("Ok"), i18n("Cancel"), 0, 1887 i18n("Ok"), i18n("Cancel"), 0,
1887 0, 1 ); 1888 0, 1 );
1888 1889
1889#endif 1890#endif
1890} 1891}
1891 1892
1892void MainWindow::saveOnClose() 1893void MainWindow::saveOnClose()
1893{ 1894{
1894 KOPrefs *p = KOPrefs::instance(); 1895 KOPrefs *p = KOPrefs::instance();
1895 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1896 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1896 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1897 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1897 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1898 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1898 if ( filterToolBar ) { 1899 if ( filterToolBar ) {
1899 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1900 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1900 } 1901 }
1901#ifdef DESKTOP_VERSION 1902#ifdef DESKTOP_VERSION
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 36ede81..df2aad8 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1,2268 +1,2268 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright 2 Copyright
3 (C) 2000 Reginald Stadlbauer (reggie@kde.org) 3 (C) 2000 Reginald Stadlbauer (reggie@kde.org)
4 (C) 1997, 1998 Stephan Kulow (coolo@kde.org) 4 (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
5 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) 5 (C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
6 (C) 1997, 1998 Sven Radej (radej@kde.org) 6 (C) 1997, 1998 Sven Radej (radej@kde.org)
7 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) 7 (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
8 (C) 1999 Chris Schlaeger (cs@kde.org) 8 (C) 1999 Chris Schlaeger (cs@kde.org)
9 (C) 1999 Kurt Granroth (granroth@kde.org) 9 (C) 1999 Kurt Granroth (granroth@kde.org)
10 10
11 This library is free software; you can redistribute it and/or 11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public 12 modify it under the terms of the GNU Library General Public
13 License version 2 as published by the Free Software Foundation. 13 License version 2 as published by the Free Software Foundation.
14 14
15 This library is distributed in the hope that it will be useful, 15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details. 18 Library General Public License for more details.
19 19
20 You should have received a copy of the GNU Library General Public License 20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to 21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. 23 Boston, MA 02111-1307, USA.
24*/ 24*/
25 25
26#ifdef KDE_USE_FINAL 26#ifdef KDE_USE_FINAL
27#undef Always 27#undef Always
28#include <qdockwindow.h> 28#include <qdockwindow.h>
29#endif 29#endif
30 30
31 31
32 32
33#include "ktoolbar.h" 33#include "ktoolbar.h"
34#include "kmainwindow.h" 34#include "kmainwindow.h"
35 35
36#include <string.h> 36#include <string.h>
37 37
38#include <qpainter.h> 38#include <qpainter.h>
39#include <qtooltip.h> 39#include <qtooltip.h>
40#include <qdrawutil.h> 40#include <qdrawutil.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qrect.h> 42#include <qrect.h>
43#include <qobjectlist.h> 43#include <qobjectlist.h>
44#include <qtimer.h> 44#include <qtimer.h>
45#include <qstyle.h> 45#include <qstyle.h>
46#include <qapplication.h> 46#include <qapplication.h>
47 47
48//US #include <config.h> 48//US #include <config.h>
49 49
50#include "klineedit.h" 50#include "klineedit.h"
51#include "kseparator.h" 51#include "kseparator.h"
52#include <klocale.h> 52#include <klocale.h>
53#include <kapplication.h> 53#include <kapplication.h>
54#include <kaction.h> 54#include <kaction.h>
55#include <kstdaction.h> 55#include <kstdaction.h>
56#include <kglobal.h> 56#include <kglobal.h>
57#include <kconfig.h> 57#include <kconfig.h>
58#include <kiconloader.h> 58#include <kiconloader.h>
59#include <kcombobox.h> 59#include <kcombobox.h>
60//US #include <kpopupmenu.h> 60//US #include <kpopupmenu.h>
61//US #include <kanimwidget.h> 61//US #include <kanimwidget.h>
62//US #include <kipc.h> 62//US #include <kipc.h>
63//US #include <kwin.h> 63//US #include <kwin.h>
64#include <kdebug.h> 64#include <kdebug.h>
65#include <qlayout.h> 65#include <qlayout.h>
66 66
67#include "ktoolbarbutton.h" 67#include "ktoolbarbutton.h"
68 68
69//US 69//US
70#include "kconfigbase.h" 70#include "kconfigbase.h"
71 71
72#include <qpopupmenu.h> 72#include <qpopupmenu.h>
73#include <qmainwindow.h> 73#include <qmainwindow.h>
74 74
75enum { 75enum {
76 CONTEXT_TOP = 0, 76 CONTEXT_TOP = 0,
77 CONTEXT_LEFT = 1, 77 CONTEXT_LEFT = 1,
78 CONTEXT_RIGHT = 2, 78 CONTEXT_RIGHT = 2,
79 CONTEXT_BOTTOM = 3, 79 CONTEXT_BOTTOM = 3,
80 CONTEXT_FLOAT = 4, 80 CONTEXT_FLOAT = 4,
81 CONTEXT_FLAT = 5, 81 CONTEXT_FLAT = 5,
82 CONTEXT_ICONS = 6, 82 CONTEXT_ICONS = 6,
83 CONTEXT_TEXT = 7, 83 CONTEXT_TEXT = 7,
84 CONTEXT_TEXTRIGHT = 8, 84 CONTEXT_TEXTRIGHT = 8,
85 CONTEXT_TEXTUNDER = 9, 85 CONTEXT_TEXTUNDER = 9,
86 CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before 86 CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before
87}; 87};
88 88
89class KToolBarPrivate 89class KToolBarPrivate
90{ 90{
91public: 91public:
92 KToolBarPrivate() { 92 KToolBarPrivate() {
93 m_iconSize = 0; 93 m_iconSize = 0;
94 m_iconText = KToolBar::IconOnly; 94 m_iconText = KToolBar::IconOnly;
95 m_highlight = true; 95 m_highlight = true;
96 m_transparent = true; 96 m_transparent = true;
97 m_honorStyle = false; 97 m_honorStyle = false;
98 98
99 m_enableContext = true; 99 m_enableContext = true;
100 100
101 m_xmlguiClient = 0; 101 m_xmlguiClient = 0;
102 m_configurePlugged = false; 102 m_configurePlugged = false;
103 103
104//US oldPos = Qt::DockUnmanaged; 104//US oldPos = Qt::DockUnmanaged;
105 oldPos = QMainWindow::Unmanaged; 105 oldPos = QMainWindow::Unmanaged;
106 106
107 modified = m_isHorizontal = positioned = FALSE; 107 modified = m_isHorizontal = positioned = FALSE;
108 108
109 HiddenDefault = false; 109 HiddenDefault = false;
110 IconSizeDefault = 0; 110 IconSizeDefault = 0;
111 IconTextDefault = "IconOnly"; 111 IconTextDefault = "IconOnly";
112 IndexDefault = -1; 112 IndexDefault = -1;
113 NewLineDefault = false; 113 NewLineDefault = false;
114 OffsetDefault = -1; 114 OffsetDefault = -1;
115 PositionDefault = "Top"; 115 PositionDefault = "Top";
116 idleButtons.setAutoDelete(true); 116 idleButtons.setAutoDelete(true);
117 } 117 }
118 118
119 int m_iconSize; 119 int m_iconSize;
120 KToolBar::IconText m_iconText; 120 KToolBar::IconText m_iconText;
121 bool m_highlight : 1; 121 bool m_highlight : 1;
122 bool m_transparent : 1; 122 bool m_transparent : 1;
123 bool m_honorStyle : 1; 123 bool m_honorStyle : 1;
124 bool m_isHorizontal : 1; 124 bool m_isHorizontal : 1;
125 bool m_enableContext : 1; 125 bool m_enableContext : 1;
126 bool m_configurePlugged : 1; 126 bool m_configurePlugged : 1;
127 bool modified : 1; 127 bool modified : 1;
128 bool positioned : 1; 128 bool positioned : 1;
129 129
130 QWidget *m_parent; 130 QWidget *m_parent;
131 131
132 QMainWindow::ToolBarDock oldPos; 132 QMainWindow::ToolBarDock oldPos;
133 133
134 KXMLGUIClient *m_xmlguiClient; 134 KXMLGUIClient *m_xmlguiClient;
135 135
136 struct ToolBarInfo 136 struct ToolBarInfo
137 { 137 {
138//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} 138//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
139 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} 139 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {}
140//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 140//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
141 ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 141 ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
142 int index, offset; 142 int index, offset;
143 bool newline; 143 bool newline;
144//US Qt::Dock dock; 144//US Qt::Dock dock;
145 QMainWindow::ToolBarDock dock; 145 QMainWindow::ToolBarDock dock;
146 }; 146 };
147 147
148 ToolBarInfo toolBarInfo; 148 ToolBarInfo toolBarInfo;
149 QValueList<int> iconSizes; 149 QValueList<int> iconSizes;
150 QTimer repaintTimer; 150 QTimer repaintTimer;
151 151
152 // Default Values. 152 // Default Values.
153 bool HiddenDefault; 153 bool HiddenDefault;
154 int IconSizeDefault; 154 int IconSizeDefault;
155 QString IconTextDefault; 155 QString IconTextDefault;
156 int IndexDefault; 156 int IndexDefault;
157 bool NewLineDefault; 157 bool NewLineDefault;
158 int OffsetDefault; 158 int OffsetDefault;
159 QString PositionDefault; 159 QString PositionDefault;
160 160
161 QPtrList<QWidget> idleButtons; 161 QPtrList<QWidget> idleButtons;
162}; 162};
163 163
164KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, 164KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent,
165 const char* name ) 165 const char* name )
166 :QFrame( parent, name ), line( l ) 166 :QFrame( parent, name ), line( l )
167{ 167{
168 connect( parent, SIGNAL(orientationChanged(Orientation)), 168 connect( parent, SIGNAL(orientationChanged(Orientation)),
169 this, SLOT(setOrientation(Orientation)) ); 169 this, SLOT(setOrientation(Orientation)) );
170 setOrientation( o ); 170 setOrientation( o );
171 setBackgroundMode( parent->backgroundMode() ); 171 setBackgroundMode( parent->backgroundMode() );
172 setBackgroundOrigin( ParentOrigin ); 172 setBackgroundOrigin( ParentOrigin );
173} 173}
174 174
175void KToolBarSeparator::setOrientation( Orientation o ) 175void KToolBarSeparator::setOrientation( Orientation o )
176{ 176{
177 orient = o; 177 orient = o;
178 if ( line ) { 178 if ( line ) {
179 if ( orientation() == Vertical ) 179 if ( orientation() == Vertical )
180 setFrameStyle( HLine + Sunken ); 180 setFrameStyle( HLine + Sunken );
181 else 181 else
182 setFrameStyle( VLine + Sunken ); 182 setFrameStyle( VLine + Sunken );
183 } else { 183 } else {
184 setFrameStyle( NoFrame ); 184 setFrameStyle( NoFrame );
185 } 185 }
186} 186}
187 187
188void KToolBarSeparator::styleChange( QStyle& ) 188void KToolBarSeparator::styleChange( QStyle& )
189{ 189{
190 setOrientation( orient ); 190 setOrientation( orient );
191} 191}
192 192
193QSize KToolBarSeparator::sizeHint() const 193QSize KToolBarSeparator::sizeHint() const
194{ 194{
195 return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); 195 return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
196} 196}
197 197
198QSizePolicy KToolBarSeparator::sizePolicy() const 198QSizePolicy KToolBarSeparator::sizePolicy() const
199{ 199{
200 return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 200 return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
201} 201}
202 202
203KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) 203KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
204#ifdef DESKTOP_VERSION 204#ifdef DESKTOP_VERSION
205 : QToolBar( QString::fromLatin1( name ), 205 : QToolBar( QString::fromLatin1( name ),
206 parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 206 parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
207 parent, FALSE, 207 parent, FALSE,
208 name ? name : "mainToolBar") 208 name ? name : "mainToolBar")
209#else 209#else
210 : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 210 : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
211 QString::fromLatin1( name )) 211 QString::fromLatin1( name ))
212 212
213 213
214#endif 214#endif
215{ 215{
216 init( readConfig, honorStyle ); 216 init( readConfig, honorStyle );
217} 217}
218 218
219KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 219KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
220#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
221 : QToolBar( QString::fromLatin1( name ), 221 : QToolBar( QString::fromLatin1( name ),
222 parentWindow, dock, newLine, 222 parentWindow, dock, newLine,
223 name ? name : "mainToolBar") 223 name ? name : "mainToolBar")
224#else 224#else
225 : QPEToolBar( parentWindow,QString::fromLatin1( name )) 225 : QPEToolBar( parentWindow,QString::fromLatin1( name ))
226 226
227 227
228#endif 228#endif
229 229
230{ 230{
231 init( readConfig, honorStyle ); 231 init( readConfig, honorStyle );
232} 232}
233 233
234KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 234KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
235#ifdef DESKTOP_VERSION 235#ifdef DESKTOP_VERSION
236 : QToolBar( QString::fromLatin1( name ), 236 : QToolBar( QString::fromLatin1( name ),
237 parentWindow, dock, newLine, 237 parentWindow, dock, newLine,
238 name ? name : "mainToolBar") 238 name ? name : "mainToolBar")
239#else 239#else
240 : QPEToolBar( parentWindow,QString::fromLatin1( name )) 240 : QPEToolBar( parentWindow,QString::fromLatin1( name ))
241 241
242 242
243#endif 243#endif
244 244
245{ 245{
246 init( readConfig, honorStyle ); 246 init( readConfig, honorStyle );
247} 247}
248 248
249KToolBar::~KToolBar() 249KToolBar::~KToolBar()
250{ 250{
251 inshutdownprocess = true; 251 inshutdownprocess = true;
252 emit toolbarDestroyed(); 252 emit toolbarDestroyed();
253 delete d; 253 delete d;
254} 254}
255 255
256void KToolBar::init( bool readConfig, bool honorStyle ) 256void KToolBar::init( bool readConfig, bool honorStyle )
257{ 257{
258 inshutdownprocess = false; 258 inshutdownprocess = false;
259 d = new KToolBarPrivate; 259 d = new KToolBarPrivate;
260 setFullSize( TRUE ); 260 setFullSize( TRUE );
261 d->m_honorStyle = honorStyle; 261 d->m_honorStyle = honorStyle;
262 context = 0; 262 context = 0;
263 layoutTimer = new QTimer( this ); 263 layoutTimer = new QTimer( this );
264 connect( layoutTimer, SIGNAL( timeout() ), 264 connect( layoutTimer, SIGNAL( timeout() ),
265 this, SLOT( rebuildLayout() ) ); 265 this, SLOT( rebuildLayout() ) );
266 connect( &(d->repaintTimer), SIGNAL( timeout() ), 266 connect( &(d->repaintTimer), SIGNAL( timeout() ),
267 this, SLOT( slotRepaint() ) ); 267 this, SLOT( slotRepaint() ) );
268/*US 268/*US
269 if ( kapp ) { // may be null when started inside designer 269 if ( kapp ) { // may be null when started inside designer
270 connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); 270 connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged()));
271 // request notification of changes in icon style 271 // request notification of changes in icon style
272 kapp->addKipcEventMask(KIPC::IconChanged); 272 kapp->addKipcEventMask(KIPC::IconChanged);
273 connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); 273 connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int)));
274 } 274 }
275*/ 275*/
276 // finally, read in our configurable settings 276 // finally, read in our configurable settings
277 if ( readConfig ) 277 if ( readConfig )
278 slotReadConfig(); 278 slotReadConfig();
279 279
280 if ( mainWindow() ) 280 if ( mainWindow() )
281 connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), 281 connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ),
282 this, SLOT( toolBarPosChanged( QToolBar * ) ) ); 282 this, SLOT( toolBarPosChanged( QToolBar * ) ) );
283 283
284 // Hack to make sure we recalculate our size when we dock. 284 // Hack to make sure we recalculate our size when we dock.
285//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); 285//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
286} 286}
287 287
288int KToolBar::insertButton(const QString& icon, int id, bool enabled, 288int KToolBar::insertButton(const QString& icon, int id, bool enabled,
289 const QString& text, int index/*US, KInstance *_instance*/ ) 289 const QString& text, int index/*US, KInstance *_instance*/ )
290{ 290{
291 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); 291 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ );
292 292
293 insertWidgetInternal( button, index, id ); 293 insertWidgetInternal( button, index, id );
294 button->setEnabled( enabled ); 294 button->setEnabled( enabled );
295 doConnections( button ); 295 doConnections( button );
296 return index; 296 return index;
297} 297}
298 298
299 299
300int KToolBar::insertButton(const QString& icon, int id, const char *signal, 300int KToolBar::insertButton(const QString& icon, int id, const char *signal,
301 const QObject *receiver, const char *slot, 301 const QObject *receiver, const char *slot,
302 bool enabled, const QString& text, int index/*US, KInstance *_instance*/ ) 302 bool enabled, const QString& text, int index/*US, KInstance *_instance*/ )
303{ 303{
304 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/); 304 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/);
305 insertWidgetInternal( button, index, id ); 305 insertWidgetInternal( button, index, id );
306 button->setEnabled( enabled ); 306 button->setEnabled( enabled );
307 connect( button, signal, receiver, slot ); 307 connect( button, signal, receiver, slot );
308 doConnections( button ); 308 doConnections( button );
309 return index; 309 return index;
310} 310}
311 311
312 312
313int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled, 313int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled,
314 const QString& text, int index ) 314 const QString& text, int index )
315{ 315{
316 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); 316 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
317 insertWidgetInternal( button, index, id ); 317 insertWidgetInternal( button, index, id );
318 button->setEnabled( enabled ); 318 button->setEnabled( enabled );
319 doConnections( button ); 319 doConnections( button );
320 return index; 320 return index;
321} 321}
322#if 0 322#if 0
323 bar->insertButton( icon, id_, SIGNAL( clicked() ), this, 323 bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
324 SLOT( slotActivated() ), 324 SLOT( slotActivated() ),
325 d->isEnabled(), d->plainText(), index/*US, instance*/ ); 325 d->isEnabled(), d->plainText(), index/*US, instance*/ );
326#endif 326#endif
327 327
328int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, 328int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
329 const QObject *receiver, const char *slot, 329 const QObject *receiver, const char *slot,
330 bool enabled, const QString& text, 330 bool enabled, const QString& text,
331 int index ) 331 int index )
332{ 332{
333 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); 333 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
334 insertWidgetInternal( button, index, id ); 334 insertWidgetInternal( button, index, id );
335 button->setEnabled( enabled ); 335 button->setEnabled( enabled );
336 connect( button, signal, receiver, slot ); 336 connect( button, signal, receiver, slot );
337 doConnections( button ); 337 doConnections( button );
338 return index; 338 return index;
339} 339}
340 340
341 341
342int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, 342int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
343 bool enabled, const QString &text, int index ) 343 bool enabled, const QString &text, int index )
344{ 344{
345 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); 345 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
346 insertWidgetInternal( button, index, id ); 346 insertWidgetInternal( button, index, id );
347 button->setEnabled( enabled ); 347 button->setEnabled( enabled );
348 button->setPopup( popup ); 348 button->setPopup( popup );
349 doConnections( button ); 349 doConnections( button );
350 return index; 350 return index;
351} 351}
352 352
353 353
354int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, 354int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
355 bool enabled, const QString &text, int index ) 355 bool enabled, const QString &text, int index )
356{ 356{
357 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); 357 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
358 insertWidgetInternal( button, index, id ); 358 insertWidgetInternal( button, index, id );
359 button->setEnabled( enabled ); 359 button->setEnabled( enabled );
360 button->setPopup( popup ); 360 button->setPopup( popup );
361 doConnections( button ); 361 doConnections( button );
362 return index; 362 return index;
363} 363}
364 364
365 365
366int KToolBar::insertLined (const QString& text, int id, 366int KToolBar::insertLined (const QString& text, int id,
367 const char *signal, 367 const char *signal,
368 const QObject *receiver, const char *slot, 368 const QObject *receiver, const char *slot,
369 bool enabled , 369 bool enabled ,
370 const QString& toolTipText, 370 const QString& toolTipText,
371 int size, int index ) 371 int size, int index )
372{ 372{
373 KLineEdit *lined = new KLineEdit ( this, 0 ); 373 KLineEdit *lined = new KLineEdit ( this, 0 );
374 if ( !toolTipText.isEmpty() ) 374 if ( !toolTipText.isEmpty() )
375 QToolTip::add( lined, toolTipText ); 375 QToolTip::add( lined, toolTipText );
376 if ( size > 0 ) 376 if ( size > 0 )
377 lined->setMinimumWidth( size ); 377 lined->setMinimumWidth( size );
378 insertWidgetInternal( lined, index, id ); 378 insertWidgetInternal( lined, index, id );
379 connect( lined, signal, receiver, slot ); 379 connect( lined, signal, receiver, slot );
380 lined->setText(text); 380 lined->setText(text);
381 lined->setEnabled( enabled ); 381 lined->setEnabled( enabled );
382 return index; 382 return index;
383} 383}
384 384
385int KToolBar::insertCombo (const QStringList &list, int id, bool writable, 385int KToolBar::insertCombo (const QStringList &list, int id, bool writable,
386 const char *signal, const QObject *receiver, 386 const char *signal, const QObject *receiver,
387 const char *slot, bool enabled, 387 const char *slot, bool enabled,
388 const QString& tooltiptext, 388 const QString& tooltiptext,
389 int size, int index, 389 int size, int index,
390 QComboBox::Policy policy ) 390 QComboBox::Policy policy )
391{ 391{
392//US KComboBox *combo = new KComboBox ( writable, this ); 392//US KComboBox *combo = new KComboBox ( writable, this );
393 KComboBox *combo = new KComboBox ( this ); 393 KComboBox *combo = new KComboBox ( this );
394 combo->setEditable(writable); 394 combo->setEditable(writable);
395 395
396 insertWidgetInternal( combo, index, id ); 396 insertWidgetInternal( combo, index, id );
397 combo->insertStringList (list); 397 combo->insertStringList (list);
398 combo->setInsertionPolicy(policy); 398 combo->setInsertionPolicy(policy);
399 combo->setEnabled( enabled ); 399 combo->setEnabled( enabled );
400 if ( !tooltiptext.isEmpty() ) 400 if ( !tooltiptext.isEmpty() )
401 QToolTip::add( combo, tooltiptext ); 401 QToolTip::add( combo, tooltiptext );
402 if ( size > 0 ) 402 if ( size > 0 )
403 combo->setMinimumWidth( size ); 403 combo->setMinimumWidth( size );
404 if (!tooltiptext.isNull()) 404 if (!tooltiptext.isNull())
405 QToolTip::add( combo, tooltiptext ); 405 QToolTip::add( combo, tooltiptext );
406 406
407 if ( signal && receiver && slot ) 407 if ( signal && receiver && slot )
408 connect ( combo, signal, receiver, slot ); 408 connect ( combo, signal, receiver, slot );
409 return index; 409 return index;
410} 410}
411 411
412 412
413int KToolBar::insertCombo (const QString& text, int id, bool writable, 413int KToolBar::insertCombo (const QString& text, int id, bool writable,
414 const char *signal, QObject *receiver, 414 const char *signal, QObject *receiver,
415 const char *slot, bool enabled, 415 const char *slot, bool enabled,
416 const QString& tooltiptext, 416 const QString& tooltiptext,
417 int size, int index, 417 int size, int index,
418 QComboBox::Policy policy ) 418 QComboBox::Policy policy )
419{ 419{
420//US KComboBox *combo = new KComboBox ( writable, this ); 420//US KComboBox *combo = new KComboBox ( writable, this );
421 KComboBox *combo = new KComboBox ( this ); 421 KComboBox *combo = new KComboBox ( this );
422 combo->setEditable(writable); 422 combo->setEditable(writable);
423 423
424 insertWidgetInternal( combo, index, id ); 424 insertWidgetInternal( combo, index, id );
425 combo->insertItem (text); 425 combo->insertItem (text);
426 combo->setInsertionPolicy(policy); 426 combo->setInsertionPolicy(policy);
427 combo->setEnabled( enabled ); 427 combo->setEnabled( enabled );
428 if ( !tooltiptext.isEmpty() ) 428 if ( !tooltiptext.isEmpty() )
429 QToolTip::add( combo, tooltiptext ); 429 QToolTip::add( combo, tooltiptext );
430 if ( size > 0 ) 430 if ( size > 0 )
431 combo->setMinimumWidth( size ); 431 combo->setMinimumWidth( size );
432 if (!tooltiptext.isNull()) 432 if (!tooltiptext.isNull())
433 QToolTip::add( combo, tooltiptext ); 433 QToolTip::add( combo, tooltiptext );
434 connect (combo, signal, receiver, slot); 434 connect (combo, signal, receiver, slot);
435 return index; 435 return index;
436} 436}
437 437
438int KToolBar::insertSeparator(int index, int id) 438int KToolBar::insertSeparator(int index, int id)
439{ 439{
440 QWidget *w = new KToolBarSeparator( orientation(), FALSE, this, "tool bar separator" ); 440 QWidget *w = new KToolBarSeparator( orientation(), FALSE, this, "tool bar separator" );
441 insertWidgetInternal( w, index, id ); 441 insertWidgetInternal( w, index, id );
442 return index; 442 return index;
443} 443}
444 444
445int KToolBar::insertLineSeparator(int index, int id) 445int KToolBar::insertLineSeparator(int index, int id)
446{ 446{
447 QWidget *w = new KToolBarSeparator( orientation(), TRUE, this, "tool bar separator" ); 447 QWidget *w = new KToolBarSeparator( orientation(), TRUE, this, "tool bar separator" );
448 insertWidgetInternal( w, index, id ); 448 insertWidgetInternal( w, index, id );
449 return index; 449 return index;
450} 450}
451 451
452 452
453int KToolBar::insertWidget(int id, int /*width*/, QWidget *widget, int index) 453int KToolBar::insertWidget(int id, int /*width*/, QWidget *widget, int index)
454{ 454{
455 // removeWidgetInternal( widget ); // in case we already have it ? 455 // removeWidgetInternal( widget ); // in case we already have it ?
456 insertWidgetInternal( widget, index, id ); 456 insertWidgetInternal( widget, index, id );
457 return index; 457 return index;
458} 458}
459/*US 459/*US
460int KToolBar::insertAnimatedWidget(int id, QObject *receiver, const char *slot, 460int KToolBar::insertAnimatedWidget(int id, QObject *receiver, const char *slot,
461 const QString& icons, int index ) 461 const QString& icons, int index )
462{ 462{
463 KAnimWidget *anim = new KAnimWidget( icons, d->m_iconSize, this ); 463 KAnimWidget *anim = new KAnimWidget( icons, d->m_iconSize, this );
464 insertWidgetInternal( anim, index, id ); 464 insertWidgetInternal( anim, index, id );
465 465
466 if ( receiver ) 466 if ( receiver )
467 connect( anim, SIGNAL(clicked()), receiver, slot); 467 connect( anim, SIGNAL(clicked()), receiver, slot);
468 468
469 return index; 469 return index;
470} 470}
471 471
472KAnimWidget *KToolBar::animatedWidget( int id ) 472KAnimWidget *KToolBar::animatedWidget( int id )
473{ 473{
474 Id2WidgetMap::Iterator it = id2widget.find( id ); 474 Id2WidgetMap::Iterator it = id2widget.find( id );
475 if ( it == id2widget.end() ) 475 if ( it == id2widget.end() )
476 return 0; 476 return 0;
477 if ( (*it) && (*it)->inherits( "KAnimWidget" ) ) 477 if ( (*it) && (*it)->inherits( "KAnimWidget" ) )
478 return (KAnimWidget*)(*it); 478 return (KAnimWidget*)(*it);
479 QObjectList *l = queryList( "KAnimWidget" ); 479 QObjectList *l = queryList( "KAnimWidget" );
480 if ( !l || !l->first() ) { 480 if ( !l || !l->first() ) {
481 delete l; 481 delete l;
482 return 0; 482 return 0;
483 } 483 }
484 484
485 for ( QObject *o = l->first(); o; o = l->next() ) { 485 for ( QObject *o = l->first(); o; o = l->next() ) {
486 if ( o->inherits( "KAnimWidget" ) ) 486 if ( o->inherits( "KAnimWidget" ) )
487 { 487 {
488 delete l; 488 delete l;
489 return (KAnimWidget*)o; 489 return (KAnimWidget*)o;
490 } 490 }
491 } 491 }
492 492
493 delete l; 493 delete l;
494 return 0; 494 return 0;
495} 495}
496*/ 496*/
497 497
498void KToolBar::addConnection (int id, const char *signal, 498void KToolBar::addConnection (int id, const char *signal,
499 const QObject *receiver, const char *slot) 499 const QObject *receiver, const char *slot)
500{ 500{
501 Id2WidgetMap::Iterator it = id2widget.find( id ); 501 Id2WidgetMap::Iterator it = id2widget.find( id );
502 if ( it == id2widget.end() ) 502 if ( it == id2widget.end() )
503 return; 503 return;
504 if ( (*it) ) 504 if ( (*it) )
505 connect( (*it), signal, receiver, slot ); 505 connect( (*it), signal, receiver, slot );
506} 506}
507 507
508void KToolBar::setItemEnabled( int id, bool enabled ) 508void KToolBar::setItemEnabled( int id, bool enabled )
509{ 509{
510 Id2WidgetMap::Iterator it = id2widget.find( id ); 510 Id2WidgetMap::Iterator it = id2widget.find( id );
511 if ( it == id2widget.end() ) 511 if ( it == id2widget.end() )
512 return; 512 return;
513 if ( (*it) ) 513 if ( (*it) )
514 (*it)->setEnabled( enabled ); 514 (*it)->setEnabled( enabled );
515} 515}
516 516
517 517
518void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap ) 518void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap )
519{ 519{
520 Id2WidgetMap::Iterator it = id2widget.find( id ); 520 Id2WidgetMap::Iterator it = id2widget.find( id );
521 if ( it == id2widget.end() ) 521 if ( it == id2widget.end() )
522 return; 522 return;
523//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 523//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
524 KToolBarButton * button = (KToolBarButton *)( *it ); 524 KToolBarButton * button = (KToolBarButton *)( *it );
525 if ( button ) 525 if ( button )
526 button->setPixmap( _pixmap ); 526 button->setPixmap( _pixmap );
527} 527}
528 528
529 529
530void KToolBar::setButtonIcon( int id, const QString& _icon ) 530void KToolBar::setButtonIcon( int id, const QString& _icon )
531{ 531{
532 Id2WidgetMap::Iterator it = id2widget.find( id ); 532 Id2WidgetMap::Iterator it = id2widget.find( id );
533 if ( it == id2widget.end() ) 533 if ( it == id2widget.end() )
534 return; 534 return;
535//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 535//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
536 KToolBarButton * button = (KToolBarButton *)( *it ); 536 KToolBarButton * button = (KToolBarButton *)( *it );
537 if ( button ) 537 if ( button )
538 button->setIcon( _icon ); 538 button->setIcon( _icon );
539} 539}
540 540
541void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) 541void KToolBar::setButtonIconSet( int id, const QIconSet& iconset )
542{ 542{
543 Id2WidgetMap::Iterator it = id2widget.find( id ); 543 Id2WidgetMap::Iterator it = id2widget.find( id );
544 if ( it == id2widget.end() ) 544 if ( it == id2widget.end() )
545 return; 545 return;
546//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 546//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
547 KToolBarButton * button = (KToolBarButton *)( *it ); 547 KToolBarButton * button = (KToolBarButton *)( *it );
548 if ( button ) 548 if ( button )
549 button->setIconSet( iconset ); 549 button->setIconSet( iconset );
550} 550}
551 551
552 552
553void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) 553void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle )
554{ 554{
555 Id2WidgetMap::Iterator it = id2widget.find( id ); 555 Id2WidgetMap::Iterator it = id2widget.find( id );
556 if ( it == id2widget.end() ) 556 if ( it == id2widget.end() )
557 return; 557 return;
558//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 558//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
559 KToolBarButton * button = (KToolBarButton *)( *it ); 559 KToolBarButton * button = (KToolBarButton *)( *it );
560 if ( button ) 560 if ( button )
561 button->setDelayedPopup( _popup, toggle ); 561 button->setDelayedPopup( _popup, toggle );
562} 562}
563 563
564 564
565void KToolBar::setAutoRepeat (int id, bool flag) 565void KToolBar::setAutoRepeat (int id, bool flag)
566{ 566{
567 Id2WidgetMap::Iterator it = id2widget.find( id ); 567 Id2WidgetMap::Iterator it = id2widget.find( id );
568 if ( it == id2widget.end() ) 568 if ( it == id2widget.end() )
569 return; 569 return;
570//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 570//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
571 KToolBarButton * button = (KToolBarButton *)( *it ); 571 KToolBarButton * button = (KToolBarButton *)( *it );
572 if ( button ) 572 if ( button )
573 button->setAutoRepeat( flag ); 573 button->setAutoRepeat( flag );
574} 574}
575 575
576 576
577void KToolBar::setToggle (int id, bool flag ) 577void KToolBar::setToggle (int id, bool flag )
578{ 578{
579 Id2WidgetMap::Iterator it = id2widget.find( id ); 579 Id2WidgetMap::Iterator it = id2widget.find( id );
580 if ( it == id2widget.end() ) 580 if ( it == id2widget.end() )
581 return; 581 return;
582//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 582//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
583 KToolBarButton * button = (KToolBarButton *)( *it ); 583 KToolBarButton * button = (KToolBarButton *)( *it );
584 if ( button ) 584 if ( button )
585 button->setToggle( flag ); 585 button->setToggle( flag );
586} 586}
587 587
588 588
589void KToolBar::toggleButton (int id) 589void KToolBar::toggleButton (int id)
590{ 590{
591 Id2WidgetMap::Iterator it = id2widget.find( id ); 591 Id2WidgetMap::Iterator it = id2widget.find( id );
592 if ( it == id2widget.end() ) 592 if ( it == id2widget.end() )
593 return; 593 return;
594//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 594//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
595 KToolBarButton * button = (KToolBarButton *)( *it ); 595 KToolBarButton * button = (KToolBarButton *)( *it );
596 if ( button ) 596 if ( button )
597 button->toggle(); 597 button->toggle();
598} 598}
599 599
600 600
601void KToolBar::setButton (int id, bool flag) 601void KToolBar::setButton (int id, bool flag)
602{ 602{
603 Id2WidgetMap::Iterator it = id2widget.find( id ); 603 Id2WidgetMap::Iterator it = id2widget.find( id );
604 if ( it == id2widget.end() ) 604 if ( it == id2widget.end() )
605 return; 605 return;
606//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 606//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
607 KToolBarButton * button = (KToolBarButton *)( *it ); 607 KToolBarButton * button = (KToolBarButton *)( *it );
608 if ( button ) 608 if ( button )
609 button->on( flag ); 609 button->on( flag );
610} 610}
611 611
612 612
613bool KToolBar::isButtonOn (int id) const 613bool KToolBar::isButtonOn (int id) const
614{ 614{
615 Id2WidgetMap::ConstIterator it = id2widget.find( id ); 615 Id2WidgetMap::ConstIterator it = id2widget.find( id );
616 if ( it == id2widget.end() ) 616 if ( it == id2widget.end() )
617 return false; 617 return false;
618//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 618//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
619 KToolBarButton * button = (KToolBarButton *)( *it ); 619 KToolBarButton * button = (KToolBarButton *)( *it );
620 return button ? button->isOn() : false; 620 return button ? button->isOn() : false;
621} 621}
622 622
623 623
624void KToolBar::setLinedText (int id, const QString& text) 624void KToolBar::setLinedText (int id, const QString& text)
625{ 625{
626 Id2WidgetMap::Iterator it = id2widget.find( id ); 626 Id2WidgetMap::Iterator it = id2widget.find( id );
627 if ( it == id2widget.end() ) 627 if ( it == id2widget.end() )
628 return; 628 return;
629//US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); 629//US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it );
630 QLineEdit * lineEdit = (QLineEdit *)( *it ); 630 QLineEdit * lineEdit = (QLineEdit *)( *it );
631 if ( lineEdit ) 631 if ( lineEdit )
632 lineEdit->setText( text ); 632 lineEdit->setText( text );
633} 633}
634 634
635 635
636QString KToolBar::getLinedText (int id) const 636QString KToolBar::getLinedText (int id) const
637{ 637{
638 Id2WidgetMap::ConstIterator it = id2widget.find( id ); 638 Id2WidgetMap::ConstIterator it = id2widget.find( id );
639 if ( it == id2widget.end() ) 639 if ( it == id2widget.end() )
640 return QString::null; 640 return QString::null;
641//US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); 641//US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it );
642 QLineEdit * lineEdit = (QLineEdit *)( *it ); 642 QLineEdit * lineEdit = (QLineEdit *)( *it );
643 return lineEdit ? lineEdit->text() : QString::null; 643 return lineEdit ? lineEdit->text() : QString::null;
644} 644}
645 645
646 646
647void KToolBar::insertComboItem (int id, const QString& text, int index) 647void KToolBar::insertComboItem (int id, const QString& text, int index)
648{ 648{
649 Id2WidgetMap::Iterator it = id2widget.find( id ); 649 Id2WidgetMap::Iterator it = id2widget.find( id );
650 if ( it == id2widget.end() ) 650 if ( it == id2widget.end() )
651 return; 651 return;
652//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 652//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
653 QComboBox * comboBox = (QComboBox *)( *it ); 653 QComboBox * comboBox = (QComboBox *)( *it );
654 if (comboBox) 654 if (comboBox)
655 comboBox->insertItem( text, index ); 655 comboBox->insertItem( text, index );
656} 656}
657 657
658void KToolBar::insertComboList (int id, const QStringList &list, int index) 658void KToolBar::insertComboList (int id, const QStringList &list, int index)
659{ 659{
660 Id2WidgetMap::Iterator it = id2widget.find( id ); 660 Id2WidgetMap::Iterator it = id2widget.find( id );
661 if ( it == id2widget.end() ) 661 if ( it == id2widget.end() )
662 return; 662 return;
663//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 663//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
664 QComboBox * comboBox = (QComboBox *)( *it ); 664 QComboBox * comboBox = (QComboBox *)( *it );
665 if (comboBox) 665 if (comboBox)
666 comboBox->insertStringList( list, index ); 666 comboBox->insertStringList( list, index );
667} 667}
668 668
669 669
670void KToolBar::removeComboItem (int id, int index) 670void KToolBar::removeComboItem (int id, int index)
671{ 671{
672 Id2WidgetMap::Iterator it = id2widget.find( id ); 672 Id2WidgetMap::Iterator it = id2widget.find( id );
673 if ( it == id2widget.end() ) 673 if ( it == id2widget.end() )
674 return; 674 return;
675//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 675//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
676 QComboBox * comboBox = (QComboBox *)( *it ); 676 QComboBox * comboBox = (QComboBox *)( *it );
677 if (comboBox) 677 if (comboBox)
678 comboBox->removeItem( index ); 678 comboBox->removeItem( index );
679} 679}
680 680
681 681
682void KToolBar::setCurrentComboItem (int id, int index) 682void KToolBar::setCurrentComboItem (int id, int index)
683{ 683{
684 Id2WidgetMap::Iterator it = id2widget.find( id ); 684 Id2WidgetMap::Iterator it = id2widget.find( id );
685 if ( it == id2widget.end() ) 685 if ( it == id2widget.end() )
686 return; 686 return;
687//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 687//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
688 QComboBox * comboBox = (QComboBox *)( *it ); 688 QComboBox * comboBox = (QComboBox *)( *it );
689 if (comboBox) 689 if (comboBox)
690 comboBox->setCurrentItem( index ); 690 comboBox->setCurrentItem( index );
691} 691}
692 692
693 693
694void KToolBar::changeComboItem (int id, const QString& text, int index) 694void KToolBar::changeComboItem (int id, const QString& text, int index)
695{ 695{
696 Id2WidgetMap::Iterator it = id2widget.find( id ); 696 Id2WidgetMap::Iterator it = id2widget.find( id );
697 if ( it == id2widget.end() ) 697 if ( it == id2widget.end() )
698 return; 698 return;
699//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 699//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
700 QComboBox * comboBox = (QComboBox *)( *it ); 700 QComboBox * comboBox = (QComboBox *)( *it );
701 if (comboBox) 701 if (comboBox)
702 comboBox->changeItem( text, index ); 702 comboBox->changeItem( text, index );
703} 703}
704 704
705 705
706void KToolBar::clearCombo (int id) 706void KToolBar::clearCombo (int id)
707{ 707{
708 Id2WidgetMap::Iterator it = id2widget.find( id ); 708 Id2WidgetMap::Iterator it = id2widget.find( id );
709 if ( it == id2widget.end() ) 709 if ( it == id2widget.end() )
710 return; 710 return;
711//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 711//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
712 QComboBox * comboBox = (QComboBox *)( *it ); 712 QComboBox * comboBox = (QComboBox *)( *it );
713 if (comboBox) 713 if (comboBox)
714 comboBox->clear(); 714 comboBox->clear();
715} 715}
716 716
717 717
718QString KToolBar::getComboItem (int id, int index) const 718QString KToolBar::getComboItem (int id, int index) const
719{ 719{
720 Id2WidgetMap::ConstIterator it = id2widget.find( id ); 720 Id2WidgetMap::ConstIterator it = id2widget.find( id );
721 if ( it == id2widget.end() ) 721 if ( it == id2widget.end() )
722 return QString::null; 722 return QString::null;
723//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it ); 723//US QComboBox * comboBox = dynamic_cast<QComboBox *>( *it );
724 QComboBox * comboBox = (QComboBox *)( *it ); 724 QComboBox * comboBox = (QComboBox *)( *it );
725 return comboBox ? comboBox->text( index ) : QString::null; 725 return comboBox ? comboBox->text( index ) : QString::null;
726} 726}
727 727
728 728
729KComboBox * KToolBar::getCombo(int id) 729KComboBox * KToolBar::getCombo(int id)
730{ 730{
731 Id2WidgetMap::Iterator it = id2widget.find( id ); 731 Id2WidgetMap::Iterator it = id2widget.find( id );
732 if ( it == id2widget.end() ) 732 if ( it == id2widget.end() )
733 return 0; 733 return 0;
734//US return dynamic_cast<KComboBox *>( *it ); 734//US return dynamic_cast<KComboBox *>( *it );
735 return (KComboBox *)( *it ); 735 return (KComboBox *)( *it );
736} 736}
737 737
738 738
739KLineEdit * KToolBar::getLined (int id) 739KLineEdit * KToolBar::getLined (int id)
740{ 740{
741 Id2WidgetMap::Iterator it = id2widget.find( id ); 741 Id2WidgetMap::Iterator it = id2widget.find( id );
742 if ( it == id2widget.end() ) 742 if ( it == id2widget.end() )
743 return 0; 743 return 0;
744//US return dynamic_cast<KLineEdit *>( *it ); 744//US return dynamic_cast<KLineEdit *>( *it );
745 return (KLineEdit *)( *it ); 745 return (KLineEdit *)( *it );
746} 746}
747 747
748 748
749KToolBarButton * KToolBar::getButton (int id) 749KToolBarButton * KToolBar::getButton (int id)
750{ 750{
751 Id2WidgetMap::Iterator it = id2widget.find( id ); 751 Id2WidgetMap::Iterator it = id2widget.find( id );
752 if ( it == id2widget.end() ) 752 if ( it == id2widget.end() )
753 return 0; 753 return 0;
754//US return dynamic_cast<KToolBarButton *>( *it ); 754//US return dynamic_cast<KToolBarButton *>( *it );
755 return (KToolBarButton *)( *it ); 755 return (KToolBarButton *)( *it );
756} 756}
757 757
758 758
759void KToolBar::alignItemRight (int id, bool right ) 759void KToolBar::alignItemRight (int id, bool right )
760{ 760{
761 Id2WidgetMap::Iterator it = id2widget.find( id ); 761 Id2WidgetMap::Iterator it = id2widget.find( id );
762 if ( it == id2widget.end() ) 762 if ( it == id2widget.end() )
763 return; 763 return;
764 if ( rightAligned && !right && (*it) == rightAligned ) 764 if ( rightAligned && !right && (*it) == rightAligned )
765 rightAligned = 0; 765 rightAligned = 0;
766 if ( (*it) && right ) 766 if ( (*it) && right )
767 rightAligned = (*it); 767 rightAligned = (*it);
768} 768}
769 769
770 770
771QWidget *KToolBar::getWidget (int id) 771QWidget *KToolBar::getWidget (int id)
772{ 772{
773 Id2WidgetMap::Iterator it = id2widget.find( id ); 773 Id2WidgetMap::Iterator it = id2widget.find( id );
774 return ( it == id2widget.end() ) ? 0 : (*it); 774 return ( it == id2widget.end() ) ? 0 : (*it);
775} 775}
776 776
777 777
778void KToolBar::setItemAutoSized (int id, bool yes ) 778void KToolBar::setItemAutoSized (int id, bool yes )
779{ 779{
780 QWidget *w = getWidget(id); 780 QWidget *w = getWidget(id);
781 if ( w && yes ) 781 if ( w && yes )
782 setStretchableWidget( w ); 782 setStretchableWidget( w );
783} 783}
784 784
785 785
786void KToolBar::clear () 786void KToolBar::clear ()
787{ 787{
788 QToolBar::clear(); 788 QToolBar::clear();
789 widget2id.clear(); 789 widget2id.clear();
790 id2widget.clear(); 790 id2widget.clear();
791} 791}
792 792
793 793
794void KToolBar::removeItem(int id) 794void KToolBar::removeItem(int id)
795{ 795{
796 Id2WidgetMap::Iterator it = id2widget.find( id ); 796 Id2WidgetMap::Iterator it = id2widget.find( id );
797 if ( it == id2widget.end() ) 797 if ( it == id2widget.end() )
798 { 798 {
799 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; 799 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
800 return; 800 return;
801 } 801 }
802 QWidget * w = (*it); 802 QWidget * w = (*it);
803 id2widget.remove( id ); 803 id2widget.remove( id );
804 widget2id.remove( w ); 804 widget2id.remove( w );
805 widgets.removeRef( w ); 805 widgets.removeRef( w );
806 delete w; 806 delete w;
807} 807}
808 808
809 809
810void KToolBar::removeItemDelayed(int id) 810void KToolBar::removeItemDelayed(int id)
811{ 811{
812 Id2WidgetMap::Iterator it = id2widget.find( id ); 812 Id2WidgetMap::Iterator it = id2widget.find( id );
813 if ( it == id2widget.end() ) 813 if ( it == id2widget.end() )
814 { 814 {
815 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; 815 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
816 return; 816 return;
817 } 817 }
818 QWidget * w = (*it); 818 QWidget * w = (*it);
819 id2widget.remove( id ); 819 id2widget.remove( id );
820 widget2id.remove( w ); 820 widget2id.remove( w );
821 widgets.removeRef( w ); 821 widgets.removeRef( w );
822 822
823 w->blockSignals(true); 823 w->blockSignals(true);
824 d->idleButtons.append(w); 824 d->idleButtons.append(w);
825 layoutTimer->start( 50, TRUE ); 825 layoutTimer->start( 50, TRUE );
826} 826}
827 827
828 828
829void KToolBar::hideItem (int id) 829void KToolBar::hideItem (int id)
830{ 830{
831 QWidget *w = getWidget(id); 831 QWidget *w = getWidget(id);
832 if ( w ) 832 if ( w )
833 w->hide(); 833 w->hide();
834} 834}
835 835
836 836
837void KToolBar::showItem (int id) 837void KToolBar::showItem (int id)
838{ 838{
839 QWidget *w = getWidget(id); 839 QWidget *w = getWidget(id);
840 if ( w ) 840 if ( w )
841 w->show(); 841 w->show();
842} 842}
843 843
844 844
845int KToolBar::itemIndex (int id) 845int KToolBar::itemIndex (int id)
846{ 846{
847 QWidget *w = getWidget(id); 847 QWidget *w = getWidget(id);
848 return w ? widgets.findRef(w) : -1; 848 return w ? widgets.findRef(w) : -1;
849} 849}
850 850
851 851
852void KToolBar::setFullSize(bool flag ) 852void KToolBar::setFullSize(bool flag )
853{ 853{
854 setHorizontalStretchable( flag ); 854 setHorizontalStretchable( flag );
855 setVerticalStretchable( flag ); 855 setVerticalStretchable( flag );
856} 856}
857 857
858 858
859bool KToolBar::fullSize() const 859bool KToolBar::fullSize() const
860{ 860{
861 return isHorizontalStretchable() || isVerticalStretchable(); 861 return isHorizontalStretchable() || isVerticalStretchable();
862} 862}
863 863
864 864
865void KToolBar::enableMoving(bool flag ) 865void KToolBar::enableMoving(bool flag )
866{ 866{
867//US setMovingEnabled(flag); 867//US setMovingEnabled(flag);
868 this->mainWindow()->setToolBarsMovable(flag); 868 this->mainWindow()->setToolBarsMovable(flag);
869} 869}
870 870
871 871
872void KToolBar::setBarPos (BarPosition bpos) 872void KToolBar::setBarPos (BarPosition bpos)
873{ 873{
874 if ( !mainWindow() ) 874 if ( !mainWindow() )
875 return; 875 return;
876//US mainWindow()->moveDockWindow( this, (Dock)bpos ); 876//US mainWindow()->moveDockWindow( this, (Dock)bpos );
877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); 877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
878} 878}
879 879
880 880
881const KToolBar::BarPosition KToolBar::barPos() 881const KToolBar::BarPosition KToolBar::barPos()
882{ 882{
883 if ( !(QMainWindow*)mainWindow() ) 883 if ( !(QMainWindow*)mainWindow() )
884 return KToolBar::Top; 884 return KToolBar::Top;
885//US Dock dock; 885//US Dock dock;
886 QMainWindow::ToolBarDock dock; 886 QMainWindow::ToolBarDock dock;
887 int dm1, dm2; 887 int dm1, dm2;
888 bool dm3; 888 bool dm3;
889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); 889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
890//US if ( dock == DockUnmanaged ) { 890//US if ( dock == DockUnmanaged ) {
891 if ( dock == QMainWindow::Unmanaged ) { 891 if ( dock == QMainWindow::Unmanaged ) {
892 return (KToolBar::BarPosition)Top; 892 return (KToolBar::BarPosition)Top;
893 } 893 }
894 return (BarPosition)dock; 894 return (BarPosition)dock;
895} 895}
896 896
897 897
898bool KToolBar::enable(BarStatus stat) 898bool KToolBar::enable(BarStatus stat)
899{ 899{
900 bool mystat = isVisible(); 900 bool mystat = isVisible();
901 901
902 if ( (stat == Toggle && mystat) || stat == Hide ) 902 if ( (stat == Toggle && mystat) || stat == Hide )
903 hide(); 903 hide();
904 else 904 else
905 show(); 905 show();
906 906
907 return isVisible() == mystat; 907 return isVisible() == mystat;
908} 908}
909 909
910 910
911void KToolBar::setMaxHeight ( int h ) 911void KToolBar::setMaxHeight ( int h )
912{ 912{
913 setMaximumHeight( h ); 913 setMaximumHeight( h );
914} 914}
915 915
916int KToolBar::maxHeight() 916int KToolBar::maxHeight()
917{ 917{
918 return maximumHeight(); 918 return maximumHeight();
919} 919}
920 920
921 921
922void KToolBar::setMaxWidth (int dw) 922void KToolBar::setMaxWidth (int dw)
923{ 923{
924 setMaximumWidth( dw ); 924 setMaximumWidth( dw );
925} 925}
926 926
927 927
928int KToolBar::maxWidth() 928int KToolBar::maxWidth()
929{ 929{
930 return maximumWidth(); 930 return maximumWidth();
931} 931}
932 932
933 933
934void KToolBar::setTitle (const QString& _title) 934void KToolBar::setTitle (const QString& _title)
935{ 935{
936 setLabel( _title ); 936 setLabel( _title );
937} 937}
938 938
939 939
940void KToolBar::enableFloating (bool ) 940void KToolBar::enableFloating (bool )
941{ 941{
942} 942}
943 943
944 944
945void KToolBar::setIconText(IconText it) 945void KToolBar::setIconText(IconText it)
946{ 946{
947 setIconText( it, true ); 947 setIconText( it, true );
948} 948}
949 949
950 950
951void KToolBar::setIconText(IconText icontext, bool update) 951void KToolBar::setIconText(IconText icontext, bool update)
952{ 952{
953 bool doUpdate=false; 953 bool doUpdate=false;
954 954
955 if (icontext != d->m_iconText) { 955 if (icontext != d->m_iconText) {
956 d->m_iconText = icontext; 956 d->m_iconText = icontext;
957 doUpdate=true; 957 doUpdate=true;
958 } 958 }
959 959
960 if (update == false) 960 if (update == false)
961 return; 961 return;
962 962
963 if (doUpdate) 963 if (doUpdate)
964 emit modechange(); // tell buttons what happened 964 emit modechange(); // tell buttons what happened
965 965
966 // ugly hack to force a QMainWindow::triggerLayout( TRUE ) 966 // ugly hack to force a QMainWindow::triggerLayout( TRUE )
967 if ( mainWindow() ) { 967 if ( mainWindow() ) {
968 QMainWindow *mw = mainWindow(); 968 QMainWindow *mw = mainWindow();
969 mw->setUpdatesEnabled( FALSE ); 969 mw->setUpdatesEnabled( FALSE );
970 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 970 mw->setToolBarsMovable( !mw->toolBarsMovable() );
971 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 971 mw->setToolBarsMovable( !mw->toolBarsMovable() );
972 mw->setUpdatesEnabled( TRUE ); 972 mw->setUpdatesEnabled( TRUE );
973 } 973 }
974} 974}
975 975
976 976
977KToolBar::IconText KToolBar::iconText() const 977KToolBar::IconText KToolBar::iconText() const
978{ 978{
979 return d->m_iconText; 979 return d->m_iconText;
980} 980}
981 981
982 982
983void KToolBar::setIconSize(int size) 983void KToolBar::setIconSize(int size)
984{ 984{
985 setIconSize( size, true ); 985 setIconSize( size, true );
986} 986}
987 987
988void KToolBar::setIconSize(int size, bool update) 988void KToolBar::setIconSize(int size, bool update)
989{ 989{
990 bool doUpdate=false; 990 bool doUpdate=false;
991 991
992 if ( size != d->m_iconSize ) { 992 if ( size != d->m_iconSize ) {
993 d->m_iconSize = size; 993 d->m_iconSize = size;
994 doUpdate=true; 994 doUpdate=true;
995 } 995 }
996 996
997 if (update == false) 997 if (update == false)
998 return; 998 return;
999 999
1000 if (doUpdate) 1000 if (doUpdate)
1001 emit modechange(); // tell buttons what happened 1001 emit modechange(); // tell buttons what happened
1002 1002
1003 // ugly hack to force a QMainWindow::triggerLayout( TRUE ) 1003 // ugly hack to force a QMainWindow::triggerLayout( TRUE )
1004 if ( mainWindow() ) { 1004 if ( mainWindow() ) {
1005 QMainWindow *mw = mainWindow(); 1005 QMainWindow *mw = mainWindow();
1006 mw->setUpdatesEnabled( FALSE ); 1006 mw->setUpdatesEnabled( FALSE );
1007 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 1007 mw->setToolBarsMovable( !mw->toolBarsMovable() );
1008 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 1008 mw->setToolBarsMovable( !mw->toolBarsMovable() );
1009 mw->setUpdatesEnabled( TRUE ); 1009 mw->setUpdatesEnabled( TRUE );
1010 } 1010 }
1011} 1011}
1012 1012
1013 1013
1014int KToolBar::iconSize() const 1014int KToolBar::iconSize() const
1015{ 1015{
1016/*US 1016/*US
1017 if ( !d->m_iconSize ) // default value? 1017 if ( !d->m_iconSize ) // default value?
1018 { 1018 {
1019 if (!::qstrcmp(QObject::name(), "mainToolBar")) 1019 if (!::qstrcmp(QObject::name(), "mainToolBar"))
1020 return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar); 1020 return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
1021 else 1021 else
1022 return KGlobal::iconLoader()->currentSize(KIcon::Toolbar); 1022 return KGlobal::iconLoader()->currentSize(KIcon::Toolbar);
1023 } 1023 }
1024 return d->m_iconSize; 1024 return d->m_iconSize;
1025*/ 1025*/
1026 int ret = 18; 1026 int ret = 18;
1027 if ( QApplication::desktop()->width() > 320 ) 1027 if ( QApplication::desktop()->width() > 320 )
1028 ret = 30; 1028 ret = 30;
1029 return ret; 1029 return ret;
1030} 1030}
1031 1031
1032 1032
1033void KToolBar::setEnableContextMenu(bool enable ) 1033void KToolBar::setEnableContextMenu(bool enable )
1034{ 1034{
1035 d->m_enableContext = enable; 1035 d->m_enableContext = enable;
1036} 1036}
1037 1037
1038 1038
1039bool KToolBar::contextMenuEnabled() const 1039bool KToolBar::contextMenuEnabled() const
1040{ 1040{
1041 return d->m_enableContext; 1041 return d->m_enableContext;
1042} 1042}
1043 1043
1044 1044
1045void KToolBar::setItemNoStyle(int id, bool no_style ) 1045void KToolBar::setItemNoStyle(int id, bool no_style )
1046{ 1046{
1047 Id2WidgetMap::Iterator it = id2widget.find( id ); 1047 Id2WidgetMap::Iterator it = id2widget.find( id );
1048 if ( it == id2widget.end() ) 1048 if ( it == id2widget.end() )
1049 return; 1049 return;
1050//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); 1050//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
1051 KToolBarButton * button = (KToolBarButton *)( *it ); 1051 KToolBarButton * button = (KToolBarButton *)( *it );
1052 if (button) 1052 if (button)
1053 button->setNoStyle( no_style ); 1053 button->setNoStyle( no_style );
1054} 1054}
1055 1055
1056 1056
1057void KToolBar::setFlat (bool flag) 1057void KToolBar::setFlat (bool flag)
1058{ 1058{
1059 if ( !mainWindow() ) 1059 if ( !mainWindow() )
1060 return; 1060 return;
1061 if ( flag ) 1061 if ( flag )
1062//US mainWindow()->moveDockWindow( this, DockMinimized ); 1062//US mainWindow()->moveDockWindow( this, DockMinimized );
1063 mainWindow()->moveToolBar( this, QMainWindow::Minimized ); 1063 mainWindow()->moveToolBar( this, QMainWindow::Minimized );
1064 else 1064 else
1065//US mainWindow()->moveDockWindow( this, DockTop ); 1065//US mainWindow()->moveDockWindow( this, DockTop );
1066 mainWindow()->moveToolBar( this, QMainWindow::Top ); 1066 mainWindow()->moveToolBar( this, QMainWindow::Top );
1067 // And remember to save the new look later 1067 // And remember to save the new look later
1068/*US 1068/*US
1069 if ( mainWindow()->inherits( "KMainWindow" ) ) 1069 if ( mainWindow()->inherits( "KMainWindow" ) )
1070 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); 1070 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
1071*/ 1071*/
1072} 1072}
1073 1073
1074 1074
1075int KToolBar::count() const 1075int KToolBar::count() const
1076{ 1076{
1077 return id2widget.count(); 1077 return id2widget.count();
1078} 1078}
1079 1079
1080 1080
1081void KToolBar::saveState() 1081void KToolBar::saveState()
1082{ 1082{
1083/*US 1083/*US
1084 // first, try to save to the xml file 1084 // first, try to save to the xml file
1085 if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) { 1085 if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
1086 // go down one level to get to the right tags 1086 // go down one level to get to the right tags
1087 QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement(); 1087 QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement();
1088 elem = elem.firstChild().toElement(); 1088 elem = elem.firstChild().toElement();
1089 QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name()); 1089 QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
1090 QDomElement current; 1090 QDomElement current;
1091 // now try to find our toolbar 1091 // now try to find our toolbar
1092 d->modified = false; 1092 d->modified = false;
1093 for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { 1093 for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
1094 current = elem; 1094 current = elem;
1095 1095
1096 if ( current.tagName().lower() != "toolbar" ) 1096 if ( current.tagName().lower() != "toolbar" )
1097 continue; 1097 continue;
1098 1098
1099 QString curname(current.attribute( "name" )); 1099 QString curname(current.attribute( "name" ));
1100 1100
1101 if ( curname == barname ) { 1101 if ( curname == barname ) {
1102 saveState( current ); 1102 saveState( current );
1103 break; 1103 break;
1104 } 1104 }
1105 } 1105 }
1106 // if we didn't make changes, then just return 1106 // if we didn't make changes, then just return
1107 if ( !d->modified ) 1107 if ( !d->modified )
1108 return; 1108 return;
1109 1109
1110 // now we load in the (non-merged) local file 1110 // now we load in the (non-merged) local file
1111 QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance())); 1111 QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance()));
1112 QDomDocument local; 1112 QDomDocument local;
1113 local.setContent(local_xml); 1113 local.setContent(local_xml);
1114 1114
1115 // make sure we don't append if this toolbar already exists locally 1115 // make sure we don't append if this toolbar already exists locally
1116 bool just_append = true; 1116 bool just_append = true;
1117 elem = local.documentElement().toElement(); 1117 elem = local.documentElement().toElement();
1118 KXMLGUIFactory::removeDOMComments( elem ); 1118 KXMLGUIFactory::removeDOMComments( elem );
1119 elem = elem.firstChild().toElement(); 1119 elem = elem.firstChild().toElement();
1120 for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { 1120 for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
1121 if ( elem.tagName().lower() != "toolbar" ) 1121 if ( elem.tagName().lower() != "toolbar" )
1122 continue; 1122 continue;
1123 1123
1124 QString curname(elem.attribute( "name" )); 1124 QString curname(elem.attribute( "name" ));
1125 1125
1126 if ( curname == barname ) { 1126 if ( curname == barname ) {
1127 just_append = false; 1127 just_append = false;
1128 local.documentElement().replaceChild( current, elem ); 1128 local.documentElement().replaceChild( current, elem );
1129 break; 1129 break;
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 if (just_append) 1133 if (just_append)
1134 local.documentElement().appendChild( current ); 1134 local.documentElement().appendChild( current );
1135 1135
1136 KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() ); 1136 KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() );
1137 1137
1138 return; 1138 return;
1139 } 1139 }
1140*/ 1140*/
1141 // if that didn't work, we save to the config file 1141 // if that didn't work, we save to the config file
1142 KConfig *config = KGlobal::config(); 1142 KConfig *config = KGlobal::config();
1143 saveSettings(config, QString::null); 1143 saveSettings(config, QString::null);
1144 config->sync(); 1144 config->sync();
1145} 1145}
1146 1146
1147QString KToolBar::settingsGroup() 1147QString KToolBar::settingsGroup()
1148{ 1148{
1149 QString configGroup; 1149 QString configGroup;
1150 if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar")) 1150 if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar"))
1151 configGroup = "Toolbar style"; 1151 configGroup = "Toolbar style";
1152 else 1152 else
1153 configGroup = QString(name()) + " Toolbar style"; 1153 configGroup = QString(name()) + " Toolbar style";
1154 if ( this->mainWindow() ) 1154 if ( this->mainWindow() )
1155 { 1155 {
1156 configGroup.prepend(" "); 1156 configGroup.prepend(" ");
1157 configGroup.prepend( this->mainWindow()->name() ); 1157 configGroup.prepend( this->mainWindow()->name() );
1158 } 1158 }
1159 return configGroup; 1159 return configGroup;
1160} 1160}
1161 1161
1162void KToolBar::saveSettings(KConfig *config, const QString &_configGroup) 1162void KToolBar::saveSettings(KConfig *config, const QString &_configGroup)
1163{ 1163{
1164 return; 1164 return;
1165 QString configGroup = _configGroup; 1165 QString configGroup = _configGroup;
1166 if (configGroup.isEmpty()) 1166 if (configGroup.isEmpty())
1167 configGroup = settingsGroup(); 1167 configGroup = settingsGroup();
1168 //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl; 1168 //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl;
1169 1169
1170 QString position, icontext; 1170 QString position, icontext;
1171 int index; 1171 int index;
1172 getAttributes( position, icontext, index ); 1172 getAttributes( position, icontext, index );
1173 1173
1174 //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl; 1174 //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl;
1175 1175
1176 KConfigGroupSaver saver(config, configGroup); 1176 KConfigGroupSaver saver(config, configGroup);
1177 1177
1178 if ( position != d->PositionDefault ) 1178 if ( position != d->PositionDefault )
1179 config->writeEntry("Position", position); 1179 config->writeEntry("Position", position);
1180 else 1180 else
1181 config->deleteEntry("Position"); 1181 config->deleteEntry("Position");
1182 1182
1183 if ( icontext != d->IconTextDefault ) 1183 if ( icontext != d->IconTextDefault )
1184 config->writeEntry("IconText", icontext); 1184 config->writeEntry("IconText", icontext);
1185 else 1185 else
1186 config->deleteEntry("IconText"); 1186 config->deleteEntry("IconText");
1187 1187
1188 if ( iconSize() != d->IconSizeDefault ) 1188 if ( iconSize() != d->IconSizeDefault )
1189 config->writeEntry("IconSize", iconSize()); 1189 config->writeEntry("IconSize", iconSize());
1190 else 1190 else
1191 config->deleteEntry("IconSize"); 1191 config->deleteEntry("IconSize");
1192 1192
1193 if ( isHidden() != d->HiddenDefault ) 1193 if ( isHidden() != d->HiddenDefault )
1194 config->writeEntry("Hidden", isHidden()); 1194 config->writeEntry("Hidden", isHidden());
1195 else 1195 else
1196 config->deleteEntry("Hidden"); 1196 config->deleteEntry("Hidden");
1197 1197
1198 if ( index != d->IndexDefault ) 1198 if ( index != d->IndexDefault )
1199 config->writeEntry( "Index", index ); 1199 config->writeEntry( "Index", index );
1200 else 1200 else
1201 config->deleteEntry("Index"); 1201 config->deleteEntry("Index");
1202//US the older version of KDE (used on the Zaurus) has no Offset property 1202//US the older version of KDE (used on the Zaurus) has no Offset property
1203/* if ( offset() != d->OffsetDefault ) 1203/* if ( offset() != d->OffsetDefault )
1204 config->writeEntry( "Offset", offset() ); 1204 config->writeEntry( "Offset", offset() );
1205 else 1205 else
1206*/ 1206*/
1207 config->deleteEntry("Offset"); 1207 config->deleteEntry("Offset");
1208 1208
1209//US the older version of KDE (used on the Zaurus) has no NewLine property 1209//US the older version of KDE (used on the Zaurus) has no NewLine property
1210/* 1210/*
1211 if ( newLine() != d->NewLineDefault ) 1211 if ( newLine() != d->NewLineDefault )
1212 config->writeEntry( "NewLine", newLine() ); 1212 config->writeEntry( "NewLine", newLine() );
1213 else 1213 else
1214*/ 1214*/
1215 config->deleteEntry("NewLine"); 1215 config->deleteEntry("NewLine");
1216} 1216}
1217 1217
1218void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) 1218void KToolBar::setXMLGUIClient( KXMLGUIClient *client )
1219{ 1219{
1220 d->m_xmlguiClient = client; 1220 d->m_xmlguiClient = client;
1221} 1221}
1222 1222
1223void KToolBar::setText( const QString & txt ) 1223void KToolBar::setText( const QString & txt )
1224{ 1224{
1225//US setLabel( txt + " ( " + kapp->caption() + " ) " ); 1225//US setLabel( txt + " ( " + kapp->caption() + " ) " );
1226 setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); 1226 setLabel( txt + " ( " + KGlobal::getAppName() + " ) " );
1227} 1227}
1228 1228
1229 1229
1230QString KToolBar::text() const 1230QString KToolBar::text() const
1231{ 1231{
1232 return label(); 1232 return label();
1233} 1233}
1234 1234
1235 1235
1236void KToolBar::doConnections( KToolBarButton *button ) 1236void KToolBar::doConnections( KToolBarButton *button )
1237{ 1237{
1238 connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); 1238 connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) );
1239 connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); 1239 connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) );
1240 connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); 1240 connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) );
1241 connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); 1241 connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) );
1242 connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); 1242 connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) );
1243 connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); 1243 connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) );
1244} 1244}
1245 1245
1246void KToolBar::mousePressEvent ( QMouseEvent *m ) 1246void KToolBar::mousePressEvent ( QMouseEvent *m )
1247{ 1247{
1248 if ( !mainWindow() ) 1248 if ( !mainWindow() )
1249 return; 1249 return;
1250 QMainWindow *mw = mainWindow(); 1250 QMainWindow *mw = mainWindow();
1251 if ( mw->toolBarsMovable() && d->m_enableContext ) { 1251 if ( mw->toolBarsMovable() && d->m_enableContext ) {
1252 if ( m->button() == RightButton ) { 1252 if ( m->button() == RightButton ) {
1253 int i = contextMenu()->exec( m->globalPos(), 0 ); 1253 int i = contextMenu()->exec( m->globalPos(), 0 );
1254 switch ( i ) { 1254 switch ( i ) {
1255 case -1: 1255 case -1:
1256 return; // popup cancelled 1256 return; // popup cancelled
1257 case CONTEXT_LEFT: 1257 case CONTEXT_LEFT:
1258//US mw->moveDockWindow( this, DockLeft ); 1258//US mw->moveDockWindow( this, DockLeft );
1259 mw->moveToolBar( this, QMainWindow::Left ); 1259 mw->moveToolBar( this, QMainWindow::Left );
1260 break; 1260 break;
1261 case CONTEXT_RIGHT: 1261 case CONTEXT_RIGHT:
1262//US mw->moveDockWindow( this, DockRight ); 1262//US mw->moveDockWindow( this, DockRight );
1263 mw->moveToolBar( this, QMainWindow::Right ); 1263 mw->moveToolBar( this, QMainWindow::Right );
1264 break; 1264 break;
1265 case CONTEXT_TOP: 1265 case CONTEXT_TOP:
1266//US mw->moveDockWindow( this, DockTop ); 1266//US mw->moveDockWindow( this, DockTop );
1267 mw->moveToolBar( this, QMainWindow::Top ); 1267 mw->moveToolBar( this, QMainWindow::Top );
1268 break; 1268 break;
1269 case CONTEXT_BOTTOM: 1269 case CONTEXT_BOTTOM:
1270//US mw->moveDockWindow( this, DockBottom ); 1270//US mw->moveDockWindow( this, DockBottom );
1271 mw->moveToolBar( this, QMainWindow::Bottom ); 1271 mw->moveToolBar( this, QMainWindow::Bottom );
1272 break; 1272 break;
1273 case CONTEXT_FLOAT: 1273 case CONTEXT_FLOAT:
1274 break; 1274 break;
1275 case CONTEXT_FLAT: 1275 case CONTEXT_FLAT:
1276//US mw->moveDockWindow( this, DockMinimized ); 1276//US mw->moveDockWindow( this, DockMinimized );
1277 mw->moveToolBar( this, QMainWindow::Minimized ); 1277 mw->moveToolBar( this, QMainWindow::Minimized );
1278 break; 1278 break;
1279 case CONTEXT_ICONS: 1279 case CONTEXT_ICONS:
1280 setIconText( IconOnly ); 1280 setIconText( IconOnly );
1281 break; 1281 break;
1282 case CONTEXT_TEXTRIGHT: 1282 case CONTEXT_TEXTRIGHT:
1283 setIconText( IconTextRight ); 1283 setIconText( IconTextRight );
1284 break; 1284 break;
1285 case CONTEXT_TEXT: 1285 case CONTEXT_TEXT:
1286 setIconText( TextOnly ); 1286 setIconText( TextOnly );
1287 break; 1287 break;
1288 case CONTEXT_TEXTUNDER: 1288 case CONTEXT_TEXTUNDER:
1289 setIconText( IconTextBottom ); 1289 setIconText( IconTextBottom );
1290 break; 1290 break;
1291 default: 1291 default:
1292 if ( i >= CONTEXT_ICONSIZES ) 1292 if ( i >= CONTEXT_ICONSIZES )
1293 setIconSize( i - CONTEXT_ICONSIZES ); 1293 setIconSize( i - CONTEXT_ICONSIZES );
1294 else 1294 else
1295 return; // assume this was an action handled elsewhere, no need for setSettingsDirty() 1295 return; // assume this was an action handled elsewhere, no need for setSettingsDirty()
1296 } 1296 }
1297/*US 1297/*US
1298 if ( mw->inherits("KMainWindow") ) 1298 if ( mw->inherits("KMainWindow") )
1299 static_cast<KMainWindow *>(mw)->setSettingsDirty(); 1299 static_cast<KMainWindow *>(mw)->setSettingsDirty();
1300*/ 1300*/
1301 } 1301 }
1302 } 1302 }
1303} 1303}
1304 1304
1305 1305
1306void KToolBar::rebuildLayout() 1306void KToolBar::rebuildLayout()
1307{ 1307{
1308 1308
1309 for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) 1309 for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
1310 w->blockSignals(false); 1310 w->blockSignals(false);
1311 d->idleButtons.clear(); 1311 d->idleButtons.clear();
1312 1312
1313 layoutTimer->stop(); 1313 layoutTimer->stop();
1314 QApplication::sendPostedEvents( this, QEvent::ChildInserted ); 1314 QApplication::sendPostedEvents( this, QEvent::ChildInserted );
1315 QBoxLayout *l = boxLayout(); 1315 QBoxLayout *l = boxLayout();
1316 l->setMargin( 1 ); 1316 l->setMargin( 1 );
1317 // clear the old layout 1317 // clear the old layout
1318 QLayoutIterator it = l->iterator(); 1318 QLayoutIterator it = l->iterator();
1319 1319
1320 while ( it.current() ) { 1320 while ( it.current() ) {
1321 it.deleteCurrent(); 1321 it.deleteCurrent();
1322 } 1322 }
1323 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { 1323 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
1324 if ( w == rightAligned ) { 1324 if ( w == rightAligned ) {
1325 continue; 1325 continue;
1326 } 1326 }
1327 if ( w->inherits( "KToolBarSeparator" ) && 1327 if ( w->inherits( "KToolBarSeparator" ) &&
1328 !( (KToolBarSeparator*)w )->showLine() ) { 1328 !( (KToolBarSeparator*)w )->showLine() ) {
1329 l->addSpacing( 6 ); 1329 l->addSpacing( 6 );
1330 w->hide(); 1330 w->hide();
1331 continue; 1331 continue;
1332 } 1332 }
1333 if ( w->inherits( "QPopupMenu" ) ) 1333 if ( w->inherits( "QPopupMenu" ) )
1334 continue; 1334 continue;
1335 l->addWidget( w ); 1335 l->addWidget( w );
1336 w->show(); 1336 w->show();
1337 } 1337 }
1338 if ( rightAligned ) { 1338 if ( rightAligned ) {
1339 l->addStretch(); 1339 l->addStretch();
1340 l->addWidget( rightAligned ); 1340 l->addWidget( rightAligned );
1341 rightAligned->show(); 1341 rightAligned->show();
1342 } 1342 }
1343 1343
1344 if ( fullSize() ) { 1344 if ( fullSize() ) {
1345 // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). 1345 // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword).
1346 //if ( !stretchableWidget && widgets.last() && 1346 //if ( !stretchableWidget && widgets.last() &&
1347 // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) 1347 // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) )
1348 // setStretchableWidget( widgets.last() ); 1348 // setStretchableWidget( widgets.last() );
1349 if ( !rightAligned ) 1349 if ( !rightAligned )
1350 l->addStretch(); 1350 l->addStretch();
1351 if ( stretchableWidget ) 1351 if ( stretchableWidget )
1352 l->setStretchFactor( stretchableWidget, 10 ); 1352 l->setStretchFactor( stretchableWidget, 10 );
1353 } 1353 }
1354 l->invalidate(); 1354 l->invalidate();
1355 QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); 1355 QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
1356 //#endif //DESKTOP_VERSION 1356 //#endif //DESKTOP_VERSION
1357} 1357}
1358 1358
1359void KToolBar::childEvent( QChildEvent *e ) 1359void KToolBar::childEvent( QChildEvent *e )
1360{ 1360{
1361 1361
1362 if ( e->child()->isWidgetType() ) { 1362 if ( e->child()->isWidgetType() ) {
1363 QWidget * w = (QWidget*)e->child(); 1363 QWidget * w = (QWidget*)e->child();
1364 if ( e->type() == QEvent::ChildInserted ) { 1364 if ( e->type() == QEvent::ChildInserted ) {
1365 if ( !e->child()->inherits( "QPopupMenu" ) && 1365 if ( !e->child()->inherits( "QPopupMenu" ) &&
1366 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { 1366 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
1367 1367
1368 // prevent items that have been explicitly inserted by insert*() from 1368 // prevent items that have been explicitly inserted by insert*() from
1369 // being inserted again 1369 // being inserted again
1370 if ( !widget2id.contains( w ) ) 1370 if ( !widget2id.contains( w ) )
1371 { 1371 {
1372 int dummy = -1; 1372 int dummy = -1;
1373 insertWidgetInternal( w, dummy, -1 ); 1373 insertWidgetInternal( w, dummy, -1 );
1374 } 1374 }
1375 } 1375 }
1376 } else { 1376 } else {
1377 removeWidgetInternal( w ); 1377 removeWidgetInternal( w );
1378 } 1378 }
1379 if ( isVisibleTo( 0 ) ) 1379 if ( isVisibleTo( 0 ) )
1380 { 1380 {
1381 QBoxLayout *l = boxLayout(); 1381 QBoxLayout *l = boxLayout();
1382 // QLayout *l = layout(); 1382 // QLayout *l = layout();
1383 1383
1384 // clear the old layout so that we don't get unnecassery layout 1384 // clear the old layout so that we don't get unnecassery layout
1385 // changes till we have rebuild the thing 1385 // changes till we have rebuild the thing
1386 QLayoutIterator it = l->iterator(); 1386 QLayoutIterator it = l->iterator();
1387 while ( it.current() ) { 1387 while ( it.current() ) {
1388 it.deleteCurrent(); 1388 it.deleteCurrent();
1389 } 1389 }
1390 layoutTimer->start( 50, TRUE ); 1390 layoutTimer->start( 50, TRUE );
1391 } 1391 }
1392 } 1392 }
1393 QToolBar::childEvent( e ); 1393 QToolBar::childEvent( e );
1394} 1394}
1395 1395
1396void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) 1396void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
1397{ 1397{
1398 // we can't have it in widgets, or something is really wrong 1398 // we can't have it in widgets, or something is really wrong
1399 //widgets.removeRef( w ); 1399 //widgets.removeRef( w );
1400 1400
1401 connect( w, SIGNAL( destroyed() ), 1401 connect( w, SIGNAL( destroyed() ),
1402 this, SLOT( widgetDestroyed() ) ); 1402 this, SLOT( widgetDestroyed() ) );
1403 if ( index == -1 || index > (int)widgets.count() ) { 1403 if ( index == -1 || index > (int)widgets.count() ) {
1404 widgets.append( w ); 1404 widgets.append( w );
1405 index = (int)widgets.count(); 1405 index = (int)widgets.count();
1406 } 1406 }
1407 else 1407 else
1408 widgets.insert( index, w ); 1408 widgets.insert( index, w );
1409 if ( id == -1 ) 1409 if ( id == -1 )
1410 id = id2widget.count(); 1410 id = id2widget.count();
1411 id2widget.insert( id, w ); 1411 id2widget.insert( id, w );
1412 widget2id.insert( w, id ); 1412 widget2id.insert( w, id );
1413} 1413}
1414void KToolBar::repaintMe() 1414void KToolBar::repaintMe()
1415{ 1415{
1416 setUpdatesEnabled( true ); 1416 setUpdatesEnabled( true );
1417 QToolBar::repaint( true ); 1417 QToolBar::repaint( true );
1418 //qDebug(" KToolBar::repaintMe() "); 1418 qDebug(" KToolBar::repaintMe() ");
1419} 1419}
1420 1420
1421void KToolBar::showEvent( QShowEvent *e ) 1421void KToolBar::showEvent( QShowEvent *e )
1422{ 1422{
1423 QToolBar::showEvent( e );
1424 rebuildLayout(); 1423 rebuildLayout();
1424 QToolBar::showEvent( e );
1425} 1425}
1426 1426
1427void KToolBar::setStretchableWidget( QWidget *w ) 1427void KToolBar::setStretchableWidget( QWidget *w )
1428{ 1428{
1429 QToolBar::setStretchableWidget( w ); 1429 QToolBar::setStretchableWidget( w );
1430 stretchableWidget = w; 1430 stretchableWidget = w;
1431} 1431}
1432 1432
1433QSizePolicy KToolBar::sizePolicy() const 1433QSizePolicy KToolBar::sizePolicy() const
1434{ 1434{
1435 if ( orientation() == Horizontal ) 1435 if ( orientation() == Horizontal )
1436 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); 1436 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
1437 else 1437 else
1438 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 1438 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
1439} 1439}
1440 1440
1441QSize KToolBar::sizeHint() const 1441QSize KToolBar::sizeHint() const
1442{ 1442{
1443 return QToolBar::sizeHint(); 1443 return QToolBar::sizeHint();
1444#if 0 1444#if 0
1445 QWidget::polish(); 1445 QWidget::polish();
1446 static int iii = 0; 1446 static int iii = 0;
1447 ++iii; 1447 ++iii;
1448 qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); 1448 qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
1449 int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); 1449 int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
1450 switch( barPos() ) 1450 switch( barPos() )
1451 { 1451 {
1452 case KToolBar::Top: 1452 case KToolBar::Top:
1453 case KToolBar::Bottom: 1453 case KToolBar::Bottom:
1454 for ( QWidget *w = widgets.first(); w; w =widgets.next() ) 1454 for ( QWidget *w = widgets.first(); w; w =widgets.next() )
1455 { 1455 {
1456 if ( w->inherits( "KToolBarSeparator" ) && 1456 if ( w->inherits( "KToolBarSeparator" ) &&
1457 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1457 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1458 { 1458 {
1459 minSize += QSize(6, 0); 1459 minSize += QSize(6, 0);
1460 } 1460 }
1461 else 1461 else
1462 { 1462 {
1463 QSize sh = w->sizeHint(); 1463 QSize sh = w->sizeHint();
1464 if (!sh.isValid()) 1464 if (!sh.isValid())
1465 sh = w->minimumSize(); 1465 sh = w->minimumSize();
1466 minSize = minSize.expandedTo(QSize(0, sh.height())); 1466 minSize = minSize.expandedTo(QSize(0, sh.height()));
1467 minSize += QSize(sh.width()+1, 0); 1467 minSize += QSize(sh.width()+1, 0);
1468 } 1468 }
1469 } 1469 }
1470/*US 1470/*US
1471 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); 1471 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0);
1472*/ 1472*/
1473 minSize += QSize(margin*2, margin*2); 1473 minSize += QSize(margin*2, margin*2);
1474 break; 1474 break;
1475 1475
1476 case KToolBar::Left: 1476 case KToolBar::Left:
1477 case KToolBar::Right: 1477 case KToolBar::Right:
1478 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) 1478 for ( QWidget *w = widgets.first(); w; w = widgets.next() )
1479 { 1479 {
1480 if ( w->inherits( "KToolBarSeparator" ) && 1480 if ( w->inherits( "KToolBarSeparator" ) &&
1481 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1481 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1482 { 1482 {
1483 minSize += QSize(0, 6); 1483 minSize += QSize(0, 6);
1484 } 1484 }
1485 else 1485 else
1486 { 1486 {
1487 QSize sh = w->sizeHint(); 1487 QSize sh = w->sizeHint();
1488 if (!sh.isValid()) 1488 if (!sh.isValid())
1489 sh = w->minimumSize(); 1489 sh = w->minimumSize();
1490 minSize = minSize.expandedTo(QSize(sh.width(), 0)); 1490 minSize = minSize.expandedTo(QSize(sh.width(), 0));
1491 minSize += QSize(0, sh.height()+1); 1491 minSize += QSize(0, sh.height()+1);
1492 } 1492 }
1493 } 1493 }
1494/*US 1494/*US
1495 minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); 1495 minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
1496*/ 1496*/
1497 minSize += QSize(margin*2, margin*2); 1497 minSize += QSize(margin*2, margin*2);
1498 break; 1498 break;
1499 1499
1500 default: 1500 default:
1501 minSize = QToolBar::sizeHint(); 1501 minSize = QToolBar::sizeHint();
1502 break; 1502 break;
1503 } 1503 }
1504 return minSize; 1504 return minSize;
1505#endif 1505#endif
1506} 1506}
1507 1507
1508QSize KToolBar::minimumSize() const 1508QSize KToolBar::minimumSize() const
1509{ 1509{
1510 return minimumSizeHint(); 1510 return minimumSizeHint();
1511} 1511}
1512 1512
1513QSize KToolBar::minimumSizeHint() const 1513QSize KToolBar::minimumSizeHint() const
1514{ 1514{
1515 return sizeHint(); 1515 return sizeHint();
1516} 1516}
1517 1517
1518bool KToolBar::highlight() const 1518bool KToolBar::highlight() const
1519{ 1519{
1520 return d->m_highlight; 1520 return d->m_highlight;
1521} 1521}
1522 1522
1523void KToolBar::hide() 1523void KToolBar::hide()
1524{ 1524{
1525 QToolBar::hide(); 1525 QToolBar::hide();
1526} 1526}
1527 1527
1528void KToolBar::show() 1528void KToolBar::show()
1529{ 1529{
1530 QToolBar::show(); 1530 QToolBar::show();
1531} 1531}
1532 1532
1533void KToolBar::resizeEvent( QResizeEvent *e ) 1533void KToolBar::resizeEvent( QResizeEvent *e )
1534{ 1534{
1535 bool b = isUpdatesEnabled(); 1535 bool b = isUpdatesEnabled();
1536 setUpdatesEnabled( FALSE ); 1536 setUpdatesEnabled( FALSE );
1537 QToolBar::resizeEvent( e ); 1537 QToolBar::resizeEvent( e );
1538 if (b) 1538 if (b)
1539 d->repaintTimer.start( 100, true ); 1539 d->repaintTimer.start( 100, true );
1540} 1540}
1541 1541
1542void KToolBar::slotIconChanged(int group) 1542void KToolBar::slotIconChanged(int group)
1543{ 1543{
1544 if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) 1544 if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
1545 return; 1545 return;
1546 if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) 1546 if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
1547 return; 1547 return;
1548 1548
1549 emit modechange(); 1549 emit modechange();
1550 if (isVisible()) 1550 if (isVisible())
1551 updateGeometry(); 1551 updateGeometry();
1552} 1552}
1553 1553
1554void KToolBar::slotReadConfig() 1554void KToolBar::slotReadConfig()
1555{ 1555{
1556 //kdDebug(220) << "KToolBar::slotReadConfig" << endl; 1556 //kdDebug(220) << "KToolBar::slotReadConfig" << endl;
1557 // Read appearance settings (hmm, we used to do both here, 1557 // Read appearance settings (hmm, we used to do both here,
1558 // but a well behaved application will call applyMainWindowSettings 1558 // but a well behaved application will call applyMainWindowSettings
1559 // anyway, right ?) 1559 // anyway, right ?)
1560 applyAppearanceSettings(KGlobal::config(), QString::null ); 1560 applyAppearanceSettings(KGlobal::config(), QString::null );
1561} 1561}
1562 1562
1563void KToolBar::slotAppearanceChanged() 1563void KToolBar::slotAppearanceChanged()
1564{ 1564{
1565 // Read appearance settings from global file. 1565 // Read appearance settings from global file.
1566 applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); 1566 applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ );
1567 // And remember to save the new look later 1567 // And remember to save the new look later
1568/*US 1568/*US
1569 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) 1569 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
1570 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); 1570 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
1571*/ 1571*/
1572} 1572}
1573 1573
1574//static 1574//static
1575bool KToolBar::highlightSetting() 1575bool KToolBar::highlightSetting()
1576{ 1576{
1577 QString grpToolbar(QString::fromLatin1("Toolbar style")); 1577 QString grpToolbar(QString::fromLatin1("Toolbar style"));
1578 KConfigGroupSaver saver(KGlobal::config(), grpToolbar); 1578 KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
1579 return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); 1579 return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true);
1580} 1580}
1581 1581
1582//static 1582//static
1583bool KToolBar::transparentSetting() 1583bool KToolBar::transparentSetting()
1584{ 1584{
1585 QString grpToolbar(QString::fromLatin1("Toolbar style")); 1585 QString grpToolbar(QString::fromLatin1("Toolbar style"));
1586 KConfigGroupSaver saver(KGlobal::config(), grpToolbar); 1586 KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
1587 return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); 1587 return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true);
1588} 1588}
1589 1589
1590//static 1590//static
1591KToolBar::IconText KToolBar::iconTextSetting() 1591KToolBar::IconText KToolBar::iconTextSetting()
1592{ 1592{
1593 QString grpToolbar(QString::fromLatin1("Toolbar style")); 1593 QString grpToolbar(QString::fromLatin1("Toolbar style"));
1594 KConfigGroupSaver saver(KGlobal::config(), grpToolbar); 1594 KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
1595 QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); 1595 QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly"));
1596 if ( icontext == "IconTextRight" ) 1596 if ( icontext == "IconTextRight" )
1597 return IconTextRight; 1597 return IconTextRight;
1598 else if ( icontext == "IconTextBottom" ) 1598 else if ( icontext == "IconTextBottom" )
1599 return IconTextBottom; 1599 return IconTextBottom;
1600 else if ( icontext == "TextOnly" ) 1600 else if ( icontext == "TextOnly" )
1601 return TextOnly; 1601 return TextOnly;
1602 else 1602 else
1603 return IconOnly; 1603 return IconOnly;
1604} 1604}
1605 1605
1606void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) 1606void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal)
1607{ 1607{
1608 return; 1608 return;
1609 QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; 1609 QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
1610 //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; 1610 //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl;
1611 // We have application-specific settings in the XML file, 1611 // We have application-specific settings in the XML file,
1612 // and nothing in the application's config file 1612 // and nothing in the application's config file
1613 // -> don't apply the global defaults, the XML ones are preferred 1613 // -> don't apply the global defaults, the XML ones are preferred
1614 // See applySettings for a full explanation 1614 // See applySettings for a full explanation
1615/*US :we do not support xml files 1615/*US :we do not support xml files
1616 if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && 1616 if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() &&
1617 !config->hasGroup(configGroup) ) 1617 !config->hasGroup(configGroup) )
1618 { 1618 {
1619 //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; 1619 //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl;
1620 return; 1620 return;
1621 } 1621 }
1622*/ 1622*/
1623 if ( !config->hasGroup(configGroup) ) 1623 if ( !config->hasGroup(configGroup) )
1624 { 1624 {
1625 //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; 1625 //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl;
1626 return; 1626 return;
1627 } 1627 }
1628 1628
1629 1629
1630 KConfig *gconfig = KGlobal::config(); 1630 KConfig *gconfig = KGlobal::config();
1631/*US 1631/*US
1632 static const QString &attrIconText = KGlobal::staticQString("IconText"); 1632 static const QString &attrIconText = KGlobal::staticQString("IconText");
1633 static const QString &attrHighlight = KGlobal::staticQString("Highlighting"); 1633 static const QString &attrHighlight = KGlobal::staticQString("Highlighting");
1634 static const QString &attrTrans = KGlobal::staticQString("TransparentMoving"); 1634 static const QString &attrTrans = KGlobal::staticQString("TransparentMoving");
1635 static const QString &attrSize = KGlobal::staticQString("IconSize"); 1635 static const QString &attrSize = KGlobal::staticQString("IconSize");
1636*/ 1636*/
1637 // we actually do this in two steps. 1637 // we actually do this in two steps.
1638 // First, we read in the global styles [Toolbar style] (from the KControl module). 1638 // First, we read in the global styles [Toolbar style] (from the KControl module).
1639 // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style] 1639 // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style]
1640 bool highlight; 1640 bool highlight;
1641 int transparent; 1641 int transparent;
1642 QString icontext; 1642 QString icontext;
1643 int iconsize = 0; 1643 int iconsize = 0;
1644 1644
1645 // this is the first iteration 1645 // this is the first iteration
1646 QString grpToolbar(QString::fromLatin1("Toolbar style")); 1646 QString grpToolbar(QString::fromLatin1("Toolbar style"));
1647 { // start block for KConfigGroupSaver 1647 { // start block for KConfigGroupSaver
1648 KConfigGroupSaver saver(gconfig, grpToolbar); 1648 KConfigGroupSaver saver(gconfig, grpToolbar);
1649 1649
1650 // first, get the generic settings 1650 // first, get the generic settings
1651//US highlight = gconfig->readBoolEntry(attrHighlight, true); 1651//US highlight = gconfig->readBoolEntry(attrHighlight, true);
1652 highlight = gconfig->readBoolEntry("Highlighting", true); 1652 highlight = gconfig->readBoolEntry("Highlighting", true);
1653//US transparent = gconfig->readBoolEntry(attrTrans, true); 1653//US transparent = gconfig->readBoolEntry(attrTrans, true);
1654 transparent = gconfig->readBoolEntry("TransparentMoving", true); 1654 transparent = gconfig->readBoolEntry("TransparentMoving", true);
1655 1655
1656 // we read in the IconText property *only* if we intend on actually 1656 // we read in the IconText property *only* if we intend on actually
1657 // honoring it 1657 // honoring it
1658 if (d->m_honorStyle) 1658 if (d->m_honorStyle)
1659//US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault); 1659//US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault);
1660 d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault); 1660 d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault);
1661 else 1661 else
1662 d->IconTextDefault = "IconOnly"; 1662 d->IconTextDefault = "IconOnly";
1663 1663
1664 // Use the default icon size for toolbar icons. 1664 // Use the default icon size for toolbar icons.
1665//US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault); 1665//US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault);
1666 d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault); 1666 d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault);
1667 1667
1668 if ( !forceGlobal && config->hasGroup(configGroup) ) 1668 if ( !forceGlobal && config->hasGroup(configGroup) )
1669 { 1669 {
1670 config->setGroup(configGroup); 1670 config->setGroup(configGroup);
1671 1671
1672 // first, get the generic settings 1672 // first, get the generic settings
1673//US highlight = config->readBoolEntry(attrHighlight, highlight); 1673//US highlight = config->readBoolEntry(attrHighlight, highlight);
1674 highlight = config->readBoolEntry("Highlighting", highlight); 1674 highlight = config->readBoolEntry("Highlighting", highlight);
1675//US transparent = config->readBoolEntry(attrTrans, transparent); 1675//US transparent = config->readBoolEntry(attrTrans, transparent);
1676 transparent = config->readBoolEntry("TransparentMoving", transparent); 1676 transparent = config->readBoolEntry("TransparentMoving", transparent);
1677 // now we always read in the IconText property 1677 // now we always read in the IconText property
1678//US icontext = config->readEntry(attrIconText, d->IconTextDefault); 1678//US icontext = config->readEntry(attrIconText, d->IconTextDefault);
1679 icontext = config->readEntry("IconText", d->IconTextDefault); 1679 icontext = config->readEntry("IconText", d->IconTextDefault);
1680 1680
1681 // now get the size 1681 // now get the size
1682//US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault); 1682//US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault);
1683 iconsize = config->readNumEntry("IconSize", d->IconSizeDefault); 1683 iconsize = config->readNumEntry("IconSize", d->IconSizeDefault);
1684 } 1684 }
1685 else 1685 else
1686 { 1686 {
1687 iconsize = d->IconSizeDefault; 1687 iconsize = d->IconSizeDefault;
1688 icontext = d->IconTextDefault; 1688 icontext = d->IconTextDefault;
1689 } 1689 }
1690 1690
1691 // revert back to the old group 1691 // revert back to the old group
1692 } // end block for KConfigGroupSaver 1692 } // end block for KConfigGroupSaver
1693 1693
1694 bool doUpdate = false; 1694 bool doUpdate = false;
1695 1695
1696 IconText icon_text; 1696 IconText icon_text;
1697 if ( icontext == "IconTextRight" ) 1697 if ( icontext == "IconTextRight" )
1698 icon_text = IconTextRight; 1698 icon_text = IconTextRight;
1699 else if ( icontext == "IconTextBottom" ) 1699 else if ( icontext == "IconTextBottom" )
1700 icon_text = IconTextBottom; 1700 icon_text = IconTextBottom;
1701 else if ( icontext == "TextOnly" ) 1701 else if ( icontext == "TextOnly" )
1702 icon_text = TextOnly; 1702 icon_text = TextOnly;
1703 else 1703 else
1704 icon_text = IconOnly; 1704 icon_text = IconOnly;
1705 1705
1706 // check if the icon/text has changed 1706 // check if the icon/text has changed
1707 if (icon_text != d->m_iconText) { 1707 if (icon_text != d->m_iconText) {
1708 //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; 1708 //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl;
1709 setIconText(icon_text, false); 1709 setIconText(icon_text, false);
1710 doUpdate = true; 1710 doUpdate = true;
1711 } 1711 }
1712 1712
1713 // ...and check if the icon size has changed 1713 // ...and check if the icon size has changed
1714 if (iconsize != d->m_iconSize) { 1714 if (iconsize != d->m_iconSize) {
1715 setIconSize(iconsize, false); 1715 setIconSize(iconsize, false);
1716 doUpdate = true; 1716 doUpdate = true;
1717 } 1717 }
1718 1718
1719 QMainWindow *mw = mainWindow(); 1719 QMainWindow *mw = mainWindow();
1720 1720
1721 // ...and if we should highlight 1721 // ...and if we should highlight
1722 if ( highlight != d->m_highlight ) { 1722 if ( highlight != d->m_highlight ) {
1723 d->m_highlight = highlight; 1723 d->m_highlight = highlight;
1724 doUpdate = true; 1724 doUpdate = true;
1725 } 1725 }
1726 1726
1727 // ...and if we should move transparently 1727 // ...and if we should move transparently
1728 if ( mw && transparent != (!mw->opaqueMoving()) ) { 1728 if ( mw && transparent != (!mw->opaqueMoving()) ) {
1729 mw->setOpaqueMoving( !transparent ); 1729 mw->setOpaqueMoving( !transparent );
1730 } 1730 }
1731 1731
1732 if (doUpdate) 1732 if (doUpdate)
1733 emit modechange(); // tell buttons what happened 1733 emit modechange(); // tell buttons what happened
1734 if (isVisible ()) 1734 if (isVisible ())
1735 updateGeometry(); 1735 updateGeometry();
1736} 1736}
1737 1737
1738void KToolBar::applySettings(KConfig *config, const QString &_configGroup) 1738void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
1739{ 1739{
1740 //kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl; 1740 //kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl;
1741 1741
1742 QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; 1742 QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
1743 1743
1744 /* 1744 /*
1745 Let's explain this a bit more in details. 1745 Let's explain this a bit more in details.
1746 The order in which we apply settings is : 1746 The order in which we apply settings is :
1747 Global config / <appnamerc> user settings if no XMLGUI is used 1747 Global config / <appnamerc> user settings if no XMLGUI is used
1748 Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used 1748 Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used
1749 1749
1750 So in the first case, we simply read everything from KConfig as below, 1750 So in the first case, we simply read everything from KConfig as below,
1751 but in the second case we don't do anything here if there is no app-specific config, 1751 but in the second case we don't do anything here if there is no app-specific config,
1752 and the XMLGUI uses the static methods of this class to get the global defaults. 1752 and the XMLGUI uses the static methods of this class to get the global defaults.
1753 1753
1754 Global config doesn't include position (index, offset, newline and hidden/shown). 1754 Global config doesn't include position (index, offset, newline and hidden/shown).
1755 */ 1755 */
1756 1756
1757 // First the appearance stuff - the one which has a global config 1757 // First the appearance stuff - the one which has a global config
1758 applyAppearanceSettings( config, _configGroup ); 1758 applyAppearanceSettings( config, _configGroup );
1759 1759
1760 // ...and now the position stuff 1760 // ...and now the position stuff
1761 if ( config->hasGroup(configGroup) ) 1761 if ( config->hasGroup(configGroup) )
1762 { 1762 {
1763 KConfigGroupSaver cgs(config, configGroup); 1763 KConfigGroupSaver cgs(config, configGroup);
1764/*US 1764/*US
1765 static const QString &attrPosition = KGlobal::staticQString("Position"); 1765 static const QString &attrPosition = KGlobal::staticQString("Position");
1766 static const QString &attrIndex = KGlobal::staticQString("Index"); 1766 static const QString &attrIndex = KGlobal::staticQString("Index");
1767 static const QString &attrOffset = KGlobal::staticQString("Offset"); 1767 static const QString &attrOffset = KGlobal::staticQString("Offset");
1768 static const QString &attrNewLine = KGlobal::staticQString("NewLine"); 1768 static const QString &attrNewLine = KGlobal::staticQString("NewLine");
1769 static const QString &attrHidden = KGlobal::staticQString("Hidden"); 1769 static const QString &attrHidden = KGlobal::staticQString("Hidden");
1770 1770
1771 QString position = config->readEntry(attrPosition, d->PositionDefault); 1771 QString position = config->readEntry(attrPosition, d->PositionDefault);
1772 int index = config->readNumEntry(attrIndex, d->IndexDefault); 1772 int index = config->readNumEntry(attrIndex, d->IndexDefault);
1773 int offset = config->readNumEntry(attrOffset, d->OffsetDefault); 1773 int offset = config->readNumEntry(attrOffset, d->OffsetDefault);
1774 bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault); 1774 bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault);
1775 bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault); 1775 bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault);
1776*/ 1776*/
1777 1777
1778 QString position = config->readEntry("Position", d->PositionDefault); 1778 QString position = config->readEntry("Position", d->PositionDefault);
1779 int index = config->readNumEntry("Index", d->IndexDefault); 1779 int index = config->readNumEntry("Index", d->IndexDefault);
1780 int offset = config->readNumEntry("Offset", d->OffsetDefault); 1780 int offset = config->readNumEntry("Offset", d->OffsetDefault);
1781 bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault); 1781 bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault);
1782 bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault); 1782 bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault);
1783 1783
1784/*US Dock pos(DockTop); 1784/*US Dock pos(DockTop);
1785 if ( position == "Top" ) 1785 if ( position == "Top" )
1786 pos = DockTop; 1786 pos = DockTop;
1787 else if ( position == "Bottom" ) 1787 else if ( position == "Bottom" )
1788 pos = DockBottom; 1788 pos = DockBottom;
1789 else if ( position == "Left" ) 1789 else if ( position == "Left" )
1790 pos = DockLeft; 1790 pos = DockLeft;
1791 else if ( position == "Right" ) 1791 else if ( position == "Right" )
1792 pos = DockRight; 1792 pos = DockRight;
1793 else if ( position == "Floating" ) 1793 else if ( position == "Floating" )
1794 pos = DockTornOff; 1794 pos = DockTornOff;
1795 else if ( position == "Flat" ) 1795 else if ( position == "Flat" )
1796 pos = DockMinimized; 1796 pos = DockMinimized;
1797*/ 1797*/
1798 QMainWindow::ToolBarDock pos(QMainWindow::Top); 1798 QMainWindow::ToolBarDock pos(QMainWindow::Top);
1799 if ( position == "Top" ) 1799 if ( position == "Top" )
1800 pos = QMainWindow::Top; 1800 pos = QMainWindow::Top;
1801 else if ( position == "Bottom" ) 1801 else if ( position == "Bottom" )
1802 pos = QMainWindow::Bottom; 1802 pos = QMainWindow::Bottom;
1803 else if ( position == "Left" ) 1803 else if ( position == "Left" )
1804 pos = QMainWindow::Left; 1804 pos = QMainWindow::Left;
1805 else if ( position == "Right" ) 1805 else if ( position == "Right" )
1806 pos = QMainWindow::Right; 1806 pos = QMainWindow::Right;
1807 else if ( position == "Floating" ) 1807 else if ( position == "Floating" )
1808 pos = QMainWindow::TornOff; 1808 pos = QMainWindow::TornOff;
1809 else if ( position == "Flat" ) 1809 else if ( position == "Flat" )
1810 pos = QMainWindow::Minimized; 1810 pos = QMainWindow::Minimized;
1811 1811
1812 //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; 1812 //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl;
1813 if (hidden) 1813 if (hidden)
1814 hide(); 1814 hide();
1815 else 1815 else
1816 show(); 1816 show();
1817 1817
1818 if ( mainWindow() ) 1818 if ( mainWindow() )
1819 { 1819 {
1820 QMainWindow *mw = mainWindow(); 1820 QMainWindow *mw = mainWindow();
1821 1821
1822 //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; 1822 //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl;
1823 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); 1823 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset );
1824 1824
1825 // moveDockWindow calls QDockArea which does a reparent() on us with 1825 // moveDockWindow calls QDockArea which does a reparent() on us with
1826 // showIt = true, so we loose our visibility status 1826 // showIt = true, so we loose our visibility status
1827 bool doHide = isHidden(); 1827 bool doHide = isHidden();
1828 1828
1829//US mw->moveDockWindow( this, pos, newLine, index, offset ); 1829//US mw->moveDockWindow( this, pos, newLine, index, offset );
1830 mw->moveToolBar( this, pos, newLine, index, offset ); 1830 mw->moveToolBar( this, pos, newLine, index, offset );
1831 1831
1832 //kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl; 1832 //kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl;
1833 if ( doHide ) 1833 if ( doHide )
1834 hide(); 1834 hide();
1835 } 1835 }
1836 if (isVisible ()) 1836 if (isVisible ())
1837 updateGeometry(); 1837 updateGeometry();
1838 } 1838 }
1839} 1839}
1840 1840
1841bool KToolBar::event( QEvent *e ) 1841bool KToolBar::event( QEvent *e )
1842{ 1842{
1843 if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() ) 1843 if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() )
1844 d->repaintTimer.start( 100, true ); 1844 d->repaintTimer.start( 100, true );
1845 1845
1846 if (e->type() == QEvent::ChildInserted ) 1846 if (e->type() == QEvent::ChildInserted )
1847 { 1847 {
1848 // By pass QToolBar::event, 1848 // By pass QToolBar::event,
1849 // it will show() the inserted child and we don't want to 1849 // it will show() the inserted child and we don't want to
1850 // do that until we have rebuild the layout. 1850 // do that until we have rebuild the layout.
1851 childEvent((QChildEvent *)e); 1851 childEvent((QChildEvent *)e);
1852 return true; 1852 return true;
1853 } 1853 }
1854 1854
1855 return QToolBar::event( e ); 1855 return QToolBar::event( e );
1856} 1856}
1857 1857
1858void KToolBar::slotRepaint() 1858void KToolBar::slotRepaint()
1859{ 1859{
1860 setUpdatesEnabled( FALSE ); 1860 setUpdatesEnabled( FALSE );
1861 // Send a resizeEvent to update the "toolbar extension arrow" 1861 // Send a resizeEvent to update the "toolbar extension arrow"
1862 // (The button you get when your toolbar-items don't fit in 1862 // (The button you get when your toolbar-items don't fit in
1863 // the available space) 1863 // the available space)
1864 QResizeEvent ev(size(), size()); 1864 QResizeEvent ev(size(), size());
1865 resizeEvent(&ev); 1865 resizeEvent(&ev);
1866 //#ifdef DESKTOP_VERSION 1866 //#ifdef DESKTOP_VERSION
1867 QApplication::sendPostedEvents( this, QEvent::LayoutHint ); 1867 QApplication::sendPostedEvents( this, QEvent::LayoutHint );
1868 //#endif //DESKTOP_VERSION 1868 //#endif //DESKTOP_VERSION
1869 setUpdatesEnabled( TRUE ); 1869 setUpdatesEnabled( TRUE );
1870 repaint( TRUE ); 1870 repaint( TRUE );
1871} 1871}
1872 1872
1873void KToolBar::toolBarPosChanged( QToolBar *tb ) 1873void KToolBar::toolBarPosChanged( QToolBar *tb )
1874{ 1874{
1875 if ( tb != this ) 1875 if ( tb != this )
1876 return; 1876 return;
1877//US if ( d->oldPos == DockMinimized ) 1877//US if ( d->oldPos == DockMinimized )
1878 if ( d->oldPos == QMainWindow::Minimized ) 1878 if ( d->oldPos == QMainWindow::Minimized )
1879 rebuildLayout(); 1879 rebuildLayout();
1880 d->oldPos = (QMainWindow::ToolBarDock)barPos(); 1880 d->oldPos = (QMainWindow::ToolBarDock)barPos();
1881/*US 1881/*US
1882 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) 1882 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
1883 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); 1883 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
1884*/ 1884*/
1885} 1885}
1886 1886
1887/*US 1887/*US
1888void KToolBar::loadState( const QDomElement &element ) 1888void KToolBar::loadState( const QDomElement &element )
1889{ 1889{
1890 //kdDebug(220) << "KToolBar::loadState " << this << endl; 1890 //kdDebug(220) << "KToolBar::loadState " << this << endl;
1891 if ( !mainWindow() ) 1891 if ( !mainWindow() )
1892 return; 1892 return;
1893 1893
1894 { 1894 {
1895 QCString text = element.namedItem( "text" ).toElement().text().utf8(); 1895 QCString text = element.namedItem( "text" ).toElement().text().utf8();
1896 if ( text.isEmpty() ) 1896 if ( text.isEmpty() )
1897 text = element.namedItem( "Text" ).toElement().text().utf8(); 1897 text = element.namedItem( "Text" ).toElement().text().utf8();
1898 if ( !text.isEmpty() ) 1898 if ( !text.isEmpty() )
1899 setText( i18n( text ) ); 1899 setText( i18n( text ) );
1900 } 1900 }
1901 1901
1902 { 1902 {
1903 QCString attrFullWidth = element.attribute( "fullWidth" ).lower().latin1(); 1903 QCString attrFullWidth = element.attribute( "fullWidth" ).lower().latin1();
1904 if ( !attrFullWidth.isEmpty() ) 1904 if ( !attrFullWidth.isEmpty() )
1905 setFullSize( attrFullWidth == "true" ); 1905 setFullSize( attrFullWidth == "true" );
1906 } 1906 }
1907 1907
1908 Dock dock = DockTop; 1908 Dock dock = DockTop;
1909 { 1909 {
1910 QCString attrPosition = element.attribute( "position" ).lower().latin1(); 1910 QCString attrPosition = element.attribute( "position" ).lower().latin1();
1911 //kdDebug(220) << "KToolBar::loadState attrPosition=" << attrPosition << endl; 1911 //kdDebug(220) << "KToolBar::loadState attrPosition=" << attrPosition << endl;
1912 if ( !attrPosition.isEmpty() ) { 1912 if ( !attrPosition.isEmpty() ) {
1913 if ( attrPosition == "top" ) 1913 if ( attrPosition == "top" )
1914 dock = DockTop; 1914 dock = DockTop;
1915 else if ( attrPosition == "left" ) 1915 else if ( attrPosition == "left" )
1916 dock = DockLeft; 1916 dock = DockLeft;
1917 else if ( attrPosition == "right" ) 1917 else if ( attrPosition == "right" )
1918 dock = DockRight; 1918 dock = DockRight;
1919 else if ( attrPosition == "bottom" ) 1919 else if ( attrPosition == "bottom" )
1920 dock = DockBottom; 1920 dock = DockBottom;
1921 else if ( attrPosition == "floating" ) 1921 else if ( attrPosition == "floating" )
1922 dock = DockTornOff; 1922 dock = DockTornOff;
1923 else if ( attrPosition == "flat" ) 1923 else if ( attrPosition == "flat" )
1924 dock = DockMinimized; 1924 dock = DockMinimized;
1925 } 1925 }
1926 } 1926 }
1927 1927
1928 { 1928 {
1929 QCString attrIconText = element.attribute( "iconText" ).lower().latin1(); 1929 QCString attrIconText = element.attribute( "iconText" ).lower().latin1();
1930 if ( !attrIconText.isEmpty() ) { 1930 if ( !attrIconText.isEmpty() ) {
1931 //kdDebug(220) << "KToolBar::loadState attrIconText=" << attrIconText << endl; 1931 //kdDebug(220) << "KToolBar::loadState attrIconText=" << attrIconText << endl;
1932 if ( attrIconText == "icontextright" ) 1932 if ( attrIconText == "icontextright" )
1933 setIconText( KToolBar::IconTextRight ); 1933 setIconText( KToolBar::IconTextRight );
1934 else if ( attrIconText == "textonly" ) 1934 else if ( attrIconText == "textonly" )
1935 setIconText( KToolBar::TextOnly ); 1935 setIconText( KToolBar::TextOnly );
1936 else if ( attrIconText == "icontextbottom" ) 1936 else if ( attrIconText == "icontextbottom" )
1937 setIconText( KToolBar::IconTextBottom ); 1937 setIconText( KToolBar::IconTextBottom );
1938 else if ( attrIconText == "icononly" ) 1938 else if ( attrIconText == "icononly" )
1939 setIconText( KToolBar::IconOnly ); 1939 setIconText( KToolBar::IconOnly );
1940 } else 1940 } else
1941 // Use global setting 1941 // Use global setting
1942 setIconText( iconTextSetting() ); 1942 setIconText( iconTextSetting() );
1943 } 1943 }
1944 1944
1945 { 1945 {
1946 QString attrIconSize = element.attribute( "iconSize" ).lower(); 1946 QString attrIconSize = element.attribute( "iconSize" ).lower();
1947 if ( !attrIconSize.isEmpty() ) 1947 if ( !attrIconSize.isEmpty() )
1948 d->IconSizeDefault = attrIconSize.toInt(); 1948 d->IconSizeDefault = attrIconSize.toInt();
1949 setIconSize( d->IconSizeDefault ); 1949 setIconSize( d->IconSizeDefault );
1950 } 1950 }
1951 1951
1952 { 1952 {
1953 QString attrIndex = element.attribute( "index" ).lower(); 1953 QString attrIndex = element.attribute( "index" ).lower();
1954 if ( !attrIndex.isEmpty() ) 1954 if ( !attrIndex.isEmpty() )
1955 d->IndexDefault = attrIndex.toInt(); 1955 d->IndexDefault = attrIndex.toInt();
1956 } 1956 }
1957 1957
1958 { 1958 {
1959 QString attrOffset = element.attribute( "offset" ).lower(); 1959 QString attrOffset = element.attribute( "offset" ).lower();
1960 if ( !attrOffset.isEmpty() ) 1960 if ( !attrOffset.isEmpty() )
1961 d->OffsetDefault = attrOffset.toInt(); 1961 d->OffsetDefault = attrOffset.toInt();
1962 } 1962 }
1963 1963
1964 { 1964 {
1965 QString attrNewLine = element.attribute( "newline" ).lower(); 1965 QString attrNewLine = element.attribute( "newline" ).lower();
1966 if ( !attrNewLine.isEmpty() ) 1966 if ( !attrNewLine.isEmpty() )
1967 d->NewLineDefault = attrNewLine == "true"; 1967 d->NewLineDefault = attrNewLine == "true";
1968 } 1968 }
1969 1969
1970 { 1970 {
1971 QString attrHidden = element.attribute( "hidden" ).lower(); 1971 QString attrHidden = element.attribute( "hidden" ).lower();
1972 if ( !attrHidden.isEmpty() ) 1972 if ( !attrHidden.isEmpty() )
1973 d->HiddenDefault = attrHidden == "true"; 1973 d->HiddenDefault = attrHidden == "true";
1974 } 1974 }
1975 1975
1976 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( dock, d->IndexDefault, d->NewLineDefault, d->OffsetDefault ); 1976 d->toolBarInfo = KToolBarPrivate::ToolBarInfo( dock, d->IndexDefault, d->NewLineDefault, d->OffsetDefault );
1977 mainWindow()->addDockWindow( this, dock, d->NewLineDefault ); 1977 mainWindow()->addDockWindow( this, dock, d->NewLineDefault );
1978//US mainWindow()->moveDockWindow( this, dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); 1978//US mainWindow()->moveDockWindow( this, dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault );
1979 mainWindow()->moveToolBar( this, dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); 1979 mainWindow()->moveToolBar( this, dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault );
1980 1980
1981 // Apply the highlight button setting 1981 // Apply the highlight button setting
1982 d->m_highlight = highlightSetting(); 1982 d->m_highlight = highlightSetting();
1983 1983
1984 // Apply transparent-toolbar-moving setting (ok, this is global to the mainwindow, 1984 // Apply transparent-toolbar-moving setting (ok, this is global to the mainwindow,
1985 // but we do it only if there are toolbars...) 1985 // but we do it only if there are toolbars...)
1986 if ( transparentSetting() != !mainWindow()->opaqueMoving() ) 1986 if ( transparentSetting() != !mainWindow()->opaqueMoving() )
1987 mainWindow()->setOpaqueMoving( !transparentSetting() ); 1987 mainWindow()->setOpaqueMoving( !transparentSetting() );
1988 1988
1989 if ( d->HiddenDefault ) 1989 if ( d->HiddenDefault )
1990 hide(); 1990 hide();
1991 else 1991 else
1992 show(); 1992 show();
1993 1993
1994 getAttributes( d->PositionDefault, d->IconTextDefault, d->IndexDefault ); 1994 getAttributes( d->PositionDefault, d->IconTextDefault, d->IndexDefault );
1995} 1995}
1996*/ 1996*/
1997 1997
1998void KToolBar::getAttributes( QString &position, QString &icontext, int &index ) 1998void KToolBar::getAttributes( QString &position, QString &icontext, int &index )
1999{ 1999{
2000 // get all of the stuff to save 2000 // get all of the stuff to save
2001 switch ( barPos() ) { 2001 switch ( barPos() ) {
2002 case KToolBar::Flat: 2002 case KToolBar::Flat:
2003 position = "Flat"; 2003 position = "Flat";
2004 break; 2004 break;
2005 case KToolBar::Bottom: 2005 case KToolBar::Bottom:
2006 position = "Bottom"; 2006 position = "Bottom";
2007 break; 2007 break;
2008 case KToolBar::Left: 2008 case KToolBar::Left:
2009 position = "Left"; 2009 position = "Left";
2010 break; 2010 break;
2011 case KToolBar::Right: 2011 case KToolBar::Right:
2012 position = "Right"; 2012 position = "Right";
2013 break; 2013 break;
2014 case KToolBar::Floating: 2014 case KToolBar::Floating:
2015 position = "Floating"; 2015 position = "Floating";
2016 break; 2016 break;
2017 case KToolBar::Top: 2017 case KToolBar::Top:
2018 default: 2018 default:
2019 position = "Top"; 2019 position = "Top";
2020 break; 2020 break;
2021 } 2021 }
2022 2022
2023 if ( mainWindow() ) { 2023 if ( mainWindow() ) {
2024 QMainWindow::ToolBarDock dock; 2024 QMainWindow::ToolBarDock dock;
2025 bool newLine; 2025 bool newLine;
2026 int offset; 2026 int offset;
2027 mainWindow()->getLocation( this, dock, index, newLine, offset ); 2027 mainWindow()->getLocation( this, dock, index, newLine, offset );
2028 } 2028 }
2029 2029
2030 switch (d->m_iconText) { 2030 switch (d->m_iconText) {
2031 case KToolBar::IconTextRight: 2031 case KToolBar::IconTextRight:
2032 icontext = "IconTextRight"; 2032 icontext = "IconTextRight";
2033 break; 2033 break;
2034 case KToolBar::IconTextBottom: 2034 case KToolBar::IconTextBottom:
2035 icontext = "IconTextBottom"; 2035 icontext = "IconTextBottom";
2036 break; 2036 break;
2037 case KToolBar::TextOnly: 2037 case KToolBar::TextOnly:
2038 icontext = "TextOnly"; 2038 icontext = "TextOnly";
2039 break; 2039 break;
2040 case KToolBar::IconOnly: 2040 case KToolBar::IconOnly:
2041 default: 2041 default:
2042 icontext = "IconOnly"; 2042 icontext = "IconOnly";
2043 break; 2043 break;
2044 } 2044 }
2045} 2045}
2046/*US 2046/*US
2047void KToolBar::saveState( QDomElement &current ) 2047void KToolBar::saveState( QDomElement &current )
2048{ 2048{
2049 QString position, icontext; 2049 QString position, icontext;
2050 int index = -1; 2050 int index = -1;
2051 getAttributes( position, icontext, index ); 2051 getAttributes( position, icontext, index );
2052 2052
2053 current.setAttribute( "noMerge", "1" ); 2053 current.setAttribute( "noMerge", "1" );
2054 current.setAttribute( "position", position ); 2054 current.setAttribute( "position", position );
2055 current.setAttribute( "iconText", icontext ); 2055 current.setAttribute( "iconText", icontext );
2056 current.setAttribute( "index", index ); 2056 current.setAttribute( "index", index );
2057 current.setAttribute( "offset", offset() ); 2057 current.setAttribute( "offset", offset() );
2058 current.setAttribute( "newline", newLine() ); 2058 current.setAttribute( "newline", newLine() );
2059 if ( isHidden() ) 2059 if ( isHidden() )
2060 current.setAttribute( "hidden", "true" ); 2060 current.setAttribute( "hidden", "true" );
2061 d->modified = true; 2061 d->modified = true;
2062} 2062}
2063*/ 2063*/
2064 2064
2065void KToolBar::positionYourself( bool force ) 2065void KToolBar::positionYourself( bool force )
2066{ 2066{
2067 if (force) 2067 if (force)
2068 d->positioned = false; 2068 d->positioned = false;
2069 2069
2070 if ( d->positioned || !mainWindow() ) 2070 if ( d->positioned || !mainWindow() )
2071 { 2071 {
2072 //kdDebug(220) << "KToolBar::positionYourself d->positioned=true ALREADY DONE" << endl; 2072 //kdDebug(220) << "KToolBar::positionYourself d->positioned=true ALREADY DONE" << endl;
2073 return; 2073 return;
2074 } 2074 }
2075 // we can't test for ForceHide after moveDockWindow because QDockArea 2075 // we can't test for ForceHide after moveDockWindow because QDockArea
2076 // does a reparent() with showIt == true 2076 // does a reparent() with showIt == true
2077 bool doHide = isHidden(); 2077 bool doHide = isHidden();
2078 //kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl; 2078 //kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl;
2079/*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock, 2079/*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock,
2080 d->toolBarInfo.newline, 2080 d->toolBarInfo.newline,
2081 d->toolBarInfo.index, 2081 d->toolBarInfo.index,
2082 d->toolBarInfo.offset ); 2082 d->toolBarInfo.offset );
2083*/ 2083*/
2084 mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault ); 2084 mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault );
2085 2085
2086 if ( doHide ) 2086 if ( doHide )
2087 hide(); 2087 hide();
2088 // This method can only have an effect once - unless force is set 2088 // This method can only have an effect once - unless force is set
2089 d->positioned = TRUE; 2089 d->positioned = TRUE;
2090} 2090}
2091 2091
2092//US KPopupMenu *KToolBar::contextMenu() 2092//US KPopupMenu *KToolBar::contextMenu()
2093QPopupMenu *KToolBar::contextMenu() 2093QPopupMenu *KToolBar::contextMenu()
2094{ 2094{
2095 if ( context ) 2095 if ( context )
2096 return context; 2096 return context;
2097 2097
2098 // Construct our context popup menu. Name it qt_dockwidget_internal so it 2098 // Construct our context popup menu. Name it qt_dockwidget_internal so it
2099 // won't be deleted by QToolBar::clear(). 2099 // won't be deleted by QToolBar::clear().
2100//US context = new KPopupMenu( this, "qt_dockwidget_internal" ); 2100//US context = new KPopupMenu( this, "qt_dockwidget_internal" );
2101 context = new QPopupMenu( this, "qt_dockwidget_internal" ); 2101 context = new QPopupMenu( this, "qt_dockwidget_internal" );
2102//US context->insertTitle(i18n("Toolbar Menu")); 2102//US context->insertTitle(i18n("Toolbar Menu"));
2103 2103
2104//US KPopupMenu *orient = new KPopupMenu( context, "orient" ); 2104//US KPopupMenu *orient = new KPopupMenu( context, "orient" );
2105 QPopupMenu *orient = new QPopupMenu( context, "orient" ); 2105 QPopupMenu *orient = new QPopupMenu( context, "orient" );
2106 orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP ); 2106 orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP );
2107 orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT ); 2107 orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT );
2108 orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT ); 2108 orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT );
2109 orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM ); 2109 orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM );
2110 orient->insertSeparator(-1); 2110 orient->insertSeparator(-1);
2111 //orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT ); 2111 //orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT );
2112 orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT ); 2112 orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT );
2113 2113
2114//US KPopupMenu *mode = new KPopupMenu( context, "mode" ); 2114//US KPopupMenu *mode = new KPopupMenu( context, "mode" );
2115 QPopupMenu *mode = new QPopupMenu( context, "mode" ); 2115 QPopupMenu *mode = new QPopupMenu( context, "mode" );
2116 mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS ); 2116 mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS );
2117 mode->insertItem( i18n("Text Only"), CONTEXT_TEXT ); 2117 mode->insertItem( i18n("Text Only"), CONTEXT_TEXT );
2118 mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT ); 2118 mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT );
2119 mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER ); 2119 mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER );
2120 2120
2121//US KPopupMenu *size = new KPopupMenu( context, "size" ); 2121//US KPopupMenu *size = new KPopupMenu( context, "size" );
2122 QPopupMenu *size = new QPopupMenu( context, "size" ); 2122 QPopupMenu *size = new QPopupMenu( context, "size" );
2123 size->insertItem( i18n("Default"), CONTEXT_ICONSIZES ); 2123 size->insertItem( i18n("Default"), CONTEXT_ICONSIZES );
2124 // Query the current theme for available sizes 2124 // Query the current theme for available sizes
2125 QValueList<int> avSizes; 2125 QValueList<int> avSizes;
2126/*US 2126/*US
2127 KIconTheme *theme = KGlobal::instance()->iconLoader()->theme(); 2127 KIconTheme *theme = KGlobal::instance()->iconLoader()->theme();
2128 if (!::qstrcmp(QObject::name(), "mainToolBar")) 2128 if (!::qstrcmp(QObject::name(), "mainToolBar"))
2129 avSizes = theme->querySizes( KIcon::MainToolbar); 2129 avSizes = theme->querySizes( KIcon::MainToolbar);
2130 else 2130 else
2131 avSizes = theme->querySizes( KIcon::Toolbar); 2131 avSizes = theme->querySizes( KIcon::Toolbar);
2132*/ 2132*/
2133 avSizes << 16; 2133 avSizes << 16;
2134 avSizes << 32; 2134 avSizes << 32;
2135 2135
2136 d->iconSizes = avSizes; 2136 d->iconSizes = avSizes;
2137 2137
2138 QValueList<int>::Iterator it; 2138 QValueList<int>::Iterator it;
2139 for (it=avSizes.begin(); it!=avSizes.end(); it++) { 2139 for (it=avSizes.begin(); it!=avSizes.end(); it++) {
2140 QString text; 2140 QString text;
2141 if ( *it < 19 ) 2141 if ( *it < 19 )
2142 text = i18n("Small (%1x%2)").arg(*it).arg(*it); 2142 text = i18n("Small (%1x%2)").arg(*it).arg(*it);
2143 else if (*it < 25) 2143 else if (*it < 25)
2144 text = i18n("Medium (%1x%2)").arg(*it).arg(*it); 2144 text = i18n("Medium (%1x%2)").arg(*it).arg(*it);
2145 else 2145 else
2146 text = i18n("Large (%1x%2)").arg(*it).arg(*it); 2146 text = i18n("Large (%1x%2)").arg(*it).arg(*it);
2147 //we use the size as an id, with an offset 2147 //we use the size as an id, with an offset
2148 size->insertItem( text, CONTEXT_ICONSIZES + *it ); 2148 size->insertItem( text, CONTEXT_ICONSIZES + *it );
2149 } 2149 }
2150 2150
2151 context->insertItem( i18n("Orientation"), orient ); 2151 context->insertItem( i18n("Orientation"), orient );
2152 orient->setItemChecked(CONTEXT_TOP, true); 2152 orient->setItemChecked(CONTEXT_TOP, true);
2153 context->insertItem( i18n("Text Position"), mode ); 2153 context->insertItem( i18n("Text Position"), mode );
2154 context->setItemChecked(CONTEXT_ICONS, true); 2154 context->setItemChecked(CONTEXT_ICONS, true);
2155 context->insertItem( i18n("Icon Size"), size ); 2155 context->insertItem( i18n("Icon Size"), size );
2156 2156
2157/*US 2157/*US
2158 if (mainWindow()->inherits("KMainWindow")) 2158 if (mainWindow()->inherits("KMainWindow"))
2159 { 2159 {
2160 if ( (static_cast<KMainWindow*>(mainWindow())->toolBarMenuAction()) && 2160 if ( (static_cast<KMainWindow*>(mainWindow())->toolBarMenuAction()) &&
2161 (static_cast<KMainWindow*>(mainWindow())->hasMenuBar()) ) 2161 (static_cast<KMainWindow*>(mainWindow())->hasMenuBar()) )
2162 2162
2163 (static_cast<KMainWindow*>(mainWindow()))->toolBarMenuAction()->plug(context); 2163 (static_cast<KMainWindow*>(mainWindow()))->toolBarMenuAction()->plug(context);
2164 } 2164 }
2165*/ 2165*/
2166 2166
2167 connect( context, SIGNAL( aboutToShow() ), this, SLOT( slotContextAboutToShow() ) ); 2167 connect( context, SIGNAL( aboutToShow() ), this, SLOT( slotContextAboutToShow() ) );
2168 return context; 2168 return context;
2169} 2169}
2170 2170
2171void KToolBar::slotContextAboutToShow() 2171void KToolBar::slotContextAboutToShow()
2172{ 2172{
2173 if (!d->m_configurePlugged) 2173 if (!d->m_configurePlugged)
2174 { 2174 {
2175 // try to find "configure toolbars" action 2175 // try to find "configure toolbars" action
2176 2176
2177 KXMLGUIClient *xmlGuiClient = d->m_xmlguiClient; 2177 KXMLGUIClient *xmlGuiClient = d->m_xmlguiClient;
2178 if ( !xmlGuiClient && mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) 2178 if ( !xmlGuiClient && mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
2179 xmlGuiClient = (KXMLGUIClient *)mainWindow(); 2179 xmlGuiClient = (KXMLGUIClient *)mainWindow();
2180 if ( xmlGuiClient ) 2180 if ( xmlGuiClient )
2181 { 2181 {
2182 KAction *configureAction = xmlGuiClient->actionCollection()->action(KStdAction::stdName(KStdAction::ConfigureToolbars)); 2182 KAction *configureAction = xmlGuiClient->actionCollection()->action(KStdAction::stdName(KStdAction::ConfigureToolbars));
2183 if ( configureAction ) 2183 if ( configureAction )
2184 { 2184 {
2185 configureAction->plug(context); 2185 configureAction->plug(context);
2186 d->m_configurePlugged = true; 2186 d->m_configurePlugged = true;
2187 } 2187 }
2188 } 2188 }
2189 } 2189 }
2190 2190
2191 for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i) 2191 for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i)
2192 context->setItemChecked(i, false); 2192 context->setItemChecked(i, false);
2193 2193
2194 switch( d->m_iconText ) 2194 switch( d->m_iconText )
2195 { 2195 {
2196 case IconOnly: 2196 case IconOnly:
2197 default: 2197 default:
2198 context->setItemChecked(CONTEXT_ICONS, true); 2198 context->setItemChecked(CONTEXT_ICONS, true);
2199 break; 2199 break;
2200 case IconTextRight: 2200 case IconTextRight:
2201 context->setItemChecked(CONTEXT_TEXTRIGHT, true); 2201 context->setItemChecked(CONTEXT_TEXTRIGHT, true);
2202 break; 2202 break;
2203 case TextOnly: 2203 case TextOnly:
2204 context->setItemChecked(CONTEXT_TEXT, true); 2204 context->setItemChecked(CONTEXT_TEXT, true);
2205 break; 2205 break;
2206 case IconTextBottom: 2206 case IconTextBottom:
2207 context->setItemChecked(CONTEXT_TEXTUNDER, true); 2207 context->setItemChecked(CONTEXT_TEXTUNDER, true);
2208 break; 2208 break;
2209 } 2209 }
2210 2210
2211 QValueList<int>::ConstIterator iIt = d->iconSizes.begin(); 2211 QValueList<int>::ConstIterator iIt = d->iconSizes.begin();
2212 QValueList<int>::ConstIterator iEnd = d->iconSizes.end(); 2212 QValueList<int>::ConstIterator iEnd = d->iconSizes.end();
2213 for (; iIt != iEnd; ++iIt ) 2213 for (; iIt != iEnd; ++iIt )
2214 context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false ); 2214 context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false );
2215 2215
2216 context->setItemChecked( CONTEXT_ICONSIZES, false ); 2216 context->setItemChecked( CONTEXT_ICONSIZES, false );
2217 2217
2218 context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true ); 2218 context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true );
2219 2219
2220 for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i ) 2220 for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i )
2221 context->setItemChecked( i, false ); 2221 context->setItemChecked( i, false );
2222 2222
2223 switch ( barPos() ) 2223 switch ( barPos() )
2224 { 2224 {
2225 case KToolBar::Flat: 2225 case KToolBar::Flat:
2226 context->setItemChecked( CONTEXT_FLAT, true ); 2226 context->setItemChecked( CONTEXT_FLAT, true );
2227 break; 2227 break;
2228 case KToolBar::Bottom: 2228 case KToolBar::Bottom:
2229 context->setItemChecked( CONTEXT_BOTTOM, true ); 2229 context->setItemChecked( CONTEXT_BOTTOM, true );
2230 break; 2230 break;
2231 case KToolBar::Left: 2231 case KToolBar::Left:
2232 context->setItemChecked( CONTEXT_LEFT, true ); 2232 context->setItemChecked( CONTEXT_LEFT, true );
2233 break; 2233 break;
2234 case KToolBar::Right: 2234 case KToolBar::Right:
2235 context->setItemChecked( CONTEXT_RIGHT, true ); 2235 context->setItemChecked( CONTEXT_RIGHT, true );
2236 break; 2236 break;
2237 case KToolBar::Floating: 2237 case KToolBar::Floating:
2238 context->setItemChecked( CONTEXT_FLOAT, true ); 2238 context->setItemChecked( CONTEXT_FLOAT, true );
2239 break; 2239 break;
2240 case KToolBar::Top: 2240 case KToolBar::Top:
2241 context->setItemChecked( CONTEXT_TOP, true ); 2241 context->setItemChecked( CONTEXT_TOP, true );
2242 break; 2242 break;
2243 default: break; 2243 default: break;
2244 } 2244 }
2245} 2245}
2246 2246
2247void KToolBar::widgetDestroyed() 2247void KToolBar::widgetDestroyed()
2248{ 2248{
2249 removeWidgetInternal( (QWidget*)sender() ); 2249 removeWidgetInternal( (QWidget*)sender() );
2250} 2250}
2251 2251
2252void KToolBar::removeWidgetInternal( QWidget * w ) 2252void KToolBar::removeWidgetInternal( QWidget * w )
2253{ 2253{
2254 if ( inshutdownprocess ) 2254 if ( inshutdownprocess )
2255 return; 2255 return;
2256 widgets.removeRef( w ); 2256 widgets.removeRef( w );
2257 QMap< QWidget*, int >::Iterator it = widget2id.find( w ); 2257 QMap< QWidget*, int >::Iterator it = widget2id.find( w );
2258 if ( it == widget2id.end() ) 2258 if ( it == widget2id.end() )
2259 return; 2259 return;
2260 id2widget.remove( *it ); 2260 id2widget.remove( *it );
2261 widget2id.remove( it ); 2261 widget2id.remove( it );
2262} 2262}
2263 2263
2264void KToolBar::virtual_hook( int, void* ) 2264void KToolBar::virtual_hook( int, void* )
2265{ /*BASE::virtual_hook( id, data );*/ } 2265{ /*BASE::virtual_hook( id, data );*/ }
2266 2266
2267//US #include "ktoolbar.moc" 2267//US #include "ktoolbar.moc"
2268 2268