author | zautrix <zautrix> | 2004-09-15 11:10:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 11:10:41 (UTC) |
commit | 12091abdaa7e60e408fc248e286f37e12cb10a23 (patch) (unidiff) | |
tree | ea180ecc6687978492e4040d4efc9c8793f178af | |
parent | d4adafe41cf399585b8e35cb600ff35706d55ae0 (diff) | |
download | kdepimpi-12091abdaa7e60e408fc248e286f37e12cb10a23.zip kdepimpi-12091abdaa7e60e408fc248e286f37e12cb10a23.tar.gz kdepimpi-12091abdaa7e60e408fc248e286f37e12cb10a23.tar.bz2 |
Close kopi fix
-rw-r--r-- | korganizer/mainwindow.cpp | 7 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index aa30b52..3bc6081 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -50,48 +50,49 @@ | |||
50 | #include "koglobals.h" | 50 | #include "koglobals.h" |
51 | #include "kglobal.h" | 51 | #include "kglobal.h" |
52 | #include "klocale.h" | 52 | #include "klocale.h" |
53 | #include "kconfig.h" | 53 | #include "kconfig.h" |
54 | #include "simplealarmclient.h" | 54 | #include "simplealarmclient.h" |
55 | #include "externalapphandler.h" | 55 | #include "externalapphandler.h" |
56 | 56 | ||
57 | using namespace KCal; | 57 | using namespace KCal; |
58 | #ifndef _WIN32_ | 58 | #ifndef _WIN32_ |
59 | #include <unistd.h> | 59 | #include <unistd.h> |
60 | #else | 60 | #else |
61 | #include "koimportoldialog.h" | 61 | #include "koimportoldialog.h" |
62 | #endif | 62 | #endif |
63 | #include "mainwindow.h" | 63 | #include "mainwindow.h" |
64 | 64 | ||
65 | int globalFlagBlockStartup; | 65 | int globalFlagBlockStartup; |
66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
67 | QMainWindow( parent, name ) | 67 | QMainWindow( parent, name ) |
68 | { | 68 | { |
69 | 69 | ||
70 | #ifdef DESKTOP_VERSION | 70 | #ifdef DESKTOP_VERSION |
71 | setFont( QFont("Arial"), 14 ); | 71 | setFont( QFont("Arial"), 14 ); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | mClosed = false; | ||
74 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 75 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
75 | QString confFile = locateLocal("config","korganizerrc"); | 76 | QString confFile = locateLocal("config","korganizerrc"); |
76 | QFileInfo finf ( confFile ); | 77 | QFileInfo finf ( confFile ); |
77 | bool showWarning = !finf.exists(); | 78 | bool showWarning = !finf.exists(); |
78 | setIcon(SmallIcon( "ko24" ) ); | 79 | setIcon(SmallIcon( "ko24" ) ); |
79 | mBlockAtStartup = true; | 80 | mBlockAtStartup = true; |
80 | mFlagKeyPressed = false; | 81 | mFlagKeyPressed = false; |
81 | setCaption("KOrganizer/Pi"); | 82 | setCaption("KOrganizer/Pi"); |
82 | KOPrefs *p = KOPrefs::instance(); | 83 | KOPrefs *p = KOPrefs::instance(); |
83 | // if ( QApplication::desktop()->height() > 480 ) { | 84 | // if ( QApplication::desktop()->height() > 480 ) { |
84 | // if ( p->mHourSize == 4 ) | 85 | // if ( p->mHourSize == 4 ) |
85 | // p->mHourSize = 6; | 86 | // p->mHourSize = 6; |
86 | // } | 87 | // } |
87 | if ( p->mHourSize > 18 ) | 88 | if ( p->mHourSize > 18 ) |
88 | p->mHourSize = 18; | 89 | p->mHourSize = 18; |
89 | QMainWindow::ToolBarDock tbd; | 90 | QMainWindow::ToolBarDock tbd; |
90 | if ( p->mToolBarHor ) { | 91 | if ( p->mToolBarHor ) { |
91 | if ( p->mToolBarUp ) | 92 | if ( p->mToolBarUp ) |
92 | tbd = Bottom; | 93 | tbd = Bottom; |
93 | else | 94 | else |
94 | tbd = Top; | 95 | tbd = Top; |
95 | } | 96 | } |
96 | else { | 97 | else { |
97 | if ( p->mToolBarUp ) | 98 | if ( p->mToolBarUp ) |
@@ -200,70 +201,74 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
200 | qApp->processEvents(); | 201 | qApp->processEvents(); |
201 | mView->dialogManager()->showSyncOptions(); | 202 | mView->dialogManager()->showSyncOptions(); |
202 | } | 203 | } |
203 | 204 | ||
204 | //US listen for result adressed from Ka/Pi | 205 | //US listen for result adressed from Ka/Pi |
205 | #ifndef DESKTOP_VERSION | 206 | #ifndef DESKTOP_VERSION |
206 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 207 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
207 | #endif | 208 | #endif |
208 | } | 209 | } |
209 | MainWindow::~MainWindow() | 210 | MainWindow::~MainWindow() |
210 | { | 211 | { |
211 | //qDebug("MainWindow::~MainWindow() "); | 212 | //qDebug("MainWindow::~MainWindow() "); |
212 | //save toolbar location | 213 | //save toolbar location |
213 | 214 | ||
214 | delete mCalendar; | 215 | delete mCalendar; |
215 | delete KOPrefs::instance(); | 216 | delete KOPrefs::instance(); |
216 | delete KIncidenceFormatter::instance(); | 217 | delete KIncidenceFormatter::instance(); |
217 | 218 | ||
218 | 219 | ||
219 | } | 220 | } |
220 | void MainWindow::showMaximized () | 221 | void MainWindow::showMaximized () |
221 | { | 222 | { |
222 | #ifndef DESKTOP_VERSION | 223 | #ifndef DESKTOP_VERSION |
223 | if ( ! globalFlagBlockStartup ) | 224 | if ( ! globalFlagBlockStartup ) |
224 | mView->goToday(); | 225 | if ( mClosed ) |
226 | mView->goToday(); | ||
225 | #endif | 227 | #endif |
226 | QWidget::showMaximized () ; | 228 | QWidget::showMaximized () ; |
229 | mClosed = false; | ||
227 | } | 230 | } |
228 | void MainWindow::closeEvent( QCloseEvent* ce ) | 231 | void MainWindow::closeEvent( QCloseEvent* ce ) |
229 | { | 232 | { |
230 | 233 | ||
231 | 234 | ||
232 | 235 | ||
233 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 236 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
234 | saveOnClose(); | 237 | saveOnClose(); |
238 | mClosed = true; | ||
235 | ce->accept(); | 239 | ce->accept(); |
236 | return; | 240 | return; |
237 | 241 | ||
238 | } | 242 | } |
239 | 243 | ||
240 | switch( QMessageBox::information( this, "KO/Pi", | 244 | switch( QMessageBox::information( this, "KO/Pi", |
241 | i18n("Do you really want\nto close KO/Pi?"), | 245 | i18n("Do you really want\nto close KO/Pi?"), |
242 | i18n("Close"), i18n("No"), | 246 | i18n("Close"), i18n("No"), |
243 | 0, 0 ) ) { | 247 | 0, 0 ) ) { |
244 | case 0: | 248 | case 0: |
245 | saveOnClose(); | 249 | saveOnClose(); |
250 | mClosed = true; | ||
246 | ce->accept(); | 251 | ce->accept(); |
247 | break; | 252 | break; |
248 | case 1: | 253 | case 1: |
249 | ce->ignore(); | 254 | ce->ignore(); |
250 | break; | 255 | break; |
251 | case 2: | 256 | case 2: |
252 | 257 | ||
253 | default: | 258 | default: |
254 | break; | 259 | break; |
255 | } | 260 | } |
256 | 261 | ||
257 | 262 | ||
258 | } | 263 | } |
259 | 264 | ||
260 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 265 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
261 | { | 266 | { |
262 | QDataStream stream( data, IO_ReadOnly ); | 267 | QDataStream stream( data, IO_ReadOnly ); |
263 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 268 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
264 | //QString datamess; | 269 | //QString datamess; |
265 | //qDebug("message "); | 270 | //qDebug("message "); |
266 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 271 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
267 | 272 | ||
268 | if ( cmsg == "-writeFile" ) { | 273 | if ( cmsg == "-writeFile" ) { |
269 | // I made from the "-writeFile" an "-writeAlarm" | 274 | // I made from the "-writeFile" an "-writeAlarm" |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 3e854cb..47a7a90 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -68,48 +68,49 @@ class MainWindow : public QMainWindow | |||
68 | void printCal(); | 68 | void printCal(); |
69 | void saveCalendar(); | 69 | void saveCalendar(); |
70 | void loadCalendar(); | 70 | void loadCalendar(); |
71 | void exportVCalendar(); | 71 | void exportVCalendar(); |
72 | void fillFilterMenu(); | 72 | void fillFilterMenu(); |
73 | void selectFilter( int ); | 73 | void selectFilter( int ); |
74 | 74 | ||
75 | void slotSyncMenu( int ); | 75 | void slotSyncMenu( int ); |
76 | void syncSSH(); | 76 | void syncSSH(); |
77 | void confSync(); | 77 | void confSync(); |
78 | void syncSharp(); | 78 | void syncSharp(); |
79 | void syncPhone(); | 79 | void syncPhone(); |
80 | void syncLocalFile(); | 80 | void syncLocalFile(); |
81 | bool syncWithFile( QString, bool ); | 81 | bool syncWithFile( QString, bool ); |
82 | void quickSyncLocalFile(); | 82 | void quickSyncLocalFile(); |
83 | 83 | ||
84 | 84 | ||
85 | protected: | 85 | protected: |
86 | void displayText( QString, QString); | 86 | void displayText( QString, QString); |
87 | void displayFile( QString, QString); | 87 | void displayFile( QString, QString); |
88 | 88 | ||
89 | void enableIncidenceActions( bool ); | 89 | void enableIncidenceActions( bool ); |
90 | 90 | ||
91 | private: | 91 | private: |
92 | bool mClosed; | ||
92 | void saveOnClose(); | 93 | void saveOnClose(); |
93 | int mCurrentSyncProfile; | 94 | int mCurrentSyncProfile; |
94 | void syncRemote( KSyncProfile* , bool ask = true); | 95 | void syncRemote( KSyncProfile* , bool ask = true); |
95 | void fillSyncMenu(); | 96 | void fillSyncMenu(); |
96 | bool mFlagKeyPressed; | 97 | bool mFlagKeyPressed; |
97 | bool mBlockAtStartup; | 98 | bool mBlockAtStartup; |
98 | QPEToolBar *iconToolBar; | 99 | QPEToolBar *iconToolBar; |
99 | void initActions(); | 100 | void initActions(); |
100 | void setDefaultPreferences(); | 101 | void setDefaultPreferences(); |
101 | void keyPressEvent ( QKeyEvent * ) ; | 102 | void keyPressEvent ( QKeyEvent * ) ; |
102 | void keyReleaseEvent ( QKeyEvent * ) ; | 103 | void keyReleaseEvent ( QKeyEvent * ) ; |
103 | QPopupMenu *configureToolBarMenu; | 104 | QPopupMenu *configureToolBarMenu; |
104 | QPopupMenu *selectFilterMenu; | 105 | QPopupMenu *selectFilterMenu; |
105 | QPopupMenu *configureAgendaMenu, *syncMenu; | 106 | QPopupMenu *configureAgendaMenu, *syncMenu; |
106 | CalendarLocal *mCalendar; | 107 | CalendarLocal *mCalendar; |
107 | CalendarView *mView; | 108 | CalendarView *mView; |
108 | QString getPassword(); | 109 | QString getPassword(); |
109 | QAction *mNewSubTodoAction; | 110 | QAction *mNewSubTodoAction; |
110 | 111 | ||
111 | QAction *mShowAction; | 112 | QAction *mShowAction; |
112 | QAction *mEditAction; | 113 | QAction *mEditAction; |
113 | QAction *mDeleteAction; | 114 | QAction *mDeleteAction; |
114 | void closeEvent( QCloseEvent* ce ); | 115 | void closeEvent( QCloseEvent* ce ); |
115 | SimpleAlarmClient mAlarmClient; | 116 | SimpleAlarmClient mAlarmClient; |