Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index c417226..b317974 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -1,120 +1,123 @@ | |||
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 <q3toolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3CString> | ||
32 | #include <QCloseEvent> | ||
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <kedittoolbar.h> | 34 | #include <kedittoolbar.h> |
32 | #include <kkeydialog.h> | 35 | #include <kkeydialog.h> |
33 | #include <kmessagebox.h> | 36 | #include <kmessagebox.h> |
34 | #include <kstatusbar.h> | 37 | #include <kstatusbar.h> |
35 | #endif //KAB_EMBEDDED | 38 | #endif //KAB_EMBEDDED |
36 | #include <klocale.h> | 39 | #include <klocale.h> |
37 | 40 | ||
38 | #include "kabcore.h" | 41 | #include "kabcore.h" |
39 | #include "kaddressbookmain.h" | 42 | #include "kaddressbookmain.h" |
40 | #include "kactioncollection.h" | 43 | #include "kactioncollection.h" |
41 | 44 | ||
42 | #ifdef KAB_EMBEDDED | 45 | #ifdef KAB_EMBEDDED |
43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" ) | 46 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" ) |
44 | #else //KAB_EMBEDDED | 47 | #else //KAB_EMBEDDED |
45 | //MOC_SKIP_BEGIN | 48 | #ifndef Q_MOC_RUN |
46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) | 49 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) |
47 | //MOC_SKIP_END | 50 | #endif |
48 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
49 | { | 52 | { |
50 | setIcon(SmallIcon( "ka24" ) ); | 53 | setIcon(SmallIcon( "ka24" ) ); |
51 | #if 0 | 54 | #if 0 |
52 | //US for embedded systems, create the toolbar before we initiate KABCore. | 55 | //US for embedded systems, create the toolbar before we initiate KABCore. |
53 | // KABCore will fill the toolbar with menues and icons | 56 | // KABCore will fill the toolbar with menues and icons |
54 | QMainWindow::ToolBarDock tbd; | 57 | Qt::ToolBarDock tbd; |
55 | tbd = Top; | 58 | tbd = Qt::DockTop; |
56 | iconToolBar = new QToolBar( this ); | 59 | iconToolBar = new Q3ToolBar( this ); |
57 | addToolBar (iconToolBar , tbd ); | 60 | addToolBar (iconToolBar , tbd ); |
58 | iconToolBar->setHorizontalStretchable(true); | 61 | iconToolBar->setHorizontalStretchable(true); |
59 | //US iconToolBar->setWidth(300); | 62 | //US iconToolBar->setWidth(300); |
60 | #endif // 0 | 63 | #endif // 0 |
61 | 64 | ||
62 | mCore = new KABCore( this, true, this ); | 65 | mCore = new KABCore( this, true, this ); |
63 | 66 | ||
64 | #ifdef KAB_EMBEDDED | 67 | #ifdef KAB_EMBEDDED |
65 | setCaption( i18n( "KAddressbook/Pi" ) ); | 68 | setCaption( i18n( "KAddressbook/Pi" ) ); |
66 | #else //KAB_EMBEDDED | 69 | #else //KAB_EMBEDDED |
67 | setCaption( i18n( "Address Book Browser" ) ); | 70 | setCaption( i18n( "Address Book Browser" ) ); |
68 | #endif //KAB_EMBEDDED | 71 | #endif //KAB_EMBEDDED |
69 | 72 | ||
70 | //mCore->restoreSettings(); | 73 | //mCore->restoreSettings(); |
71 | 74 | ||
72 | initActions(); | 75 | initActions(); |
73 | 76 | ||
74 | setCentralWidget( mCore ); | 77 | setCentralWidget( mCore ); |
75 | 78 | ||
76 | //US statusBar()->show(); | 79 | //US statusBar()->show(); |
77 | 80 | ||
78 | #ifndef KAB_EMBEDDED | 81 | #ifndef KAB_EMBEDDED |
79 | setStandardToolBarMenuEnabled(true); | 82 | setStandardToolBarMenuEnabled(true); |
80 | 83 | ||
81 | createGUI( "kaddressbookui.rc", false ); | 84 | createGUI( "kaddressbookui.rc", false ); |
82 | 85 | ||
83 | 86 | ||
84 | #endif //KAB_EMBEDDED | 87 | #endif //KAB_EMBEDDED |
85 | setAutoSaveSettings(); | 88 | setAutoSaveSettings(); |
86 | mCore->restoreSettings(); | 89 | mCore->restoreSettings(); |
87 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
88 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & ))); | 91 | QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), mCore, SLOT (receiveStart ( const Q3CString &, const QByteArray & ))); |
89 | #endif | 92 | #endif |
90 | } | 93 | } |
91 | 94 | ||
92 | KAddressBookMain::~KAddressBookMain() | 95 | KAddressBookMain::~KAddressBookMain() |
93 | { | 96 | { |
94 | // mCore->saveSettings(); | 97 | // mCore->saveSettings(); |
95 | } | 98 | } |
96 | 99 | ||
97 | void KAddressBookMain::showMinimized () | 100 | void KAddressBookMain::showMinimized () |
98 | { | 101 | { |
99 | QWidget::showMinimized () ; | 102 | QWidget::showMinimized () ; |
100 | } | 103 | } |
101 | void KAddressBookMain::addEmail( QString addr ) | 104 | void KAddressBookMain::addEmail( QString addr ) |
102 | { | 105 | { |
103 | mCore->addEmail( addr ); | 106 | mCore->addEmail( addr ); |
104 | } | 107 | } |
105 | 108 | ||
106 | #ifndef KAB_EMBEDDED | 109 | #ifndef KAB_EMBEDDED |
107 | ASYNC KAddressBookMain::showContactEditor( QString uid ) | 110 | ASYNC KAddressBookMain::showContactEditor( QString uid ) |
108 | { | 111 | { |
109 | mCore->editContact( uid ); | 112 | mCore->editContact( uid ); |
110 | } | 113 | } |
111 | #endif //KAB_EMBEDDED | 114 | #endif //KAB_EMBEDDED |
112 | void KAddressBookMain::newContact() | 115 | void KAddressBookMain::newContact() |
113 | { | 116 | { |
114 | mCore->newContact(); | 117 | mCore->newContact(); |
115 | } | 118 | } |
116 | 119 | ||
117 | QString KAddressBookMain::getNameByPhone( QString phone ) | 120 | QString KAddressBookMain::getNameByPhone( QString phone ) |
118 | { | 121 | { |
119 | return mCore->getNameByPhone( phone ); | 122 | return mCore->getNameByPhone( phone ); |
120 | } | 123 | } |
@@ -206,36 +209,35 @@ void KAddressBookMain::closeEvent( QCloseEvent* ce ) | |||
206 | QString mess = i18n( "Close KA/Pi?"); | 209 | QString mess = i18n( "Close KA/Pi?"); |
207 | if ( mModified == true ) | 210 | if ( mModified == true ) |
208 | mess += i18n( "\nChanges will be saved!"); | 211 | mess += i18n( "\nChanges will be saved!"); |
209 | else | 212 | else |
210 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); | 213 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); |
211 | 214 | ||
212 | bool mQuit = true; | 215 | bool mQuit = true; |
213 | 216 | ||
214 | 217 | ||
215 | if (mAskForQuit) | 218 | if (mAskForQuit) |
216 | { | 219 | { |
217 | 220 | ||
218 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); | 221 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); |
219 | if (res == 0) | 222 | if (res == 0) |
220 | mQuit = true; | 223 | mQuit = true; |
221 | else | 224 | else |
222 | mQuit = false; | 225 | mQuit = false; |
223 | } | 226 | } |
224 | 227 | ||
225 | if (mQuit == false) | 228 | if (mQuit == false) |
226 | return; | 229 | return; |
227 | 230 | ||
228 | if (mModified == true) | 231 | if (mModified == true) |
229 | { | 232 | { |
230 | save(); | 233 | save(); |
231 | mCore->saveSettings(); | 234 | mCore->saveSettings(); |
232 | //KABPrefs::instance()->writeConfig(); | 235 | //KABPrefs::instance()->writeConfig(); |
233 | } | 236 | } |
234 | 237 | ||
235 | ce->accept(); | 238 | ce->accept(); |
236 | } | 239 | } |
237 | 240 | ||
238 | #ifndef KAB_EMBEDDED | 241 | #ifndef KAB_EMBEDDED_ |
239 | #include "kaddressbookmain.moc" | 242 | #include "moc_kaddressbookmain.cpp" |
240 | #endif //KAB_EMBEDDED | 243 | #endif //KAB_EMBEDDED |
241 | |||