Diffstat (limited to 'kaddressbook/kaddressbookmain.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8fe3ee0..c417226 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -1,241 +1,241 @@ | |||
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 |
43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) | 43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" ) |
44 | #else //KAB_EMBEDDED | 44 | #else //KAB_EMBEDDED |
45 | //MOC_SKIP_BEGIN | 45 | //MOC_SKIP_BEGIN |
46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) | 46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) |
47 | //MOC_SKIP_END | 47 | //MOC_SKIP_END |
48 | #endif //KAB_EMBEDDED | 48 | #endif //KAB_EMBEDDED |
49 | { | 49 | { |
50 | setIcon(SmallIcon( "ka24" ) ); | 50 | setIcon(SmallIcon( "ka24" ) ); |
51 | #if 0 | 51 | #if 0 |
52 | //US for embedded systems, create the toolbar before we initiate KABCore. | 52 | //US for embedded systems, create the toolbar before we initiate KABCore. |
53 | // KABCore will fill the toolbar with menues and icons | 53 | // KABCore will fill the toolbar with menues and icons |
54 | QMainWindow::ToolBarDock tbd; | 54 | QMainWindow::ToolBarDock tbd; |
55 | tbd = Top; | 55 | tbd = Top; |
56 | iconToolBar = new QToolBar( this ); | 56 | iconToolBar = new QToolBar( this ); |
57 | addToolBar (iconToolBar , tbd ); | 57 | addToolBar (iconToolBar , tbd ); |
58 | iconToolBar->setHorizontalStretchable(true); | 58 | iconToolBar->setHorizontalStretchable(true); |
59 | //US iconToolBar->setWidth(300); | 59 | //US iconToolBar->setWidth(300); |
60 | #endif // 0 | 60 | #endif // 0 |
61 | 61 | ||
62 | mCore = new KABCore( this, true, this ); | 62 | mCore = new KABCore( this, true, this ); |
63 | 63 | ||
64 | #ifdef KAB_EMBEDDED | 64 | #ifdef KAB_EMBEDDED |
65 | setCaption( i18n( "KAddressbook/Pi" ) ); | 65 | setCaption( i18n( "KAddressbook/Pi" ) ); |
66 | #else //KAB_EMBEDDED | 66 | #else //KAB_EMBEDDED |
67 | setCaption( i18n( "Address Book Browser" ) ); | 67 | setCaption( i18n( "Address Book Browser" ) ); |
68 | #endif //KAB_EMBEDDED | 68 | #endif //KAB_EMBEDDED |
69 | 69 | ||
70 | //mCore->restoreSettings(); | 70 | //mCore->restoreSettings(); |
71 | 71 | ||
72 | initActions(); | 72 | initActions(); |
73 | 73 | ||
74 | setCentralWidget( mCore ); | 74 | setCentralWidget( mCore ); |
75 | 75 | ||
76 | //US statusBar()->show(); | 76 | //US statusBar()->show(); |
77 | 77 | ||
78 | #ifndef KAB_EMBEDDED | 78 | #ifndef KAB_EMBEDDED |
79 | setStandardToolBarMenuEnabled(true); | 79 | setStandardToolBarMenuEnabled(true); |
80 | 80 | ||
81 | createGUI( "kaddressbookui.rc", false ); | 81 | createGUI( "kaddressbookui.rc", false ); |
82 | 82 | ||
83 | 83 | ||
84 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
85 | setAutoSaveSettings(); | 85 | setAutoSaveSettings(); |
86 | mCore->restoreSettings(); | 86 | mCore->restoreSettings(); |
87 | #ifndef DESKTOP_VERSION | 87 | #ifndef DESKTOP_VERSION |
88 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & ))); | 88 | QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & ))); |
89 | #endif | 89 | #endif |
90 | } | 90 | } |
91 | 91 | ||
92 | KAddressBookMain::~KAddressBookMain() | 92 | KAddressBookMain::~KAddressBookMain() |
93 | { | 93 | { |
94 | // mCore->saveSettings(); | 94 | // mCore->saveSettings(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void KAddressBookMain::showMinimized () | 97 | void KAddressBookMain::showMinimized () |
98 | { | 98 | { |
99 | QWidget::showMinimized () ; | 99 | QWidget::showMinimized () ; |
100 | } | 100 | } |
101 | void KAddressBookMain::addEmail( QString addr ) | 101 | void KAddressBookMain::addEmail( QString addr ) |
102 | { | 102 | { |
103 | mCore->addEmail( addr ); | 103 | mCore->addEmail( addr ); |
104 | } | 104 | } |
105 | 105 | ||
106 | #ifndef KAB_EMBEDDED | 106 | #ifndef KAB_EMBEDDED |
107 | ASYNC KAddressBookMain::showContactEditor( QString uid ) | 107 | ASYNC KAddressBookMain::showContactEditor( QString uid ) |
108 | { | 108 | { |
109 | mCore->editContact( uid ); | 109 | mCore->editContact( uid ); |
110 | } | 110 | } |
111 | #endif //KAB_EMBEDDED | 111 | #endif //KAB_EMBEDDED |
112 | void KAddressBookMain::newContact() | 112 | void KAddressBookMain::newContact() |
113 | { | 113 | { |
114 | mCore->newContact(); | 114 | mCore->newContact(); |
115 | } | 115 | } |
116 | 116 | ||
117 | QString KAddressBookMain::getNameByPhone( QString phone ) | 117 | QString KAddressBookMain::getNameByPhone( QString phone ) |
118 | { | 118 | { |
119 | return mCore->getNameByPhone( phone ); | 119 | return mCore->getNameByPhone( phone ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void KAddressBookMain::save() | 122 | void KAddressBookMain::save() |
123 | { | 123 | { |
124 | mCore->save(); | 124 | mCore->save(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void KAddressBookMain::exit() | 127 | void KAddressBookMain::exit() |
128 | { | 128 | { |
129 | close( ); | 129 | close( ); |
130 | } | 130 | } |
131 | 131 | ||
132 | void KAddressBookMain::saveProperties( KConfig* ) | 132 | void KAddressBookMain::saveProperties( KConfig* ) |
133 | { | 133 | { |
134 | } | 134 | } |
135 | 135 | ||
136 | void KAddressBookMain::readProperties( KConfig* ) | 136 | void KAddressBookMain::readProperties( KConfig* ) |
137 | { | 137 | { |
138 | } | 138 | } |
139 | 139 | ||
140 | void KAddressBookMain::initActions() | 140 | void KAddressBookMain::initActions() |
141 | { | 141 | { |
142 | #ifndef KAB_EMBEDDED | 142 | #ifndef KAB_EMBEDDED |
143 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); | 143 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); |
144 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); | 144 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); |
145 | #else //KAB_EMBEDDED | 145 | #else //KAB_EMBEDDED |
146 | //US: transfered the setup of the actions into KABCore | 146 | //US: transfered the setup of the actions into KABCore |
147 | #endif //KAB_EMBEDDED | 147 | #endif //KAB_EMBEDDED |
148 | 148 | ||
149 | 149 | ||
150 | } | 150 | } |
151 | 151 | ||
152 | //US new method to setup menues and toolbars on embedded systems | 152 | //US new method to setup menues and toolbars on embedded systems |
153 | #ifdef KAB_EMBEDDED | 153 | #ifdef KAB_EMBEDDED |
154 | /* | 154 | /* |
155 | QToolBar * KAddressBookMain::getIconToolBar() | 155 | QToolBar * KAddressBookMain::getIconToolBar() |
156 | { | 156 | { |
157 | return iconToolBar; | 157 | return iconToolBar; |
158 | } | 158 | } |
159 | */ | 159 | */ |
160 | 160 | ||
161 | void KAddressBookMain::createGUI() | 161 | void KAddressBookMain::createGUI() |
162 | { | 162 | { |
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | } | 166 | } |
167 | #endif //KAB_EMBEDDED | 167 | #endif //KAB_EMBEDDED |
168 | 168 | ||
169 | void KAddressBookMain::configureToolbars() | 169 | void KAddressBookMain::configureToolbars() |
170 | { | 170 | { |
171 | #ifndef KAB_EMBEDDED | 171 | #ifndef KAB_EMBEDDED |
172 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); | 172 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); |
173 | 173 | ||
174 | KEditToolbar dlg( factory() ); | 174 | KEditToolbar dlg( factory() ); |
175 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); | 175 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); |
176 | 176 | ||
177 | dlg.exec(); | 177 | dlg.exec(); |
178 | #else //KAB_EMBEDDED | 178 | #else //KAB_EMBEDDED |
179 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); | 179 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); |
180 | #endif //KAB_EMBEDDED | 180 | #endif //KAB_EMBEDDED |
181 | } | 181 | } |
182 | 182 | ||
183 | void KAddressBookMain::slotNewToolbarConfig() | 183 | void KAddressBookMain::slotNewToolbarConfig() |
184 | { | 184 | { |
185 | #ifndef KAB_EMBEDDED | 185 | #ifndef KAB_EMBEDDED |
186 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); | 186 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); |
187 | #else //KAB_EMBEDDED | 187 | #else //KAB_EMBEDDED |
188 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); | 188 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); |
189 | #endif //KAB_EMBEDDED | 189 | #endif //KAB_EMBEDDED |
190 | } | 190 | } |
191 | 191 | ||
192 | void KAddressBookMain::configureKeys() | 192 | void KAddressBookMain::configureKeys() |
193 | { | 193 | { |
194 | #ifndef KAB_EMBEDDED | 194 | #ifndef KAB_EMBEDDED |
195 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); | 195 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); |
196 | #else //KAB_EMBEDDED | 196 | #else //KAB_EMBEDDED |
197 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); | 197 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); |
198 | #endif //KAB_EMBEDDED | 198 | #endif //KAB_EMBEDDED |
199 | } | 199 | } |
200 | 200 | ||
201 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) | 201 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) |
202 | { | 202 | { |
203 | bool mModified = mCore->modified(); | 203 | bool mModified = mCore->modified(); |
204 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; | 204 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; |
205 | 205 | ||
206 | QString mess = i18n( "Close KA/Pi?"); | 206 | QString mess = i18n( "Close KA/Pi?"); |
207 | if ( mModified == true ) | 207 | if ( mModified == true ) |
208 | mess += i18n( "\nChanges will be saved!"); | 208 | mess += i18n( "\nChanges will be saved!"); |
209 | else | 209 | else |
210 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); | 210 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); |
211 | 211 | ||
212 | bool mQuit = true; | 212 | bool mQuit = true; |
213 | 213 | ||
214 | 214 | ||
215 | if (mAskForQuit) | 215 | if (mAskForQuit) |
216 | { | 216 | { |
217 | 217 | ||
218 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); | 218 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); |
219 | if (res == 0) | 219 | if (res == 0) |
220 | mQuit = true; | 220 | mQuit = true; |
221 | else | 221 | else |
222 | mQuit = false; | 222 | mQuit = false; |
223 | } | 223 | } |
224 | 224 | ||
225 | if (mQuit == false) | 225 | if (mQuit == false) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | if (mModified == true) | 228 | if (mModified == true) |
229 | { | 229 | { |
230 | save(); | 230 | save(); |
231 | mCore->saveSettings(); | 231 | mCore->saveSettings(); |
232 | //KABPrefs::instance()->writeConfig(); | 232 | //KABPrefs::instance()->writeConfig(); |
233 | } | 233 | } |
234 | 234 | ||
235 | ce->accept(); | 235 | ce->accept(); |
236 | } | 236 | } |
237 | 237 | ||
238 | #ifndef KAB_EMBEDDED | 238 | #ifndef KAB_EMBEDDED |
239 | #include "kaddressbookmain.moc" | 239 | #include "kaddressbookmain.moc" |
240 | #endif //KAB_EMBEDDED | 240 | #endif //KAB_EMBEDDED |
241 | 241 | ||