-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c3e9f75..02ca523 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -84,385 +84,385 @@ class KOex2phonePrefs : public QDialog | |||
84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
85 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
86 | QHBox* temphb; | 86 | QHBox* temphb; |
87 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
88 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
89 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public: | 119 | public: |
120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
121 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
122 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mClosed = false; | 133 | mClosed = false; |
134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
135 | QString confFile = locateLocal("config","korganizerrc"); | 135 | QString confFile = locateLocal("config","korganizerrc"); |
136 | QFileInfo finf ( confFile ); | 136 | QFileInfo finf ( confFile ); |
137 | bool showWarning = !finf.exists(); | 137 | bool showWarning = !finf.exists(); |
138 | setIcon(SmallIcon( "ko24" ) ); | 138 | setIcon(SmallIcon( "ko24" ) ); |
139 | mBlockAtStartup = true; | 139 | mBlockAtStartup = true; |
140 | mFlagKeyPressed = false; | 140 | mFlagKeyPressed = false; |
141 | setCaption("KOrganizer/Pi"); | 141 | setCaption("KOrganizer/Pi"); |
142 | KOPrefs *p = KOPrefs::instance(); | 142 | KOPrefs *p = KOPrefs::instance(); |
143 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 143 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
144 | if ( p->mHourSize > 18 ) | 144 | if ( p->mHourSize > 18 ) |
145 | p->mHourSize = 18; | 145 | p->mHourSize = 18; |
146 | QMainWindow::ToolBarDock tbd; | 146 | QMainWindow::ToolBarDock tbd; |
147 | if ( p->mToolBarHor ) { | 147 | if ( p->mToolBarHor ) { |
148 | if ( p->mToolBarUp ) | 148 | if ( p->mToolBarUp ) |
149 | tbd = Bottom; | 149 | tbd = Bottom; |
150 | else | 150 | else |
151 | tbd = Top; | 151 | tbd = Top; |
152 | } | 152 | } |
153 | else { | 153 | else { |
154 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
155 | tbd = Right; | 155 | tbd = Right; |
156 | else | 156 | else |
157 | tbd = Left; | 157 | tbd = Left; |
158 | } | 158 | } |
159 | if ( KOPrefs::instance()->mUseAppColors ) | 159 | if ( KOPrefs::instance()->mUseAppColors ) |
160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
161 | globalFlagBlockStartup = 1; | 161 | globalFlagBlockStartup = 1; |
162 | iconToolBar = new QPEToolBar( this ); | 162 | iconToolBar = new QPEToolBar( this ); |
163 | addToolBar (iconToolBar , tbd ); | 163 | addToolBar (iconToolBar , tbd ); |
164 | mCalendarModifiedFlag = false; | 164 | mCalendarModifiedFlag = false; |
165 | 165 | ||
166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
167 | splash->setAlignment ( AlignCenter ); | 167 | splash->setAlignment ( AlignCenter ); |
168 | setCentralWidget( splash ); | 168 | setCentralWidget( splash ); |
169 | #ifndef DESKTOP_VERSION | 169 | #ifndef DESKTOP_VERSION |
170 | showMaximized(); | 170 | showMaximized(); |
171 | #endif | 171 | #endif |
172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
173 | setDefaultPreferences(); | 173 | setDefaultPreferences(); |
174 | mCalendar = new CalendarLocal(); | 174 | mCalendar = new CalendarLocal(); |
175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
176 | mView->hide(); | 176 | mView->hide(); |
177 | //mView->resize(splash->size() ); | 177 | //mView->resize(splash->size() ); |
178 | initActions(); | 178 | initActions(); |
179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
180 | mSyncManager->setBlockSave(false); | 180 | mSyncManager->setBlockSave(false); |
181 | mView->setSyncManager(mSyncManager); | 181 | mView->setSyncManager(mSyncManager); |
182 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
183 | iconToolBar->show(); | 183 | iconToolBar->show(); |
184 | qApp->processEvents(); | 184 | qApp->processEvents(); |
185 | #endif | 185 | #endif |
186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
187 | int vh = height() ; | 187 | int vh = height() ; |
188 | int vw = width(); | 188 | int vw = width(); |
189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
191 | vh -= iconToolBar->height(); | 191 | vh -= iconToolBar->height(); |
192 | } else { | 192 | } else { |
193 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
194 | } | 194 | } |
195 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
196 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
198 | mView->readSettings(); | 198 | mView->readSettings(); |
199 | bool newFile = false; | 199 | bool newFile = false; |
200 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
201 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
203 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
204 | 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"; | 204 | 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"; |
205 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
206 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
207 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
208 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
209 | qApp->processEvents(); | 209 | qApp->processEvents(); |
210 | } else { | 210 | } else { |
211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
220 | newFile = true; | 220 | newFile = true; |
221 | } | 221 | } |
222 | 222 | ||
223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KOPrefs::instance()->mLanguageChanged ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | KOPrefs::instance()->mLanguageChanged = false; | 231 | KOPrefs::instance()->mLanguageChanged = false; |
232 | } | 232 | } |
233 | processIncidenceSelection( 0 ); | 233 | processIncidenceSelection( 0 ); |
234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
235 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 235 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
237 | SLOT( slotModifiedChanged( bool ) ) ); | 237 | SLOT( slotModifiedChanged( bool ) ) ); |
238 | 238 | ||
239 | 239 | ||
240 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 240 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
241 | mView->setModified( false ); | 241 | mView->setModified( false ); |
242 | mBlockAtStartup = false; | 242 | mBlockAtStartup = false; |
243 | mView->setModified( false ); | 243 | mView->setModified( false ); |
244 | setCentralWidget( mView ); | 244 | setCentralWidget( mView ); |
245 | globalFlagBlockStartup = 0; | 245 | globalFlagBlockStartup = 0; |
246 | mView->show(); | 246 | mView->show(); |
247 | delete splash; | 247 | delete splash; |
248 | if ( newFile ) | 248 | if ( newFile ) |
249 | mView->updateConfig(); | 249 | mView->updateConfig(); |
250 | // qApp->processEvents(); | 250 | // qApp->processEvents(); |
251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
252 | //fillSyncMenu(); | 252 | //fillSyncMenu(); |
253 | 253 | ||
254 | 254 | ||
255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
258 | mSyncManager->setDefaultFileName( defaultFileName()); | 258 | mSyncManager->setDefaultFileName( defaultFileName()); |
259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
260 | mSyncManager->fillSyncMenu(); | 260 | mSyncManager->fillSyncMenu(); |
261 | 261 | ||
262 | 262 | ||
263 | 263 | ||
264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
265 | if ( showWarning ) { | 265 | if ( showWarning ) { |
266 | KMessageBox::information( this, | 266 | KMessageBox::information( this, |
267 | "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"); | 267 | "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"); |
268 | qApp->processEvents(); | 268 | qApp->processEvents(); |
269 | mView->dialogManager()->showSyncOptions(); | 269 | mView->dialogManager()->showSyncOptions(); |
270 | } | 270 | } |
271 | 271 | ||
272 | //US listen for result adressed from Ka/Pi | 272 | //US listen for result adressed from Ka/Pi |
273 | #ifndef DESKTOP_VERSION | 273 | #ifndef DESKTOP_VERSION |
274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
275 | #endif | 275 | #endif |
276 | 276 | ||
277 | } | 277 | } |
278 | MainWindow::~MainWindow() | 278 | MainWindow::~MainWindow() |
279 | { | 279 | { |
280 | //qDebug("MainWindow::~MainWindow() "); | 280 | //qDebug("MainWindow::~MainWindow() "); |
281 | //save toolbar location | 281 | //save toolbar location |
282 | delete mCalendar; | 282 | delete mCalendar; |
283 | delete mSyncManager; | 283 | delete mSyncManager; |
284 | 284 | ||
285 | 285 | ||
286 | } | 286 | } |
287 | void MainWindow::showMaximized () | 287 | void MainWindow::showMaximized () |
288 | { | 288 | { |
289 | #ifndef DESKTOP_VERSION | 289 | #ifndef DESKTOP_VERSION |
290 | if ( ! globalFlagBlockStartup ) | 290 | if ( ! globalFlagBlockStartup ) |
291 | if ( mClosed ) | 291 | if ( mClosed ) |
292 | mView->goToday(); | 292 | mView->goToday(); |
293 | #endif | 293 | #endif |
294 | QWidget::showMaximized () ; | 294 | QWidget::showMaximized () ; |
295 | mClosed = false; | 295 | mClosed = false; |
296 | } | 296 | } |
297 | void MainWindow::closeEvent( QCloseEvent* ce ) | 297 | void MainWindow::closeEvent( QCloseEvent* ce ) |
298 | { | 298 | { |
299 | 299 | ||
300 | 300 | ||
301 | 301 | ||
302 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 302 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
303 | saveOnClose(); | 303 | saveOnClose(); |
304 | mClosed = true; | 304 | mClosed = true; |
305 | ce->accept(); | 305 | ce->accept(); |
306 | return; | 306 | return; |
307 | 307 | ||
308 | } | 308 | } |
309 | 309 | ||
310 | switch( QMessageBox::information( this, "KO/Pi", | 310 | switch( QMessageBox::information( this, "KO/Pi", |
311 | i18n("Do you really want\nto close KO/Pi?"), | 311 | i18n("Do you really want\nto close KO/Pi?"), |
312 | i18n("Close"), i18n("No"), | 312 | i18n("Close"), i18n("No"), |
313 | 0, 0 ) ) { | 313 | 0, 0 ) ) { |
314 | case 0: | 314 | case 0: |
315 | saveOnClose(); | 315 | saveOnClose(); |
316 | mClosed = true; | 316 | mClosed = true; |
317 | ce->accept(); | 317 | ce->accept(); |
318 | break; | 318 | break; |
319 | case 1: | 319 | case 1: |
320 | ce->ignore(); | 320 | ce->ignore(); |
321 | break; | 321 | break; |
322 | case 2: | 322 | case 2: |
323 | 323 | ||
324 | default: | 324 | default: |
325 | break; | 325 | break; |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | } | 329 | } |
330 | 330 | ||
331 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 331 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
332 | { | 332 | { |
333 | QDataStream stream( data, IO_ReadOnly ); | 333 | QDataStream stream( data, IO_ReadOnly ); |
334 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 334 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
335 | //QString datamess; | 335 | //QString datamess; |
336 | //qDebug("message "); | 336 | //qDebug("message "); |
337 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 337 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
338 | 338 | ||
339 | if ( cmsg == "setDocument(QString)" ) { | 339 | if ( cmsg == "setDocument(QString)" ) { |
340 | QDataStream stream( data, IO_ReadOnly ); | 340 | QDataStream stream( data, IO_ReadOnly ); |
341 | QString fileName; | 341 | QString fileName; |
342 | stream >> fileName; | 342 | stream >> fileName; |
343 | //qDebug("filename %s ", fileName.latin1()); | 343 | //qDebug("filename %s ", fileName.latin1()); |
344 | showMaximized(); | 344 | showMaximized(); |
345 | raise(); | 345 | raise(); |
346 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 346 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
347 | mSyncManager->slotSyncMenu( 1002 ); | 347 | mSyncManager->slotSyncMenu( 1002 ); |
348 | return; | 348 | return; |
349 | } | 349 | } |
350 | 350 | ||
351 | if ( cmsg == "-writeFile" ) { | 351 | if ( cmsg == "-writeFile" ) { |
352 | // I made from the "-writeFile" an "-writeAlarm" | 352 | // I made from the "-writeFile" an "-writeAlarm" |
353 | mView->viewManager()->showWhatsNextView(); | 353 | mView->viewManager()->showWhatsNextView(); |
354 | mCalendar->checkAlarmForIncidence( 0, true); | 354 | mCalendar->checkAlarmForIncidence( 0, true); |
355 | showMaximized(); | 355 | showMaximized(); |
356 | raise(); | 356 | raise(); |
357 | return; | 357 | return; |
358 | 358 | ||
359 | } | 359 | } |
360 | if ( cmsg == "-writeFileSilent" ) { | 360 | if ( cmsg == "-writeFileSilent" ) { |
361 | // I made from the "-writeFile" an "-writeAlarm" | 361 | // I made from the "-writeFile" an "-writeAlarm" |
362 | // mView->viewManager()->showWhatsNextView(); | 362 | // mView->viewManager()->showWhatsNextView(); |
363 | mCalendar->checkAlarmForIncidence( 0, true); | 363 | mCalendar->checkAlarmForIncidence( 0, true); |
364 | //showMaximized(); | 364 | //showMaximized(); |
365 | //raise(); | 365 | //raise(); |
366 | hide(); | 366 | hide(); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | if ( cmsg == "-newCountdown" ) { | 369 | if ( cmsg == "-newCountdown" ) { |
370 | qDebug("newCountdown "); | 370 | qDebug("newCountdown "); |
371 | 371 | ||
372 | } | 372 | } |
373 | QString msg ; | 373 | QString msg ; |
374 | QString allmsg = cmsg; | 374 | QString allmsg = cmsg; |
375 | while ( allmsg.length() > 0 ) { | 375 | while ( allmsg.length() > 0 ) { |
376 | int nextC = allmsg.find( "-", 1 ); | 376 | int nextC = allmsg.find( "-", 1 ); |
377 | if ( nextC == -1 ) { | 377 | if ( nextC == -1 ) { |
378 | msg = allmsg; | 378 | msg = allmsg; |
379 | allmsg = ""; | 379 | allmsg = ""; |
380 | } else{ | 380 | } else{ |
381 | msg = allmsg.left( nextC ); | 381 | msg = allmsg.left( nextC ); |
382 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 382 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
383 | } | 383 | } |
384 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 384 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
385 | if ( msg == "-newEvent" ) { | 385 | if ( msg == "-newEvent" ) { |
386 | mView->newEvent(); | 386 | mView->newEvent(); |
387 | } | 387 | } |
388 | if ( msg == "-newTodo" ) { | 388 | if ( msg == "-newTodo" ) { |
389 | mView->newTodo(); | 389 | mView->newTodo(); |
390 | 390 | ||
391 | } | 391 | } |
392 | if ( msg == "-showWN" ) { | 392 | if ( msg == "-showWN" ) { |
393 | mView->viewManager()->showWhatsNextView(); | 393 | mView->viewManager()->showWhatsNextView(); |
394 | } | 394 | } |
395 | if ( msg == "-showTodo" ) { | 395 | if ( msg == "-showTodo" ) { |
396 | mView->viewManager()->showTodoView(); | 396 | mView->viewManager()->showTodoView(); |
397 | } | 397 | } |
398 | if ( msg == "-showList" ) { | 398 | if ( msg == "-showList" ) { |
399 | mView->viewManager()->showListView(); | 399 | mView->viewManager()->showListView(); |
400 | } | 400 | } |
401 | else if ( msg == "-showDay" ) { | 401 | else if ( msg == "-showDay" ) { |
402 | mView->viewManager()->showDayView(); | 402 | mView->viewManager()->showDayView(); |
403 | } | 403 | } |
404 | else if ( msg == "-showWWeek" ) { | 404 | else if ( msg == "-showWWeek" ) { |
405 | mView->viewManager()->showWorkWeekView(); | 405 | mView->viewManager()->showWorkWeekView(); |
406 | } | 406 | } |
407 | else if ( msg == "-ringSync" ) { | 407 | else if ( msg == "-ringSync" ) { |
408 | mSyncManager->multiSync( false ); | 408 | mSyncManager->multiSync( false ); |
409 | } | 409 | } |
410 | else if ( msg == "-showWeek" ) { | 410 | else if ( msg == "-showWeek" ) { |
411 | mView->viewManager()->showWeekView(); | 411 | mView->viewManager()->showWeekView(); |
412 | } | 412 | } |
413 | else if ( msg == "-showTodo" ) { | 413 | else if ( msg == "-showTodo" ) { |
414 | mView->viewManager()->showTodoView(); | 414 | mView->viewManager()->showTodoView(); |
415 | } | 415 | } |
416 | else if ( msg == "-showJournal" ) { | 416 | else if ( msg == "-showJournal" ) { |
417 | mView->dateNavigator()->selectDates( 1 ); | 417 | mView->dateNavigator()->selectDates( 1 ); |
418 | mView->dateNavigator()->selectToday(); | 418 | mView->dateNavigator()->selectToday(); |
419 | mView->viewManager()->showJournalView(); | 419 | mView->viewManager()->showJournalView(); |
420 | } | 420 | } |
421 | else if ( msg == "-showKO" ) { | 421 | else if ( msg == "-showKO" ) { |
422 | mView->viewManager()->showNextXView(); | 422 | mView->viewManager()->showNextXView(); |
423 | } | 423 | } |
424 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 424 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
425 | mView->viewManager()->showWhatsNextView(); | 425 | mView->viewManager()->showWhatsNextView(); |
426 | } | 426 | } |
427 | else if ( msg == "-showNextXView" ) { | 427 | else if ( msg == "-showNextXView" ) { |
428 | mView->viewManager()->showNextXView(); | 428 | mView->viewManager()->showNextXView(); |
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | } | 432 | } |
433 | 433 | ||
434 | showMaximized(); | 434 | showMaximized(); |
435 | raise(); | 435 | raise(); |
436 | } | 436 | } |
437 | 437 | ||
438 | QPixmap MainWindow::loadPixmap( QString name ) | 438 | QPixmap MainWindow::loadPixmap( QString name ) |
439 | { | 439 | { |
440 | return SmallIcon( name ); | 440 | return SmallIcon( name ); |
441 | 441 | ||
442 | } | 442 | } |
443 | void MainWindow::initActions() | 443 | void MainWindow::initActions() |
444 | { | 444 | { |
445 | //KOPrefs::instance()->mShowFullMenu | 445 | //KOPrefs::instance()->mShowFullMenu |
446 | iconToolBar->clear(); | 446 | iconToolBar->clear(); |
447 | KOPrefs *p = KOPrefs::instance(); | 447 | KOPrefs *p = KOPrefs::instance(); |
448 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 448 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
449 | 449 | ||
450 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 450 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
451 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 451 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
452 | QPopupMenu *importMenu = new QPopupMenu( this ); | 452 | QPopupMenu *importMenu = new QPopupMenu( this ); |
453 | selectFilterMenu = new QPopupMenu( this ); | 453 | selectFilterMenu = new QPopupMenu( this ); |
454 | selectFilterMenu->setCheckable( true ); | 454 | selectFilterMenu->setCheckable( true ); |
455 | syncMenu = new QPopupMenu( this ); | 455 | syncMenu = new QPopupMenu( this ); |
456 | configureAgendaMenu = new QPopupMenu( this ); | 456 | configureAgendaMenu = new QPopupMenu( this ); |
457 | configureToolBarMenu = new QPopupMenu( this ); | 457 | configureToolBarMenu = new QPopupMenu( this ); |
458 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 458 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
459 | if ( KOPrefs::instance()->mShowFullMenu ) { | 459 | if ( KOPrefs::instance()->mShowFullMenu ) { |
460 | QMenuBar *menuBar1; | 460 | QMenuBar *menuBar1; |
461 | menuBar1 = menuBar(); | 461 | menuBar1 = menuBar(); |
462 | menuBar1->insertItem( i18n("File"), importMenu ); | 462 | menuBar1->insertItem( i18n("File"), importMenu ); |
463 | menuBar1->insertItem( i18n("View"), viewMenu ); | 463 | menuBar1->insertItem( i18n("View"), viewMenu ); |
464 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 464 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
465 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 465 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
466 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 466 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
467 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 467 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
468 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 468 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |