summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-22 08:27:03 (UTC)
committer zautrix <zautrix>2004-10-22 08:27:03 (UTC)
commite61ce30fc3f2376d8e9caff421495496344a8359 (patch) (unidiff)
treee82f8e5a0ecf3f21d246b0f441502cb8ee0e11a7 /kaddressbook
parenta0cd6749d41390ea832e2acd814fe117bdd39c37 (diff)
downloadkdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.zip
kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.gz
kdepimpi-e61ce30fc3f2376d8e9caff421495496344a8359.tar.bz2
added translations
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabprefs.cpp74
-rw-r--r--kaddressbook/kabprefs.h3
-rw-r--r--kaddressbook/kaddressbookmain.cpp3
-rw-r--r--kaddressbook/kaddressbookview.cpp1
-rw-r--r--kaddressbook/mainembedded.cpp6
5 files changed, 84 insertions, 3 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 9270a7d..4b3ee47 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,135 +1,209 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28#include <qtextstream.h>
29#include <qfile.h>
30#include <stdlib.h>
31#include <libkdepim/kpimglobalprefs.h>
28 32
29#include <kconfig.h> 33#include <kconfig.h>
30#include <klocale.h> 34#include <klocale.h>
31#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
32//US#include <kdebug.h> // defines kdDebug() 36//US#include <kdebug.h> // defines kdDebug()
33 37
34#include "kabprefs.h" 38#include "kabprefs.h"
35 39
36KABPrefs *KABPrefs::sInstance = 0; 40KABPrefs *KABPrefs::sInstance = 0;
37static KStaticDeleter<KABPrefs> staticDeleter; 41static KStaticDeleter<KABPrefs> staticDeleter;
38 42
39KABPrefs::KABPrefs() 43KABPrefs::KABPrefs()
40 : KPimPrefs("kaddressbookrc") 44 : KPimPrefs("kaddressbookrc")
41{ 45{
46
47 mLocaleDict = 0;
42 mDetailsFont = QFont("helvetica",12); 48 mDetailsFont = QFont("helvetica",12);
43 KPrefs::setCurrentGroup( "Views" ); 49 KPrefs::setCurrentGroup( "Views" );
44 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 50 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
45 51
46 KPrefs::setCurrentGroup( "General" ); 52 KPrefs::setCurrentGroup( "General" );
47 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 53 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
48 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 54 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
49 55
50#ifdef KAB_EMBEDDED 56#ifdef KAB_EMBEDDED
51 addItemBool("AskForQuit",&mAskForQuit,true); 57 addItemBool("AskForQuit",&mAskForQuit,true);
52 addItemBool("ToolBarHor",&mToolBarHor, true ); 58 addItemBool("ToolBarHor",&mToolBarHor, true );
53 addItemBool("ToolBarUp",&mToolBarUp, false ); 59 addItemBool("ToolBarUp",&mToolBarUp, false );
54 addItemBool("SearchWithReturn",&mSearchWithReturn, true ); 60 addItemBool("SearchWithReturn",&mSearchWithReturn, true );
55 addItemFont("DetailsFont",&mDetailsFont); 61 addItemFont("DetailsFont",&mDetailsFont);
56 62
57 63
58#endif //KAB_EMBEDDED 64#endif //KAB_EMBEDDED
59 65
60 KPrefs::setCurrentGroup( "MainWindow" ); 66 KPrefs::setCurrentGroup( "MainWindow" );
61 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 67 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
62 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 68 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
63 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 69 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
64 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 70 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
65 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 71 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
66 72
67 73
68 KPrefs::setCurrentGroup( "Extensions_General" ); 74 KPrefs::setCurrentGroup( "Extensions_General" );
69 QStringList defaultExtensions; 75 QStringList defaultExtensions;
70 defaultExtensions << "merge"; 76 defaultExtensions << "merge";
71 defaultExtensions << "distribution_list_editor"; 77 defaultExtensions << "distribution_list_editor";
72 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 78 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
73 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 79 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
74 80
75 KPrefs::setCurrentGroup( "Views" ); 81 KPrefs::setCurrentGroup( "Views" );
76 QString defaultView = i18n( "Default Table View" ); 82 QString defaultView = i18n( "Default Table View" );
77 addItemString( "CurrentView", &mCurrentView, defaultView ); 83 addItemString( "CurrentView", &mCurrentView, defaultView );
78 addItemStringList( "ViewNames", &mViewNames, defaultView ); 84 addItemStringList( "ViewNames", &mViewNames, defaultView );
79 85
80 KPrefs::setCurrentGroup( "Filters" ); 86 KPrefs::setCurrentGroup( "Filters" );
81 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 87 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
82 88
83} 89}
84 90
85KABPrefs::~KABPrefs() 91KABPrefs::~KABPrefs()
86{ 92{
87 //qDebug("KABPrefs::~KABPrefs() "); 93 //qDebug("KABPrefs::~KABPrefs() ");
94 setLocaleDict( 0 );
95 if ( mLocaleDict )
96 delete mLocaleDict;
88} 97}
89 98
90KABPrefs *KABPrefs::instance() 99KABPrefs *KABPrefs::instance()
91{ 100{
92 if ( !sInstance ) { 101 if ( !sInstance ) {
93#ifdef KAB_EMBEDDED 102#ifdef KAB_EMBEDDED
94 sInstance = staticDeleter.setObject( new KABPrefs() ); 103 sInstance = staticDeleter.setObject( new KABPrefs() );
95#else //KAB_EMBEDDED 104#else //KAB_EMBEDDED
96 //US the following line has changed ???. Why 105 //US the following line has changed ???. Why
97 staticDeleter.setObject( sInstance, new KABPrefs() ); 106 staticDeleter.setObject( sInstance, new KABPrefs() );
98#endif //KAB_EMBEDDED 107#endif //KAB_EMBEDDED
99 sInstance->readConfig(); 108 sInstance->readConfig();
100 } 109 }
101 110
102 return sInstance; 111 return sInstance;
103} 112}
104 113
105void KABPrefs::setCategoryDefaults() 114void KABPrefs::setCategoryDefaults()
106{ 115{
107 mCustomCategories.clear(); 116 mCustomCategories.clear();
108 117
109 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 118 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
110 << i18n( "Customer" ) << i18n( "Friend" ); 119 << i18n( "Customer" ) << i18n( "Friend" );
111} 120}
112 121
113 // US introduce a nonconst way to return the config object. 122 // US introduce a nonconst way to return the config object.
114KConfig* KABPrefs::getConfig() 123KConfig* KABPrefs::getConfig()
115{ 124{
116 return config(); 125 return config();
117} 126}
127void KABPrefs::usrReadConfig()
128{
129 QString fileName ;
130#ifndef DESKTOP_VERSION
131 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/";
132#else
133 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
134#endif
135 int mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
136 mLocaleDict = 0;
137 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
138
139 if ( mPreferredLanguage == 1 )
140 fileName = fileName+"germantranslation.txt";
141 else if ( mPreferredLanguage == 4 )
142 fileName = fileName+"usertranslation.txt";
143 else if ( mPreferredLanguage == 2 )
144 fileName = fileName+"frenchtranslation.txt";
145 else if ( mPreferredLanguage == 3 )
146 fileName = fileName+"italiantranslation.txt";
147 QFile file( fileName );
148 if (file.open( IO_ReadOnly ) ) {
149 QTextStream ts( &file );
150 ts.setEncoding( QTextStream::Latin1 );
151 //ts.setCodec( QTextCodec::latin1 );
152 QString text = ts.read();
153 file.close();
154 text.replace( QRegExp("\\\\n"), "\n" );
155 QString line;
156 QString we;
157 QString wt;
158 int br = 0;
159 int nbr;
160 nbr = text.find ( "},", br );
161 line = text.mid( br, nbr - br );
162 br = nbr+1;
163 int se, ee, st, et;
164 mLocaleDict = new QDict<QString>;
165 QString end = "{ \"\",\"\" }";
166 while ( (line != end) && (br > 1) ) {
167 //qDebug("%d *%s* ", br, line.latin1());
168 se = line.find("\"")+1;
169 et = line.findRev("\"",-1);
170 ee = line.find("\",\"");
171 st = ee+3;
172 we = line.mid( se, ee-se );
173 wt = line.mid( st, et-st );
174 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
175 mLocaleDict->insert( we, new QString (wt) );
176 nbr = text.find ( "}", br );
177 line = text.mid( br, nbr - br );
178 br = nbr+1;
179 }
180 //qDebug("end *%s* ", end.latin1());
181
182 setLocaleDict( mLocaleDict );
183 } else {
184 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
185 }
186
187
188 }
189 qDebug("KABPrefs::usrReadConfig********************** ");
190 KPimPrefs::usrReadConfig();
191}
118 192
119 193
120/*US 194/*US
121void KABPrefs::usrSetDefaults() 195void KABPrefs::usrSetDefaults()
122{ 196{
123 KPimPrefs::usrSetDefaults(); 197 KPimPrefs::usrSetDefaults();
124} 198}
125 199
126void KABPrefs::usrReadConfig() 200void KABPrefs::usrReadConfig()
127{ 201{
128 KPimPrefs::usrReadConfig(); 202 KPimPrefs::usrReadConfig();
129} 203}
130 204
131void KABPrefs::usrWriteConfig() 205void KABPrefs::usrWriteConfig()
132{ 206{
133 KPimPrefs::usrWriteConfig(); 207 KPimPrefs::usrWriteConfig();
134} 208}
135*/ 209*/
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 4a3b6e2..1098f4c 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,93 +1,96 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABPREFS_H 24#ifndef KABPREFS_H
25#define KABPREFS_H 25#define KABPREFS_H
26 26
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qdict.h>
28 29
29#include <libkdepim/kpimprefs.h> 30#include <libkdepim/kpimprefs.h>
30 31
31class KConfig; 32class KConfig;
32 33
33class KABPrefs : public KPimPrefs 34class KABPrefs : public KPimPrefs
34{ 35{
35 public: 36 public:
36 virtual ~KABPrefs(); 37 virtual ~KABPrefs();
37 38
38 static KABPrefs *instance(); 39 static KABPrefs *instance();
39 40
40 // General 41 // General
41 bool mHonorSingleClick; 42 bool mHonorSingleClick;
42 bool mAutomaticNameParsing; 43 bool mAutomaticNameParsing;
43 int mCurrentIncSearchField; 44 int mCurrentIncSearchField;
44 45
45#ifdef KAB_EMBEDDED 46#ifdef KAB_EMBEDDED
46 // US introduce a nonconst way to return the config object. 47 // US introduce a nonconst way to return the config object.
47 KConfig* getConfig(); 48 KConfig* getConfig();
48 49
49 bool mToolBarHor; 50 bool mToolBarHor;
50 bool mToolBarUp; 51 bool mToolBarUp;
51 bool mAskForQuit; 52 bool mAskForQuit;
52 53
53 54
54 /** Set preferences to default values */ 55 /** Set preferences to default values */
55// void usrSetDefaults(); 56// void usrSetDefaults();
56 57
57 /** Read preferences from config file */ 58 /** Read preferences from config file */
58// void usrReadConfig(); 59// void usrReadConfig();
59 60
60 /** Write preferences to config file */ 61 /** Write preferences to config file */
61// void usrWriteConfig(); 62// void usrWriteConfig();
62#endif //KAB_EMBEDDED 63#endif //KAB_EMBEDDED
64 void usrReadConfig();
63 65
64 66
65 // GUI 67 // GUI
66 bool mJumpButtonBarVisible; 68 bool mJumpButtonBarVisible;
67 bool mDetailsPageVisible; 69 bool mDetailsPageVisible;
68 bool mMultipleViewsAtOnce; 70 bool mMultipleViewsAtOnce;
69 bool mSearchWithReturn; 71 bool mSearchWithReturn;
70 QValueList<int> mExtensionsSplitter; 72 QValueList<int> mExtensionsSplitter;
71 QValueList<int> mDetailsSplitter; 73 QValueList<int> mDetailsSplitter;
72 74
73 // Extensions stuff 75 // Extensions stuff
74 int mCurrentExtension; 76 int mCurrentExtension;
75 QStringList mActiveExtensions; 77 QStringList mActiveExtensions;
76 78
77 // Views stuff 79 // Views stuff
78 QString mCurrentView; 80 QString mCurrentView;
79 QStringList mViewNames; 81 QStringList mViewNames;
80 82
81 // Filter 83 // Filter
82 int mCurrentFilter; 84 int mCurrentFilter;
83 85
84 void setCategoryDefaults(); 86 void setCategoryDefaults();
85 QFont mDetailsFont; 87 QFont mDetailsFont;
86 88
87 private: 89 private:
88 KABPrefs(); 90 KABPrefs();
89 91
92 QDict<QString> *mLocaleDict;
90 static KABPrefs *sInstance; 93 static KABPrefs *sInstance;
91}; 94};
92 95
93#endif 96#endif
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..2832257 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -1,240 +1,239 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 1999 Don Sanders <dsanders@kde.org> 3 Copyright (c) 1999 Don Sanders <dsanders@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifdef KAB_EMBEDDED 24#ifdef KAB_EMBEDDED
25#include "kabprefs.h" 25#include "kabprefs.h"
26#include <kglobal.h> 26#include <kglobal.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30#else //KAB_EMBEDDED 30#else //KAB_EMBEDDED
31#include <kedittoolbar.h> 31#include <kedittoolbar.h>
32#include <kkeydialog.h> 32#include <kkeydialog.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34#include <kstatusbar.h> 34#include <kstatusbar.h>
35#endif //KAB_EMBEDDED 35#endif //KAB_EMBEDDED
36#include <klocale.h> 36#include <klocale.h>
37 37
38#include "kabcore.h" 38#include "kabcore.h"
39#include "kaddressbookmain.h" 39#include "kaddressbookmain.h"
40#include "kactioncollection.h" 40#include "kactioncollection.h"
41 41
42#ifdef KAB_EMBEDDED 42#ifdef KAB_EMBEDDED
43KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) 43KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" )
44#else //KAB_EMBEDDED 44#else //KAB_EMBEDDED
45//MOC_SKIP_BEGIN 45//MOC_SKIP_BEGIN
46KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) 46KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 )
47//MOC_SKIP_END 47//MOC_SKIP_END
48#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
49{ 49{
50
51 setIcon(SmallIcon( "ka24" ) ); 50 setIcon(SmallIcon( "ka24" ) );
52#if 0 51#if 0
53 //US for embedded systems, create the toolbar before we initiate KABCore. 52 //US for embedded systems, create the toolbar before we initiate KABCore.
54 // KABCore will fill the toolbar with menues and icons 53 // KABCore will fill the toolbar with menues and icons
55 QMainWindow::ToolBarDock tbd; 54 QMainWindow::ToolBarDock tbd;
56 tbd = Top; 55 tbd = Top;
57 iconToolBar = new QToolBar( this ); 56 iconToolBar = new QToolBar( this );
58 addToolBar (iconToolBar , tbd ); 57 addToolBar (iconToolBar , tbd );
59 iconToolBar->setHorizontalStretchable(true); 58 iconToolBar->setHorizontalStretchable(true);
60//US iconToolBar->setWidth(300); 59//US iconToolBar->setWidth(300);
61#endif // 0 60#endif // 0
62 61
63 mCore = new KABCore( this, true, this ); 62 mCore = new KABCore( this, true, this );
64 63
65#ifdef KAB_EMBEDDED 64#ifdef KAB_EMBEDDED
66 setCaption( i18n( "KAddressbook/Pi" ) ); 65 setCaption( i18n( "KAddressbook/Pi" ) );
67#else //KAB_EMBEDDED 66#else //KAB_EMBEDDED
68 setCaption( i18n( "Address Book Browser" ) ); 67 setCaption( i18n( "Address Book Browser" ) );
69#endif //KAB_EMBEDDED 68#endif //KAB_EMBEDDED
70 69
71 //mCore->restoreSettings(); 70 //mCore->restoreSettings();
72 71
73 initActions(); 72 initActions();
74 73
75 setCentralWidget( mCore ); 74 setCentralWidget( mCore );
76 75
77//US statusBar()->show(); 76//US statusBar()->show();
78 77
79#ifndef KAB_EMBEDDED 78#ifndef KAB_EMBEDDED
80 setStandardToolBarMenuEnabled(true); 79 setStandardToolBarMenuEnabled(true);
81 80
82 createGUI( "kaddressbookui.rc", false ); 81 createGUI( "kaddressbookui.rc", false );
83 82
84 83
85#endif //KAB_EMBEDDED 84#endif //KAB_EMBEDDED
86 setAutoSaveSettings(); 85 setAutoSaveSettings();
87 qApp->processEvents(); 86 qApp->processEvents();
88 mCore->restoreSettings(); 87 mCore->restoreSettings();
89} 88}
90 89
91KAddressBookMain::~KAddressBookMain() 90KAddressBookMain::~KAddressBookMain()
92{ 91{
93 // mCore->saveSettings(); 92 // mCore->saveSettings();
94} 93}
95 94
96void KAddressBookMain::showMinimized () 95void KAddressBookMain::showMinimized ()
97{ 96{
98 QWidget::showMinimized () ; 97 QWidget::showMinimized () ;
99} 98}
100void KAddressBookMain::addEmail( QString addr ) 99void KAddressBookMain::addEmail( QString addr )
101{ 100{
102 mCore->addEmail( addr ); 101 mCore->addEmail( addr );
103} 102}
104 103
105#ifndef KAB_EMBEDDED 104#ifndef KAB_EMBEDDED
106ASYNC KAddressBookMain::showContactEditor( QString uid ) 105ASYNC KAddressBookMain::showContactEditor( QString uid )
107{ 106{
108 mCore->editContact( uid ); 107 mCore->editContact( uid );
109} 108}
110#endif //KAB_EMBEDDED 109#endif //KAB_EMBEDDED
111void KAddressBookMain::newContact() 110void KAddressBookMain::newContact()
112{ 111{
113 mCore->newContact(); 112 mCore->newContact();
114} 113}
115 114
116QString KAddressBookMain::getNameByPhone( QString phone ) 115QString KAddressBookMain::getNameByPhone( QString phone )
117{ 116{
118 return mCore->getNameByPhone( phone ); 117 return mCore->getNameByPhone( phone );
119} 118}
120 119
121void KAddressBookMain::save() 120void KAddressBookMain::save()
122{ 121{
123 mCore->save(); 122 mCore->save();
124} 123}
125 124
126void KAddressBookMain::exit() 125void KAddressBookMain::exit()
127{ 126{
128 close( ); 127 close( );
129} 128}
130 129
131void KAddressBookMain::saveProperties( KConfig* ) 130void KAddressBookMain::saveProperties( KConfig* )
132{ 131{
133} 132}
134 133
135void KAddressBookMain::readProperties( KConfig* ) 134void KAddressBookMain::readProperties( KConfig* )
136{ 135{
137} 136}
138 137
139void KAddressBookMain::initActions() 138void KAddressBookMain::initActions()
140{ 139{
141#ifndef KAB_EMBEDDED 140#ifndef KAB_EMBEDDED
142 KStdAction::quit( this, SLOT( close() ), actionCollection() ); 141 KStdAction::quit( this, SLOT( close() ), actionCollection() );
143 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); 142 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
144#else //KAB_EMBEDDED 143#else //KAB_EMBEDDED
145 //US: transfered the setup of the actions into KABCore 144 //US: transfered the setup of the actions into KABCore
146#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
147 146
148 147
149} 148}
150 149
151//US new method to setup menues and toolbars on embedded systems 150//US new method to setup menues and toolbars on embedded systems
152#ifdef KAB_EMBEDDED 151#ifdef KAB_EMBEDDED
153/* 152/*
154QToolBar * KAddressBookMain::getIconToolBar() 153QToolBar * KAddressBookMain::getIconToolBar()
155{ 154{
156 return iconToolBar; 155 return iconToolBar;
157} 156}
158*/ 157*/
159 158
160void KAddressBookMain::createGUI() 159void KAddressBookMain::createGUI()
161{ 160{
162 161
163 162
164 163
165} 164}
166#endif //KAB_EMBEDDED 165#endif //KAB_EMBEDDED
167 166
168void KAddressBookMain::configureToolbars() 167void KAddressBookMain::configureToolbars()
169{ 168{
170#ifndef KAB_EMBEDDED 169#ifndef KAB_EMBEDDED
171 saveMainWindowSettings( KGlobal::config(), "MainWindow" ); 170 saveMainWindowSettings( KGlobal::config(), "MainWindow" );
172 171
173 KEditToolbar dlg( factory() ); 172 KEditToolbar dlg( factory() );
174 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); 173 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) );
175 174
176 dlg.exec(); 175 dlg.exec();
177#else //KAB_EMBEDDED 176#else //KAB_EMBEDDED
178 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); 177 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" );
179#endif //KAB_EMBEDDED 178#endif //KAB_EMBEDDED
180} 179}
181 180
182void KAddressBookMain::slotNewToolbarConfig() 181void KAddressBookMain::slotNewToolbarConfig()
183{ 182{
184#ifndef KAB_EMBEDDED 183#ifndef KAB_EMBEDDED
185 applyMainWindowSettings( KGlobal::config(), "MainWindow" ); 184 applyMainWindowSettings( KGlobal::config(), "MainWindow" );
186#else //KAB_EMBEDDED 185#else //KAB_EMBEDDED
187 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); 186 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" );
188#endif //KAB_EMBEDDED 187#endif //KAB_EMBEDDED
189} 188}
190 189
191void KAddressBookMain::configureKeys() 190void KAddressBookMain::configureKeys()
192{ 191{
193#ifndef KAB_EMBEDDED 192#ifndef KAB_EMBEDDED
194 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); 193 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this );
195#else //KAB_EMBEDDED 194#else //KAB_EMBEDDED
196 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); 195 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" );
197#endif //KAB_EMBEDDED 196#endif //KAB_EMBEDDED
198} 197}
199 198
200void KAddressBookMain::closeEvent( QCloseEvent* ce ) 199void KAddressBookMain::closeEvent( QCloseEvent* ce )
201{ 200{
202 bool mModified = mCore->modified(); 201 bool mModified = mCore->modified();
203 bool mAskForQuit = KABPrefs::instance()->mAskForQuit; 202 bool mAskForQuit = KABPrefs::instance()->mAskForQuit;
204 203
205 QString mess = i18n( "Close KA/Pi?"); 204 QString mess = i18n( "Close KA/Pi?");
206 if ( mModified == true ) 205 if ( mModified == true )
207 mess += i18n( "\nChanges will be saved!"); 206 mess += i18n( "\nChanges will be saved!");
208 else 207 else
209 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); 208 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
210 209
211 bool mQuit = true; 210 bool mQuit = true;
212 211
213 212
214 if (mAskForQuit) 213 if (mAskForQuit)
215 { 214 {
216 215
217 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); 216 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
218 if (res == 0) 217 if (res == 0)
219 mQuit = true; 218 mQuit = true;
220 else 219 else
221 mQuit = false; 220 mQuit = false;
222 } 221 }
223 222
224 if (mQuit == false) 223 if (mQuit == false)
225 return; 224 return;
226 225
227 if (mModified == true) 226 if (mModified == true)
228 { 227 {
229 save(); 228 save();
230 mCore->saveSettings(); 229 mCore->saveSettings();
231 KABPrefs::instance()->writeConfig(); 230 KABPrefs::instance()->writeConfig();
232 } 231 }
233 232
234 ce->accept(); 233 ce->accept();
235} 234}
236 235
237#ifndef KAB_EMBEDDED 236#ifndef KAB_EMBEDDED
238#include "kaddressbookmain.moc" 237#include "kaddressbookmain.moc"
239#endif //KAB_EMBEDDED 238#endif //KAB_EMBEDDED
240 239
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp
index da28870..8062354 100644
--- a/kaddressbook/kaddressbookview.cpp
+++ b/kaddressbook/kaddressbookview.cpp
@@ -1,165 +1,166 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KAB_EMBEDDED 24#ifndef KAB_EMBEDDED
25#include <qapplication.h> 25#include <qapplication.h>
26 26
27#include <kabc/distributionlistdialog.h> 27#include <kabc/distributionlistdialog.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <klocale.h> 29#include <klocale.h>
30 30
31#include "viewmanager.h" 31#include "viewmanager.h"
32 32
33#endif //KAB_EMBEDDED 33#endif //KAB_EMBEDDED
34#include <qlayout.h> 34#include <qlayout.h>
35 35
36#include <kabc/distributionlistdialog.h> 36#include <kabc/distributionlistdialog.h>
37#include <kabc/addressbook.h> 37#include <kabc/addressbook.h>
38#include <kdebug.h> 38#include <kdebug.h>
39 39
40#include "kaddressbookview.h" 40#include "kaddressbookview.h"
41 41
42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, 42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent,
43 const char *name ) 43 const char *name )
44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList() 44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList()
45{ 45{
46
46 initGUI(); 47 initGUI();
47} 48}
48 49
49KAddressBookView::~KAddressBookView() 50KAddressBookView::~KAddressBookView()
50{ 51{
51 kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - " 52 kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - "
52 << name() << endl; 53 << name() << endl;
53} 54}
54 55
55void KAddressBookView::readConfig( KConfig *config ) 56void KAddressBookView::readConfig( KConfig *config )
56{ 57{
57 mFieldList = KABC::Field::restoreFields( config, "KABCFields" ); 58 mFieldList = KABC::Field::restoreFields( config, "KABCFields" );
58 59
59 if ( mFieldList.isEmpty() ) 60 if ( mFieldList.isEmpty() )
60 mFieldList = KABC::Field::defaultFields(); 61 mFieldList = KABC::Field::defaultFields();
61 62
62 mDefaultFilterType = (DefaultFilterType)config->readNumEntry( "DefaultFilterType", 1 ); 63 mDefaultFilterType = (DefaultFilterType)config->readNumEntry( "DefaultFilterType", 1 );
63 mDefaultFilterName = config->readEntry( "DefaultFilterName", QString::null ); 64 mDefaultFilterName = config->readEntry( "DefaultFilterName", QString::null );
64} 65}
65 66
66void KAddressBookView::writeConfig( KConfig* ) 67void KAddressBookView::writeConfig( KConfig* )
67{ 68{
68 // Most of writing the config is handled by the ConfigureViewDialog 69 // Most of writing the config is handled by the ConfigureViewDialog
69} 70}
70 71
71QString KAddressBookView::selectedEmails() 72QString KAddressBookView::selectedEmails()
72{ 73{
73 bool first = true; 74 bool first = true;
74 QString emailAddrs; 75 QString emailAddrs;
75 QStringList uidList = selectedUids(); 76 QStringList uidList = selectedUids();
76 KABC::Addressee addr; 77 KABC::Addressee addr;
77 QString email; 78 QString email;
78 79
79 QStringList::Iterator it; 80 QStringList::Iterator it;
80 for ( it = uidList.begin(); it != uidList.end(); ++it ) { 81 for ( it = uidList.begin(); it != uidList.end(); ++it ) {
81 addr = mAddressBook->findByUid( *it ); 82 addr = mAddressBook->findByUid( *it );
82 83
83 if ( !addr.isEmpty() ) { 84 if ( !addr.isEmpty() ) {
84 QString m = QString::null; 85 QString m = QString::null;
85 86
86 if ( addr.emails().count() > 1 ) 87 if ( addr.emails().count() > 1 )
87 m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this ); 88 m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this );
88 89
89 email = addr.fullEmail( m ); 90 email = addr.fullEmail( m );
90 91
91 if ( !first ) 92 if ( !first )
92 emailAddrs += ", "; 93 emailAddrs += ", ";
93 else 94 else
94 first = false; 95 first = false;
95 96
96 emailAddrs += email; 97 emailAddrs += email;
97 } 98 }
98 } 99 }
99 100
100 return emailAddrs; 101 return emailAddrs;
101} 102}
102 103
103KABC::Addressee::List KAddressBookView::addressees() 104KABC::Addressee::List KAddressBookView::addressees()
104{ 105{
105 KABC::Addressee::List addresseeList; 106 KABC::Addressee::List addresseeList;
106 107
107 KABC::AddressBook::Iterator it; 108 KABC::AddressBook::Iterator it;
108 for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 109 for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
109 if ( mFilter.filterAddressee( *it ) ) 110 if ( mFilter.filterAddressee( *it ) )
110 addresseeList.append( *it ); 111 addresseeList.append( *it );
111 } 112 }
112 113
113 return addresseeList; 114 return addresseeList;
114} 115}
115 116
116void KAddressBookView::initGUI() 117void KAddressBookView::initGUI()
117{ 118{
118 // Create the layout 119 // Create the layout
119 QVBoxLayout *layout = new QVBoxLayout( this ); 120 QVBoxLayout *layout = new QVBoxLayout( this );
120 121
121 // Add the view widget 122 // Add the view widget
122 mViewWidget = new QWidget( this ); 123 mViewWidget = new QWidget( this );
123 layout->addWidget( mViewWidget ); 124 layout->addWidget( mViewWidget );
124} 125}
125 126
126KABC::Field::List KAddressBookView::fields() const 127KABC::Field::List KAddressBookView::fields() const
127{ 128{
128 return mFieldList; 129 return mFieldList;
129} 130}
130 131
131void KAddressBookView::setFilter( const Filter &filter ) 132void KAddressBookView::setFilter( const Filter &filter )
132{ 133{
133 mFilter = filter; 134 mFilter = filter;
134} 135}
135 136
136KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const 137KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const
137{ 138{
138 return mDefaultFilterType; 139 return mDefaultFilterType;
139} 140}
140 141
141const QString &KAddressBookView::defaultFilterName() const 142const QString &KAddressBookView::defaultFilterName() const
142{ 143{
143 return mDefaultFilterName; 144 return mDefaultFilterName;
144} 145}
145 146
146KABC::AddressBook *KAddressBookView::addressBook() const 147KABC::AddressBook *KAddressBookView::addressBook() const
147{ 148{
148 return mAddressBook; 149 return mAddressBook;
149} 150}
150 151
151QWidget *KAddressBookView::viewWidget() 152QWidget *KAddressBookView::viewWidget()
152{ 153{
153 return mViewWidget; 154 return mViewWidget;
154} 155}
155 156
156ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, 157ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
157 QWidget *parent, 158 QWidget *parent,
158 const char *name ) 159 const char *name )
159{ 160{
160 return new ViewConfigureWidget( ab, parent, name ); 161 return new ViewConfigureWidget( ab, parent, name );
161} 162}
162 163
163#ifndef KAB_EMBEDDED 164#ifndef KAB_EMBEDDED
164#include "kaddressbookview.moc" 165#include "kaddressbookview.moc"
165#endif //KAB_EMBEDDED 166#endif //KAB_EMBEDDED
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 40089a1..a8816f9 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,95 +1,99 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
9#include <qmainwindow.h> 9#include <qmainwindow.h>
10#endif 10#endif
11 11
12#include <qtextcodec.h> 12#include <qtextcodec.h>
13#include <kstandarddirs.h> 13#include <kstandarddirs.h>
14#include <qregexp.h> 14#include <qregexp.h>
15#include <kglobal.h> 15#include <kglobal.h>
16#include <stdio.h> 16#include <stdio.h>
17#include <qdir.h> 17#include <qdir.h>
18#include "kabprefs.h"
18#include "kaddressbookmain.h" 19#include "kaddressbookmain.h"
19#include "externalapphandler.h" 20#include "externalapphandler.h"
20#include <libkdepim/kpimglobalprefs.h> 21#include <libkdepim/kpimglobalprefs.h>
21 22void dumpMissing();
22int main( int argc, char **argv ) 23int main( int argc, char **argv )
23{ 24{
24#ifndef DESKTOP_VERSION 25#ifndef DESKTOP_VERSION
25 QPEApplication a( argc, argv ); 26 QPEApplication a( argc, argv );
26 a.setKeepRunning (); 27 a.setKeepRunning ();
27#else 28#else
28 QApplication a( argc, argv ); 29 QApplication a( argc, argv );
29 QApplication::setStyle( new QPlatinumStyle ()); 30 QApplication::setStyle( new QPlatinumStyle ());
30 QString hdir = QDir::homeDirPath(); 31 QString hdir = QDir::homeDirPath();
31 // there is a bug when creating dirs for WIN 98 32 // there is a bug when creating dirs for WIN 98
32 // it is difficult to fix, because we have no WIN 98 runnung 33 // it is difficult to fix, because we have no WIN 98 runnung
33 // such that we try it to create the dirs at startup here 34 // such that we try it to create the dirs at startup here
34 if ( hdir == "C:\\" ) { // win 98 or ME 35 if ( hdir == "C:\\" ) { // win 98 or ME
35 QDir app_dir; 36 QDir app_dir;
36 if ( !app_dir.exists("C:\\kdepim") ) 37 if ( !app_dir.exists("C:\\kdepim") )
37 app_dir.mkdir ("C:\\kdepim"); 38 app_dir.mkdir ("C:\\kdepim");
38 if ( !app_dir.exists("C:\\kdepim\\apps") ) 39 if ( !app_dir.exists("C:\\kdepim\\apps") )
39 app_dir.mkdir ("C:\\kdepim\\apps"); 40 app_dir.mkdir ("C:\\kdepim\\apps");
40 if ( !app_dir.exists("C:\\kdepim\\config") ) 41 if ( !app_dir.exists("C:\\kdepim\\config") )
41 app_dir.mkdir ("C:\\kdepim\\config"); 42 app_dir.mkdir ("C:\\kdepim\\config");
42 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 43 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
43 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 44 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
44 } 45 }
45#endif 46#endif
46 47
47 bool exitHelp = false; 48 bool exitHelp = false;
48 if ( argc > 1 ) { 49 if ( argc > 1 ) {
49 QString command = argv[1]; 50 QString command = argv[1];
50 if ( command == "-help" ){ 51 if ( command == "-help" ){
51 printf("KA/E command line commands:\n"); 52 printf("KA/E command line commands:\n");
52 printf(" no command: Start KA/E in usual way\n"); 53 printf(" no command: Start KA/E in usual way\n");
53 printf(" -help: This output\n"); 54 printf(" -help: This output\n");
54 printf(" KA/E is exiting now. Bye!\n"); 55 printf(" KA/E is exiting now. Bye!\n");
55 exitHelp = true; 56 exitHelp = true;
56 } 57 }
57 } 58 }
58 if ( ! exitHelp ) { 59 if ( ! exitHelp ) {
59 60
60 KGlobal::setAppName( "kaddressbook" ); 61 KGlobal::setAppName( "kaddressbook" );
61#ifndef DESKTOP_VERSION 62#ifndef DESKTOP_VERSION
62 if ( QApplication::desktop()->width() > 320 ) 63 if ( QApplication::desktop()->width() > 320 )
63 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 64 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
64 else 65 else
65 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
66#else 67#else
67 QString fileName ; 68 QString fileName ;
68 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 69 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
69 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 70 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
70 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 71 QApplication::addLibraryPath ( qApp->applicationDirPath () );
71 72
72#endif 73#endif
73 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 74 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
75 // init language
76 KABPrefs::instance();
74 KAddressBookMain m ; 77 KAddressBookMain m ;
75//US MainWindow m; 78//US MainWindow m;
76 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 79 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
77 80
78 { 81 {
79 KPimGlobalPrefs::instance()->setGlobalConfig(); 82 KPimGlobalPrefs::instance()->setGlobalConfig();
80 } 83 }
81#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
82 a.showMainWidget( &m ); 85 a.showMainWidget( &m );
83 86
84#else 87#else
85 a.setMainWidget( &m ); 88 a.setMainWidget( &m );
86 m.resize (640, 480 ); 89 m.resize (640, 480 );
87 m.show(); 90 m.show();
88#endif 91#endif
89 a.exec(); 92 a.exec();
90 93
94 dumpMissing();
91 95
92 } 96 }
93 qDebug("KA: Bye! "); 97 qDebug("KA: Bye! ");
94} 98}
95 99