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 | |||
@@ -1,629 +1,634 @@ | |||
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 <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qmap.h> | 14 | #include <qmap.h> |
15 | #include <qwmatrix.h> | 15 | #include <qwmatrix.h> |
16 | #include <qtextbrowser.h> | 16 | #include <qtextbrowser.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #ifndef DESKTOP_VERSION | 18 | #ifndef DESKTOP_VERSION |
19 | #include <qpe/global.h> | 19 | #include <qpe/global.h> |
20 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qtopia/alarmserver.h> | 24 | #include <qtopia/alarmserver.h> |
25 | #include <qtopia/qcopenvelope_qws.h> | 25 | #include <qtopia/qcopenvelope_qws.h> |
26 | #else | 26 | #else |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //#include <resource.h> | 30 | //#include <resource.h> |
31 | 31 | ||
32 | #endif | 32 | #endif |
33 | #include <libkcal/calendarlocal.h> | 33 | #include <libkcal/calendarlocal.h> |
34 | #include <libkcal/todo.h> | 34 | #include <libkcal/todo.h> |
35 | #include <libkdepim/ksyncprofile.h> | 35 | #include <libkdepim/ksyncprofile.h> |
36 | #include <libkdepim/kincidenceformatter.h> | 36 | #include <libkdepim/kincidenceformatter.h> |
37 | 37 | ||
38 | #include "calendarview.h" | 38 | #include "calendarview.h" |
39 | #include "koviewmanager.h" | 39 | #include "koviewmanager.h" |
40 | #include "datenavigator.h" | 40 | #include "datenavigator.h" |
41 | #include "koagendaview.h" | 41 | #include "koagendaview.h" |
42 | #include "koagenda.h" | 42 | #include "koagenda.h" |
43 | #include "kodialogmanager.h" | 43 | #include "kodialogmanager.h" |
44 | #include "kdialogbase.h" | 44 | #include "kdialogbase.h" |
45 | #include "kapplication.h" | 45 | #include "kapplication.h" |
46 | #include "kofilterview.h" | 46 | #include "kofilterview.h" |
47 | #include "kstandarddirs.h" | 47 | #include "kstandarddirs.h" |
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "kfiledialog.h" | 49 | #include "kfiledialog.h" |
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 ) |
98 | tbd = Right; | 99 | tbd = Right; |
99 | else | 100 | else |
100 | tbd = Left; | 101 | tbd = Left; |
101 | } | 102 | } |
102 | if ( KOPrefs::instance()->mUseAppColors ) | 103 | if ( KOPrefs::instance()->mUseAppColors ) |
103 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 104 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
104 | globalFlagBlockStartup = 1; | 105 | globalFlagBlockStartup = 1; |
105 | iconToolBar = new QPEToolBar( this ); | 106 | iconToolBar = new QPEToolBar( this ); |
106 | addToolBar (iconToolBar , tbd ); | 107 | addToolBar (iconToolBar , tbd ); |
107 | mBlockSaveFlag = false; | 108 | mBlockSaveFlag = false; |
108 | mCalendarModifiedFlag = false; | 109 | mCalendarModifiedFlag = false; |
109 | 110 | ||
110 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 111 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
111 | splash->setAlignment ( AlignCenter ); | 112 | splash->setAlignment ( AlignCenter ); |
112 | setCentralWidget( splash ); | 113 | setCentralWidget( splash ); |
113 | #ifndef DESKTOP_VERSION | 114 | #ifndef DESKTOP_VERSION |
114 | showMaximized(); | 115 | showMaximized(); |
115 | #endif | 116 | #endif |
116 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 117 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
117 | setDefaultPreferences(); | 118 | setDefaultPreferences(); |
118 | mCalendar = new CalendarLocal(); | 119 | mCalendar = new CalendarLocal(); |
119 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 120 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
120 | mView->hide(); | 121 | mView->hide(); |
121 | //mView->resize(splash->size() ); | 122 | //mView->resize(splash->size() ); |
122 | initActions(); | 123 | initActions(); |
123 | #ifndef DESKTOP_VERSION | 124 | #ifndef DESKTOP_VERSION |
124 | iconToolBar->show(); | 125 | iconToolBar->show(); |
125 | qApp->processEvents(); | 126 | qApp->processEvents(); |
126 | #endif | 127 | #endif |
127 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 128 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
128 | int vh = height() ; | 129 | int vh = height() ; |
129 | int vw = width(); | 130 | int vw = width(); |
130 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 131 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
131 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 132 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
132 | vh -= iconToolBar->height(); | 133 | vh -= iconToolBar->height(); |
133 | } else { | 134 | } else { |
134 | vw -= iconToolBar->height(); | 135 | vw -= iconToolBar->height(); |
135 | } | 136 | } |
136 | //mView->setMaximumSize( splash->size() ); | 137 | //mView->setMaximumSize( splash->size() ); |
137 | //mView->resize( splash->size() ); | 138 | //mView->resize( splash->size() ); |
138 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 139 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
139 | mView->readSettings(); | 140 | mView->readSettings(); |
140 | bool oldOpened = false; | 141 | bool oldOpened = false; |
141 | bool newFile = false; | 142 | bool newFile = false; |
142 | if( !QFile::exists( defaultFileName() ) ) { | 143 | if( !QFile::exists( defaultFileName() ) ) { |
143 | QFileInfo finfo ( defaultFileName() ); | 144 | QFileInfo finfo ( defaultFileName() ); |
144 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 145 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
145 | qDebug("oldfile %s ", oldFile.latin1()); | 146 | qDebug("oldfile %s ", oldFile.latin1()); |
146 | 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"; | 147 | 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"; |
147 | finfo.setFile( oldFile ); | 148 | finfo.setFile( oldFile ); |
148 | if (finfo.exists() ) { | 149 | if (finfo.exists() ) { |
149 | KMessageBox::information( this, message); | 150 | KMessageBox::information( this, message); |
150 | mView->openCalendar( oldFile ); | 151 | mView->openCalendar( oldFile ); |
151 | qApp->processEvents(); | 152 | qApp->processEvents(); |
152 | } else { | 153 | } else { |
153 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 154 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
154 | finfo.setFile( oldFile ); | 155 | finfo.setFile( oldFile ); |
155 | if (finfo.exists() ) { | 156 | if (finfo.exists() ) { |
156 | KMessageBox::information( this, message); | 157 | KMessageBox::information( this, message); |
157 | mView->openCalendar( oldFile ); | 158 | mView->openCalendar( oldFile ); |
158 | qApp->processEvents(); | 159 | qApp->processEvents(); |
159 | } | 160 | } |
160 | } | 161 | } |
161 | mView->saveCalendar( defaultFileName() ); | 162 | mView->saveCalendar( defaultFileName() ); |
162 | newFile = true; | 163 | newFile = true; |
163 | } | 164 | } |
164 | 165 | ||
165 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 166 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
166 | if ( ! oldOpened ) | 167 | if ( ! oldOpened ) |
167 | mView->openCalendar( defaultFileName() ); | 168 | mView->openCalendar( defaultFileName() ); |
168 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 169 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
169 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 170 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
170 | 171 | ||
171 | if ( KOPrefs::instance()->mLanguageChanged ) { | 172 | if ( KOPrefs::instance()->mLanguageChanged ) { |
172 | KOPrefs::instance()->setCategoryDefaults(); | 173 | KOPrefs::instance()->setCategoryDefaults(); |
173 | int count = mView->addCategories(); | 174 | int count = mView->addCategories(); |
174 | KOPrefs::instance()->mLanguageChanged = false; | 175 | KOPrefs::instance()->mLanguageChanged = false; |
175 | } | 176 | } |
176 | processIncidenceSelection( 0 ); | 177 | processIncidenceSelection( 0 ); |
177 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 178 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
178 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 179 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
179 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 180 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
180 | SLOT( slotModifiedChanged( bool ) ) ); | 181 | SLOT( slotModifiedChanged( bool ) ) ); |
181 | 182 | ||
182 | 183 | ||
183 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 184 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
184 | mView->setModified( false ); | 185 | mView->setModified( false ); |
185 | mBlockAtStartup = false; | 186 | mBlockAtStartup = false; |
186 | mView->setModified( false ); | 187 | mView->setModified( false ); |
187 | setCentralWidget( mView ); | 188 | setCentralWidget( mView ); |
188 | globalFlagBlockStartup = 0; | 189 | globalFlagBlockStartup = 0; |
189 | mView->show(); | 190 | mView->show(); |
190 | delete splash; | 191 | delete splash; |
191 | if ( newFile ) | 192 | if ( newFile ) |
192 | mView->updateConfig(); | 193 | mView->updateConfig(); |
193 | // qApp->processEvents(); | 194 | // qApp->processEvents(); |
194 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 195 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
195 | fillSyncMenu(); | 196 | fillSyncMenu(); |
196 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 197 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
197 | if ( showWarning ) { | 198 | if ( showWarning ) { |
198 | KMessageBox::information( this, | 199 | KMessageBox::information( this, |
199 | "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"); | 200 | "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"); |
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" |
270 | mView->viewManager()->showWhatsNextView(); | 275 | mView->viewManager()->showWhatsNextView(); |
271 | mCalendar->checkAlarmForIncidence( 0, true); | 276 | mCalendar->checkAlarmForIncidence( 0, true); |
272 | showMaximized(); | 277 | showMaximized(); |
273 | raise(); | 278 | raise(); |
274 | return; | 279 | return; |
275 | } | 280 | } |
276 | 281 | ||
277 | if ( cmsg == "-writeFile" ) { | 282 | if ( cmsg == "-writeFile" ) { |
278 | // I made from the "-writeFile" an "-writeAlarm" | 283 | // I made from the "-writeFile" an "-writeAlarm" |
279 | mView->viewManager()->showWhatsNextView(); | 284 | mView->viewManager()->showWhatsNextView(); |
280 | mCalendar->checkAlarmForIncidence( 0, true); | 285 | mCalendar->checkAlarmForIncidence( 0, true); |
281 | showMaximized(); | 286 | showMaximized(); |
282 | raise(); | 287 | raise(); |
283 | return; | 288 | return; |
284 | 289 | ||
285 | } | 290 | } |
286 | if ( cmsg == "-writeFileSilent" ) { | 291 | if ( cmsg == "-writeFileSilent" ) { |
287 | // I made from the "-writeFile" an "-writeAlarm" | 292 | // I made from the "-writeFile" an "-writeAlarm" |
288 | // mView->viewManager()->showWhatsNextView(); | 293 | // mView->viewManager()->showWhatsNextView(); |
289 | mCalendar->checkAlarmForIncidence( 0, true); | 294 | mCalendar->checkAlarmForIncidence( 0, true); |
290 | //showMaximized(); | 295 | //showMaximized(); |
291 | //raise(); | 296 | //raise(); |
292 | hide(); | 297 | hide(); |
293 | return; | 298 | return; |
294 | } | 299 | } |
295 | if ( cmsg == "-newCountdown" ) { | 300 | if ( cmsg == "-newCountdown" ) { |
296 | qDebug("newCountdown "); | 301 | qDebug("newCountdown "); |
297 | 302 | ||
298 | } | 303 | } |
299 | QString msg ; | 304 | QString msg ; |
300 | QString allmsg = cmsg; | 305 | QString allmsg = cmsg; |
301 | while ( allmsg.length() > 0 ) { | 306 | while ( allmsg.length() > 0 ) { |
302 | int nextC = allmsg.find( "-", 1 ); | 307 | int nextC = allmsg.find( "-", 1 ); |
303 | if ( nextC == -1 ) { | 308 | if ( nextC == -1 ) { |
304 | msg = allmsg; | 309 | msg = allmsg; |
305 | allmsg = ""; | 310 | allmsg = ""; |
306 | } else{ | 311 | } else{ |
307 | msg = allmsg.left( nextC ); | 312 | msg = allmsg.left( nextC ); |
308 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 313 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
309 | } | 314 | } |
310 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 315 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
311 | if ( msg == "-newEvent" ) { | 316 | if ( msg == "-newEvent" ) { |
312 | mView->newEvent(); | 317 | mView->newEvent(); |
313 | } | 318 | } |
314 | if ( msg == "-newTodo" ) { | 319 | if ( msg == "-newTodo" ) { |
315 | mView->newTodo(); | 320 | mView->newTodo(); |
316 | 321 | ||
317 | } | 322 | } |
318 | if ( msg == "-showWN" ) { | 323 | if ( msg == "-showWN" ) { |
319 | mView->viewManager()->showWhatsNextView(); | 324 | mView->viewManager()->showWhatsNextView(); |
320 | } | 325 | } |
321 | if ( msg == "-showTodo" ) { | 326 | if ( msg == "-showTodo" ) { |
322 | mView->viewManager()->showTodoView(); | 327 | mView->viewManager()->showTodoView(); |
323 | } | 328 | } |
324 | if ( msg == "-showList" ) { | 329 | if ( msg == "-showList" ) { |
325 | mView->viewManager()->showListView(); | 330 | mView->viewManager()->showListView(); |
326 | } | 331 | } |
327 | else if ( msg == "-showDay" ) { | 332 | else if ( msg == "-showDay" ) { |
328 | mView->viewManager()->showDayView(); | 333 | mView->viewManager()->showDayView(); |
329 | } | 334 | } |
330 | else if ( msg == "-showWWeek" ) { | 335 | else if ( msg == "-showWWeek" ) { |
331 | mView->viewManager()->showWorkWeekView(); | 336 | mView->viewManager()->showWorkWeekView(); |
332 | } | 337 | } |
333 | else if ( msg == "-ringSync" ) { | 338 | else if ( msg == "-ringSync" ) { |
334 | multiSync( false ); | 339 | multiSync( false ); |
335 | } | 340 | } |
336 | else if ( msg == "-showWeek" ) { | 341 | else if ( msg == "-showWeek" ) { |
337 | mView->viewManager()->showWeekView(); | 342 | mView->viewManager()->showWeekView(); |
338 | } | 343 | } |
339 | else if ( msg == "-showTodo" ) { | 344 | else if ( msg == "-showTodo" ) { |
340 | mView->viewManager()->showTodoView(); | 345 | mView->viewManager()->showTodoView(); |
341 | } | 346 | } |
342 | else if ( msg == "-showJournal" ) { | 347 | else if ( msg == "-showJournal" ) { |
343 | mView->dateNavigator()->selectDates( 1 ); | 348 | mView->dateNavigator()->selectDates( 1 ); |
344 | mView->dateNavigator()->selectToday(); | 349 | mView->dateNavigator()->selectToday(); |
345 | mView->viewManager()->showJournalView(); | 350 | mView->viewManager()->showJournalView(); |
346 | } | 351 | } |
347 | else if ( msg == "-showKO" ) { | 352 | else if ( msg == "-showKO" ) { |
348 | mView->viewManager()->showNextXView(); | 353 | mView->viewManager()->showNextXView(); |
349 | } | 354 | } |
350 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 355 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
351 | mView->viewManager()->showWhatsNextView(); | 356 | mView->viewManager()->showWhatsNextView(); |
352 | } | 357 | } |
353 | else if ( msg == "-showNextXView" ) { | 358 | else if ( msg == "-showNextXView" ) { |
354 | mView->viewManager()->showNextXView(); | 359 | mView->viewManager()->showNextXView(); |
355 | } | 360 | } |
356 | 361 | ||
357 | 362 | ||
358 | } | 363 | } |
359 | 364 | ||
360 | showMaximized(); | 365 | showMaximized(); |
361 | raise(); | 366 | raise(); |
362 | } | 367 | } |
363 | 368 | ||
364 | QPixmap MainWindow::loadPixmap( QString name ) | 369 | QPixmap MainWindow::loadPixmap( QString name ) |
365 | { | 370 | { |
366 | return SmallIcon( name ); | 371 | return SmallIcon( name ); |
367 | 372 | ||
368 | } | 373 | } |
369 | void MainWindow::initActions() | 374 | void MainWindow::initActions() |
370 | { | 375 | { |
371 | //KOPrefs::instance()->mShowFullMenu | 376 | //KOPrefs::instance()->mShowFullMenu |
372 | iconToolBar->clear(); | 377 | iconToolBar->clear(); |
373 | KOPrefs *p = KOPrefs::instance(); | 378 | KOPrefs *p = KOPrefs::instance(); |
374 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 379 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
375 | 380 | ||
376 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 381 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
377 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 382 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
378 | QPopupMenu *importMenu = new QPopupMenu( this ); | 383 | QPopupMenu *importMenu = new QPopupMenu( this ); |
379 | selectFilterMenu = new QPopupMenu( this ); | 384 | selectFilterMenu = new QPopupMenu( this ); |
380 | selectFilterMenu->setCheckable( true ); | 385 | selectFilterMenu->setCheckable( true ); |
381 | syncMenu = new QPopupMenu( this ); | 386 | syncMenu = new QPopupMenu( this ); |
382 | configureAgendaMenu = new QPopupMenu( this ); | 387 | configureAgendaMenu = new QPopupMenu( this ); |
383 | configureToolBarMenu = new QPopupMenu( this ); | 388 | configureToolBarMenu = new QPopupMenu( this ); |
384 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 389 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
385 | if ( KOPrefs::instance()->mShowFullMenu ) { | 390 | if ( KOPrefs::instance()->mShowFullMenu ) { |
386 | QMenuBar *menuBar1; | 391 | QMenuBar *menuBar1; |
387 | menuBar1 = menuBar(); | 392 | menuBar1 = menuBar(); |
388 | menuBar1->insertItem( i18n("File"), importMenu ); | 393 | menuBar1->insertItem( i18n("File"), importMenu ); |
389 | menuBar1->insertItem( i18n("View"), viewMenu ); | 394 | menuBar1->insertItem( i18n("View"), viewMenu ); |
390 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 395 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
391 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 396 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
392 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 397 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
393 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 398 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
394 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 399 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
395 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 400 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
396 | } else { | 401 | } else { |
397 | QPEMenuBar *menuBar1; | 402 | QPEMenuBar *menuBar1; |
398 | menuBar1 = new QPEMenuBar( iconToolBar ); | 403 | menuBar1 = new QPEMenuBar( iconToolBar ); |
399 | QPopupMenu *menuBar = new QPopupMenu( this ); | 404 | QPopupMenu *menuBar = new QPopupMenu( this ); |
400 | menuBar1->insertItem( i18n("ME"), menuBar); | 405 | menuBar1->insertItem( i18n("ME"), menuBar); |
401 | menuBar->insertItem( i18n("File"), importMenu ); | 406 | menuBar->insertItem( i18n("File"), importMenu ); |
402 | menuBar->insertItem( i18n("View"), viewMenu ); | 407 | menuBar->insertItem( i18n("View"), viewMenu ); |
403 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 408 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
404 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 409 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
405 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 410 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
406 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 411 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
407 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 412 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
408 | menuBar->insertItem( i18n("Help"), helpMenu ); | 413 | menuBar->insertItem( i18n("Help"), helpMenu ); |
409 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 414 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
410 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 415 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
411 | } | 416 | } |
412 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 417 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
413 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 418 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
414 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 419 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
415 | 420 | ||
416 | // ****************** | 421 | // ****************** |
417 | QAction *action; | 422 | QAction *action; |
418 | QIconSet icon; | 423 | QIconSet icon; |
419 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 424 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
420 | configureToolBarMenu->setCheckable( true ); | 425 | configureToolBarMenu->setCheckable( true ); |
421 | 426 | ||
422 | QString pathString = ""; | 427 | QString pathString = ""; |
423 | if ( !p->mToolBarMiniIcons ) { | 428 | if ( !p->mToolBarMiniIcons ) { |
424 | if ( QApplication::desktop()->width() < 480 ) | 429 | if ( QApplication::desktop()->width() < 480 ) |
425 | pathString += "icons16/"; | 430 | pathString += "icons16/"; |
426 | } else | 431 | } else |
427 | pathString += "iconsmini/"; | 432 | pathString += "iconsmini/"; |
428 | configureAgendaMenu->setCheckable( true ); | 433 | configureAgendaMenu->setCheckable( true ); |
429 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 434 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
430 | configureAgendaMenu->insertSeparator(); | 435 | configureAgendaMenu->insertSeparator(); |
431 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 436 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
432 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 437 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
433 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 438 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
434 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 439 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
435 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 440 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
436 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 441 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
437 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 442 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
438 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 443 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
439 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 444 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
440 | 445 | ||
441 | icon = loadPixmap( pathString + "configure" ); | 446 | icon = loadPixmap( pathString + "configure" ); |
442 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 447 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
443 | action->addTo( actionMenu ); | 448 | action->addTo( actionMenu ); |
444 | connect( action, SIGNAL( activated() ), | 449 | connect( action, SIGNAL( activated() ), |
445 | mView, SLOT( edit_options() ) ); | 450 | mView, SLOT( edit_options() ) ); |
446 | actionMenu->insertSeparator(); | 451 | actionMenu->insertSeparator(); |
447 | icon = loadPixmap( pathString + "newevent" ); | 452 | icon = loadPixmap( pathString + "newevent" ); |
448 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 453 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
449 | configureToolBarMenu->insertSeparator(); | 454 | configureToolBarMenu->insertSeparator(); |
450 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 455 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
451 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 456 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
452 | ne_action->addTo( actionMenu ); | 457 | ne_action->addTo( actionMenu ); |
453 | connect( ne_action, SIGNAL( activated() ), | 458 | connect( ne_action, SIGNAL( activated() ), |
454 | mView, SLOT( newEvent() ) ); | 459 | mView, SLOT( newEvent() ) ); |
455 | icon = loadPixmap( pathString + "newtodo" ); | 460 | icon = loadPixmap( pathString + "newtodo" ); |
456 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 461 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
457 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 462 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
458 | nt_action->addTo( actionMenu ); | 463 | nt_action->addTo( actionMenu ); |
459 | connect( nt_action, SIGNAL( activated() ), | 464 | connect( nt_action, SIGNAL( activated() ), |
460 | mView, SLOT( newTodo() ) ); | 465 | mView, SLOT( newTodo() ) ); |
461 | icon = loadPixmap( pathString + "navi" ); | 466 | icon = loadPixmap( pathString + "navi" ); |
462 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 467 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
463 | action->addTo( viewMenu ); | 468 | action->addTo( viewMenu ); |
464 | connect( action, SIGNAL( activated() ), | 469 | connect( action, SIGNAL( activated() ), |
465 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 470 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
466 | icon = loadPixmap( pathString + "filter" ); | 471 | icon = loadPixmap( pathString + "filter" ); |
467 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 472 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
468 | action->addTo( viewMenu ); | 473 | action->addTo( viewMenu ); |
469 | connect( action, SIGNAL( activated() ), | 474 | connect( action, SIGNAL( activated() ), |
470 | mView, SLOT( toggleFilter() ) ); | 475 | mView, SLOT( toggleFilter() ) ); |
471 | 476 | ||
472 | 477 | ||
473 | viewMenu->insertSeparator(); | 478 | viewMenu->insertSeparator(); |
474 | icon = loadPixmap( pathString + "picker" ); | 479 | icon = loadPixmap( pathString + "picker" ); |
475 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 480 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
476 | action->addTo( viewMenu ); | 481 | action->addTo( viewMenu ); |
477 | connect( action, SIGNAL( activated() ), | 482 | connect( action, SIGNAL( activated() ), |
478 | mView, SLOT( showDatePicker() ) ); | 483 | mView, SLOT( showDatePicker() ) ); |
479 | action->addTo( iconToolBar ); | 484 | action->addTo( iconToolBar ); |
480 | viewMenu->insertSeparator(); | 485 | viewMenu->insertSeparator(); |
481 | icon = loadPixmap( pathString + "list" ); | 486 | icon = loadPixmap( pathString + "list" ); |
482 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 487 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
483 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 488 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
484 | showlist_action->addTo( viewMenu ); | 489 | showlist_action->addTo( viewMenu ); |
485 | connect( showlist_action, SIGNAL( activated() ), | 490 | connect( showlist_action, SIGNAL( activated() ), |
486 | mView->viewManager(), SLOT( showListView() ) ); | 491 | mView->viewManager(), SLOT( showListView() ) ); |
487 | 492 | ||
488 | 493 | ||
489 | icon = loadPixmap( pathString + "day" ); | 494 | icon = loadPixmap( pathString + "day" ); |
490 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 495 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
491 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 496 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
492 | day1_action->addTo( viewMenu ); | 497 | day1_action->addTo( viewMenu ); |
493 | // action->addTo( toolBar ); | 498 | // action->addTo( toolBar ); |
494 | connect( day1_action, SIGNAL( activated() ), | 499 | connect( day1_action, SIGNAL( activated() ), |
495 | mView->viewManager(), SLOT( showDayView() ) ); | 500 | mView->viewManager(), SLOT( showDayView() ) ); |
496 | 501 | ||
497 | icon = loadPixmap( pathString + "workweek" ); | 502 | icon = loadPixmap( pathString + "workweek" ); |
498 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 503 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
499 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 504 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
500 | day5_action->addTo( viewMenu ); | 505 | day5_action->addTo( viewMenu ); |
501 | connect( day5_action, SIGNAL( activated() ), | 506 | connect( day5_action, SIGNAL( activated() ), |
502 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 507 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
503 | 508 | ||
504 | icon = loadPixmap( pathString + "week" ); | 509 | icon = loadPixmap( pathString + "week" ); |
505 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 510 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
506 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 511 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
507 | day7_action->addTo( viewMenu ); | 512 | day7_action->addTo( viewMenu ); |
508 | connect( day7_action, SIGNAL( activated() ), | 513 | connect( day7_action, SIGNAL( activated() ), |
509 | mView->viewManager(), SLOT( showWeekView() ) ); | 514 | mView->viewManager(), SLOT( showWeekView() ) ); |
510 | 515 | ||
511 | icon = loadPixmap( pathString + "month" ); | 516 | icon = loadPixmap( pathString + "month" ); |
512 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 517 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
513 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 518 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
514 | month_action->addTo( viewMenu ); | 519 | month_action->addTo( viewMenu ); |
515 | connect( month_action, SIGNAL( activated() ), | 520 | connect( month_action, SIGNAL( activated() ), |
516 | mView->viewManager(), SLOT( showMonthView() ) ); | 521 | mView->viewManager(), SLOT( showMonthView() ) ); |
517 | 522 | ||
518 | icon = loadPixmap( pathString + "todo" ); | 523 | icon = loadPixmap( pathString + "todo" ); |
519 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 524 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
520 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 525 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
521 | todoview_action->addTo( viewMenu ); | 526 | todoview_action->addTo( viewMenu ); |
522 | connect( todoview_action, SIGNAL( activated() ), | 527 | connect( todoview_action, SIGNAL( activated() ), |
523 | mView->viewManager(), SLOT( showTodoView() ) ); | 528 | mView->viewManager(), SLOT( showTodoView() ) ); |
524 | 529 | ||
525 | icon = loadPixmap( pathString + "journal" ); | 530 | icon = loadPixmap( pathString + "journal" ); |
526 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 531 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
527 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 532 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
528 | viewjournal_action->addTo( viewMenu ); | 533 | viewjournal_action->addTo( viewMenu ); |
529 | connect( viewjournal_action, SIGNAL( activated() ), | 534 | connect( viewjournal_action, SIGNAL( activated() ), |
530 | mView->viewManager(), SLOT( showJournalView() ) ); | 535 | mView->viewManager(), SLOT( showJournalView() ) ); |
531 | 536 | ||
532 | icon = loadPixmap( pathString + "xdays" ); | 537 | icon = loadPixmap( pathString + "xdays" ); |
533 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 538 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
534 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 539 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
535 | xdays_action->addTo( viewMenu ); | 540 | xdays_action->addTo( viewMenu ); |
536 | connect( xdays_action, SIGNAL( activated() ), | 541 | connect( xdays_action, SIGNAL( activated() ), |
537 | mView->viewManager(), SLOT( showNextXView() ) ); | 542 | mView->viewManager(), SLOT( showNextXView() ) ); |
538 | 543 | ||
539 | icon = loadPixmap( pathString + "whatsnext" ); | 544 | icon = loadPixmap( pathString + "whatsnext" ); |
540 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 545 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
541 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 546 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
542 | whatsnext_action->addTo( viewMenu ); | 547 | whatsnext_action->addTo( viewMenu ); |
543 | connect( whatsnext_action, SIGNAL( activated() ), | 548 | connect( whatsnext_action, SIGNAL( activated() ), |
544 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 549 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
545 | 550 | ||
546 | #if 0 | 551 | #if 0 |
547 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 552 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
548 | action->addTo( viewMenu ); | 553 | action->addTo( viewMenu ); |
549 | connect( action, SIGNAL( activated() ), | 554 | connect( action, SIGNAL( activated() ), |
550 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 555 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
551 | #endif | 556 | #endif |
552 | 557 | ||
553 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 558 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
554 | this ); | 559 | this ); |
555 | mNewSubTodoAction->addTo( actionMenu ); | 560 | mNewSubTodoAction->addTo( actionMenu ); |
556 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 561 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
557 | mView, SLOT( newSubTodo() ) ); | 562 | mView, SLOT( newSubTodo() ) ); |
558 | 563 | ||
559 | actionMenu->insertSeparator(); | 564 | actionMenu->insertSeparator(); |
560 | 565 | ||
561 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 566 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
562 | mShowAction->addTo( actionMenu ); | 567 | mShowAction->addTo( actionMenu ); |
563 | connect( mShowAction, SIGNAL( activated() ), | 568 | connect( mShowAction, SIGNAL( activated() ), |
564 | mView, SLOT( showIncidence() ) ); | 569 | mView, SLOT( showIncidence() ) ); |
565 | 570 | ||
566 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 571 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
567 | mEditAction->addTo( actionMenu ); | 572 | mEditAction->addTo( actionMenu ); |
568 | connect( mEditAction, SIGNAL( activated() ), | 573 | connect( mEditAction, SIGNAL( activated() ), |
569 | mView, SLOT( editIncidence() ) ); | 574 | mView, SLOT( editIncidence() ) ); |
570 | 575 | ||
571 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 576 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
572 | mDeleteAction->addTo( actionMenu ); | 577 | mDeleteAction->addTo( actionMenu ); |
573 | connect( mDeleteAction, SIGNAL( activated() ), | 578 | connect( mDeleteAction, SIGNAL( activated() ), |
574 | mView, SLOT( deleteIncidence() ) ); | 579 | mView, SLOT( deleteIncidence() ) ); |
575 | 580 | ||
576 | actionMenu->insertSeparator(); | 581 | actionMenu->insertSeparator(); |
577 | 582 | ||
578 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 583 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
579 | this ); | 584 | this ); |
580 | action->addTo( actionMenu ); | 585 | action->addTo( actionMenu ); |
581 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 586 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
582 | 587 | ||
583 | icon = loadPixmap( pathString + "search" ); | 588 | icon = loadPixmap( pathString + "search" ); |
584 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 589 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
585 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 590 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
586 | search_action->addTo( actionMenu ); | 591 | search_action->addTo( actionMenu ); |
587 | connect( search_action, SIGNAL( activated() ), | 592 | connect( search_action, SIGNAL( activated() ), |
588 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 593 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
589 | 594 | ||
590 | icon = loadPixmap( pathString + "today" ); | 595 | icon = loadPixmap( pathString + "today" ); |
591 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 596 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
592 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 597 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
593 | today_action->addTo( actionMenu ); | 598 | today_action->addTo( actionMenu ); |
594 | connect( today_action, SIGNAL( activated() ), | 599 | connect( today_action, SIGNAL( activated() ), |
595 | mView, SLOT( goToday() ) ); | 600 | mView, SLOT( goToday() ) ); |
596 | 601 | ||
597 | if ( KOPrefs::instance()->mShowFullMenu ) { | 602 | if ( KOPrefs::instance()->mShowFullMenu ) { |
598 | actionMenu->insertSeparator(); | 603 | actionMenu->insertSeparator(); |
599 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 604 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
600 | 605 | ||
601 | } | 606 | } |
602 | // actionMenu->insertSeparator(); | 607 | // actionMenu->insertSeparator(); |
603 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 608 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
604 | this ); | 609 | this ); |
605 | action->addTo( importMenu ); | 610 | action->addTo( importMenu ); |
606 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 611 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
607 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 612 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
608 | this ); | 613 | this ); |
609 | action->addTo( importMenu ); | 614 | action->addTo( importMenu ); |
610 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 615 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
611 | importMenu->insertSeparator(); | 616 | importMenu->insertSeparator(); |
612 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 617 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
613 | this ); | 618 | this ); |
614 | action->addTo( importMenu ); | 619 | action->addTo( importMenu ); |
615 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 620 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
616 | #ifndef DESKTOP_VERSION | 621 | #ifndef DESKTOP_VERSION |
617 | importMenu->insertSeparator(); | 622 | importMenu->insertSeparator(); |
618 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 623 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
619 | this ); | 624 | this ); |
620 | action->addTo( importMenu ); | 625 | action->addTo( importMenu ); |
621 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 626 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
622 | #else | 627 | #else |
623 | #ifdef _WIN32_ | 628 | #ifdef _WIN32_ |
624 | importMenu->insertSeparator(); | 629 | importMenu->insertSeparator(); |
625 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 630 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
626 | this ); | 631 | this ); |
627 | action->addTo( importMenu ); | 632 | action->addTo( importMenu ); |
628 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 633 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
629 | #endif | 634 | #endif |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 3e854cb..47a7a90 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,122 +1,123 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | 7 | ||
8 | #include <libkcal/incidence.h> | 8 | #include <libkcal/incidence.h> |
9 | #include "simplealarmclient.h" | 9 | #include "simplealarmclient.h" |
10 | 10 | ||
11 | class QAction; | 11 | class QAction; |
12 | class CalendarView; | 12 | class CalendarView; |
13 | class KSyncProfile; | 13 | class KSyncProfile; |
14 | #ifdef DESKTOP_VERSION | 14 | #ifdef DESKTOP_VERSION |
15 | 15 | ||
16 | #define QPEToolBar QToolBar | 16 | #define QPEToolBar QToolBar |
17 | #define QPEMenuBar QMenuBar | 17 | #define QPEMenuBar QMenuBar |
18 | #endif | 18 | #endif |
19 | class QPEToolBar; | 19 | class QPEToolBar; |
20 | 20 | ||
21 | namespace KCal { | 21 | namespace KCal { |
22 | class CalendarLocal; | 22 | class CalendarLocal; |
23 | } | 23 | } |
24 | 24 | ||
25 | using namespace KCal; | 25 | using namespace KCal; |
26 | 26 | ||
27 | class MainWindow : public QMainWindow | 27 | class MainWindow : public QMainWindow |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
32 | ~MainWindow(); | 32 | ~MainWindow(); |
33 | public slots: | 33 | public slots: |
34 | virtual void showMaximized (); | 34 | virtual void showMaximized (); |
35 | void configureAgenda( int ); | 35 | void configureAgenda( int ); |
36 | void recieve( const QCString& msg, const QByteArray& data ); | 36 | void recieve( const QCString& msg, const QByteArray& data ); |
37 | static QString defaultFileName(); | 37 | static QString defaultFileName(); |
38 | static QString resourcePath(); | 38 | static QString resourcePath(); |
39 | protected slots: | 39 | protected slots: |
40 | void setCaptionToDates(); | 40 | void setCaptionToDates(); |
41 | int ringSync(); | 41 | int ringSync(); |
42 | void multiSync( bool askforPrefs = false ); | 42 | void multiSync( bool askforPrefs = false ); |
43 | void about(); | 43 | void about(); |
44 | void licence(); | 44 | void licence(); |
45 | void faq(); | 45 | void faq(); |
46 | void usertrans(); | 46 | void usertrans(); |
47 | void features(); | 47 | void features(); |
48 | void synchowto(); | 48 | void synchowto(); |
49 | void whatsNew(); | 49 | void whatsNew(); |
50 | void keyBindings(); | 50 | void keyBindings(); |
51 | void aboutAutoSaving();; | 51 | void aboutAutoSaving();; |
52 | void aboutKnownBugs(); | 52 | void aboutKnownBugs(); |
53 | 53 | ||
54 | void processIncidenceSelection( Incidence * ); | 54 | void processIncidenceSelection( Incidence * ); |
55 | 55 | ||
56 | void importQtopia(); | 56 | void importQtopia(); |
57 | void importBday(); | 57 | void importBday(); |
58 | void importOL(); | 58 | void importOL(); |
59 | void importIcal(); | 59 | void importIcal(); |
60 | void importFile( QString, bool ); | 60 | void importFile( QString, bool ); |
61 | void quickImportIcal(); | 61 | void quickImportIcal(); |
62 | 62 | ||
63 | void slotModifiedChanged( bool ); | 63 | void slotModifiedChanged( bool ); |
64 | 64 | ||
65 | void save(); | 65 | void save(); |
66 | void configureToolBar( int ); | 66 | void configureToolBar( int ); |
67 | void printSel(); | 67 | void printSel(); |
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; |
116 | QTimer mSaveTimer; | 117 | QTimer mSaveTimer; |
117 | bool mBlockSaveFlag; | 118 | bool mBlockSaveFlag; |
118 | bool mCalendarModifiedFlag; | 119 | bool mCalendarModifiedFlag; |
119 | QPixmap loadPixmap( QString ); | 120 | QPixmap loadPixmap( QString ); |
120 | }; | 121 | }; |
121 | 122 | ||
122 | #endif | 123 | #endif |