summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3c16458..a69a0bd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -145,391 +145,392 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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}
277MainWindow::~MainWindow() 277MainWindow::~MainWindow()
278{ 278{
279 //qDebug("MainWindow::~MainWindow() "); 279 //qDebug("MainWindow::~MainWindow() ");
280 //save toolbar location 280 //save toolbar location
281 delete mCalendar; 281 delete mCalendar;
282 delete mSyncManager; 282 delete mSyncManager;
283 283
284 284
285} 285}
286void MainWindow::showMaximized () 286void MainWindow::showMaximized ()
287{ 287{
288#ifndef DESKTOP_VERSION 288#ifndef DESKTOP_VERSION
289 if ( ! globalFlagBlockStartup ) 289 if ( ! globalFlagBlockStartup )
290 if ( mClosed ) 290 if ( mClosed )
291 mView->goToday(); 291 mView->goToday();
292#endif 292#endif
293 QWidget::showMaximized () ; 293 QWidget::showMaximized () ;
294 mClosed = false; 294 mClosed = false;
295} 295}
296void MainWindow::closeEvent( QCloseEvent* ce ) 296void MainWindow::closeEvent( QCloseEvent* ce )
297{ 297{
298 298
299 299
300 300
301 if ( ! KOPrefs::instance()->mAskForQuit ) { 301 if ( ! KOPrefs::instance()->mAskForQuit ) {
302 saveOnClose(); 302 saveOnClose();
303 mClosed = true; 303 mClosed = true;
304 ce->accept(); 304 ce->accept();
305 return; 305 return;
306 306
307 } 307 }
308 308
309 switch( QMessageBox::information( this, "KO/Pi", 309 switch( QMessageBox::information( this, "KO/Pi",
310 i18n("Do you really want\nto close KO/Pi?"), 310 i18n("Do you really want\nto close KO/Pi?"),
311 i18n("Close"), i18n("No"), 311 i18n("Close"), i18n("No"),
312 0, 0 ) ) { 312 0, 0 ) ) {
313 case 0: 313 case 0:
314 saveOnClose(); 314 saveOnClose();
315 mClosed = true; 315 mClosed = true;
316 ce->accept(); 316 ce->accept();
317 break; 317 break;
318 case 1: 318 case 1:
319 ce->ignore(); 319 ce->ignore();
320 break; 320 break;
321 case 2: 321 case 2:
322 322
323 default: 323 default:
324 break; 324 break;
325 } 325 }
326 326
327 327
328} 328}
329 329
330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
331{ 331{
332 QDataStream stream( data, IO_ReadOnly ); 332 QDataStream stream( data, IO_ReadOnly );
333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
334 //QString datamess; 334 //QString datamess;
335 //qDebug("message "); 335 //qDebug("message ");
336 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 336 qDebug("KO: QCOP message received: %s ", cmsg.data() );
337 337
338 if ( cmsg == "-writeFile" ) { 338 if ( cmsg == "setDocument(QString)" ) {
339 // I made from the "-writeFile" an "-writeAlarm" 339 QDataStream stream( data, IO_ReadOnly );
340 mView->viewManager()->showWhatsNextView(); 340 QString fileName;
341 mCalendar->checkAlarmForIncidence( 0, true); 341 stream >> fileName;
342 showMaximized(); 342 qDebug("filename %s ", fileName.latin1());
343 raise(); 343 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
344 mSyncManager->slotSyncMenu( 1002 );
344 return; 345 return;
345 } 346 }
346 347
347 if ( cmsg == "-writeFile" ) { 348 if ( cmsg == "-writeFile" ) {
348 // I made from the "-writeFile" an "-writeAlarm" 349 // I made from the "-writeFile" an "-writeAlarm"
349 mView->viewManager()->showWhatsNextView(); 350 mView->viewManager()->showWhatsNextView();
350 mCalendar->checkAlarmForIncidence( 0, true); 351 mCalendar->checkAlarmForIncidence( 0, true);
351 showMaximized(); 352 showMaximized();
352 raise(); 353 raise();
353 return; 354 return;
354 355
355 } 356 }
356 if ( cmsg == "-writeFileSilent" ) { 357 if ( cmsg == "-writeFileSilent" ) {
357 // I made from the "-writeFile" an "-writeAlarm" 358 // I made from the "-writeFile" an "-writeAlarm"
358 // mView->viewManager()->showWhatsNextView(); 359 // mView->viewManager()->showWhatsNextView();
359 mCalendar->checkAlarmForIncidence( 0, true); 360 mCalendar->checkAlarmForIncidence( 0, true);
360 //showMaximized(); 361 //showMaximized();
361 //raise(); 362 //raise();
362 hide(); 363 hide();
363 return; 364 return;
364 } 365 }
365 if ( cmsg == "-newCountdown" ) { 366 if ( cmsg == "-newCountdown" ) {
366 qDebug("newCountdown "); 367 qDebug("newCountdown ");
367 368
368 } 369 }
369 QString msg ; 370 QString msg ;
370 QString allmsg = cmsg; 371 QString allmsg = cmsg;
371 while ( allmsg.length() > 0 ) { 372 while ( allmsg.length() > 0 ) {
372 int nextC = allmsg.find( "-", 1 ); 373 int nextC = allmsg.find( "-", 1 );
373 if ( nextC == -1 ) { 374 if ( nextC == -1 ) {
374 msg = allmsg; 375 msg = allmsg;
375 allmsg = ""; 376 allmsg = "";
376 } else{ 377 } else{
377 msg = allmsg.left( nextC ); 378 msg = allmsg.left( nextC );
378 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 379 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
379 } 380 }
380 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 381 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
381 if ( msg == "-newEvent" ) { 382 if ( msg == "-newEvent" ) {
382 mView->newEvent(); 383 mView->newEvent();
383 } 384 }
384 if ( msg == "-newTodo" ) { 385 if ( msg == "-newTodo" ) {
385 mView->newTodo(); 386 mView->newTodo();
386 387
387 } 388 }
388 if ( msg == "-showWN" ) { 389 if ( msg == "-showWN" ) {
389 mView->viewManager()->showWhatsNextView(); 390 mView->viewManager()->showWhatsNextView();
390 } 391 }
391 if ( msg == "-showTodo" ) { 392 if ( msg == "-showTodo" ) {
392 mView->viewManager()->showTodoView(); 393 mView->viewManager()->showTodoView();
393 } 394 }
394 if ( msg == "-showList" ) { 395 if ( msg == "-showList" ) {
395 mView->viewManager()->showListView(); 396 mView->viewManager()->showListView();
396 } 397 }
397 else if ( msg == "-showDay" ) { 398 else if ( msg == "-showDay" ) {
398 mView->viewManager()->showDayView(); 399 mView->viewManager()->showDayView();
399 } 400 }
400 else if ( msg == "-showWWeek" ) { 401 else if ( msg == "-showWWeek" ) {
401 mView->viewManager()->showWorkWeekView(); 402 mView->viewManager()->showWorkWeekView();
402 } 403 }
403 else if ( msg == "-ringSync" ) { 404 else if ( msg == "-ringSync" ) {
404 mSyncManager->multiSync( false ); 405 mSyncManager->multiSync( false );
405 } 406 }
406 else if ( msg == "-showWeek" ) { 407 else if ( msg == "-showWeek" ) {
407 mView->viewManager()->showWeekView(); 408 mView->viewManager()->showWeekView();
408 } 409 }
409 else if ( msg == "-showTodo" ) { 410 else if ( msg == "-showTodo" ) {
410 mView->viewManager()->showTodoView(); 411 mView->viewManager()->showTodoView();
411 } 412 }
412 else if ( msg == "-showJournal" ) { 413 else if ( msg == "-showJournal" ) {
413 mView->dateNavigator()->selectDates( 1 ); 414 mView->dateNavigator()->selectDates( 1 );
414 mView->dateNavigator()->selectToday(); 415 mView->dateNavigator()->selectToday();
415 mView->viewManager()->showJournalView(); 416 mView->viewManager()->showJournalView();
416 } 417 }
417 else if ( msg == "-showKO" ) { 418 else if ( msg == "-showKO" ) {
418 mView->viewManager()->showNextXView(); 419 mView->viewManager()->showNextXView();
419 } 420 }
420 else if ( msg == "-showWNext" || msg == "nextView()" ) { 421 else if ( msg == "-showWNext" || msg == "nextView()" ) {
421 mView->viewManager()->showWhatsNextView(); 422 mView->viewManager()->showWhatsNextView();
422 } 423 }
423 else if ( msg == "-showNextXView" ) { 424 else if ( msg == "-showNextXView" ) {
424 mView->viewManager()->showNextXView(); 425 mView->viewManager()->showNextXView();
425 } 426 }
426 427
427 428
428 } 429 }
429 430
430 showMaximized(); 431 showMaximized();
431 raise(); 432 raise();
432} 433}
433 434
434QPixmap MainWindow::loadPixmap( QString name ) 435QPixmap MainWindow::loadPixmap( QString name )
435{ 436{
436 return SmallIcon( name ); 437 return SmallIcon( name );
437 438
438} 439}
439void MainWindow::initActions() 440void MainWindow::initActions()
440{ 441{
441 //KOPrefs::instance()->mShowFullMenu 442 //KOPrefs::instance()->mShowFullMenu
442 iconToolBar->clear(); 443 iconToolBar->clear();
443 KOPrefs *p = KOPrefs::instance(); 444 KOPrefs *p = KOPrefs::instance();
444 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 445 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
445 446
446 QPopupMenu *viewMenu = new QPopupMenu( this ); 447 QPopupMenu *viewMenu = new QPopupMenu( this );
447 QPopupMenu *actionMenu = new QPopupMenu( this ); 448 QPopupMenu *actionMenu = new QPopupMenu( this );
448 QPopupMenu *importMenu = new QPopupMenu( this ); 449 QPopupMenu *importMenu = new QPopupMenu( this );
449 selectFilterMenu = new QPopupMenu( this ); 450 selectFilterMenu = new QPopupMenu( this );
450 selectFilterMenu->setCheckable( true ); 451 selectFilterMenu->setCheckable( true );
451 syncMenu = new QPopupMenu( this ); 452 syncMenu = new QPopupMenu( this );
452 configureAgendaMenu = new QPopupMenu( this ); 453 configureAgendaMenu = new QPopupMenu( this );
453 configureToolBarMenu = new QPopupMenu( this ); 454 configureToolBarMenu = new QPopupMenu( this );
454 QPopupMenu *helpMenu = new QPopupMenu( this ); 455 QPopupMenu *helpMenu = new QPopupMenu( this );
455 if ( KOPrefs::instance()->mShowFullMenu ) { 456 if ( KOPrefs::instance()->mShowFullMenu ) {
456 QMenuBar *menuBar1; 457 QMenuBar *menuBar1;
457 menuBar1 = menuBar(); 458 menuBar1 = menuBar();
458 menuBar1->insertItem( i18n("File"), importMenu ); 459 menuBar1->insertItem( i18n("File"), importMenu );
459 menuBar1->insertItem( i18n("View"), viewMenu ); 460 menuBar1->insertItem( i18n("View"), viewMenu );
460 menuBar1->insertItem( i18n("Actions"), actionMenu ); 461 menuBar1->insertItem( i18n("Actions"), actionMenu );
461 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 462 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
462 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 463 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
463 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 464 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
464 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 465 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
465 menuBar1->insertItem( i18n("Help"), helpMenu ); 466 menuBar1->insertItem( i18n("Help"), helpMenu );
466 } else { 467 } else {
467 QPEMenuBar *menuBar1; 468 QPEMenuBar *menuBar1;
468 menuBar1 = new QPEMenuBar( iconToolBar ); 469 menuBar1 = new QPEMenuBar( iconToolBar );
469 QPopupMenu *menuBar = new QPopupMenu( this ); 470 QPopupMenu *menuBar = new QPopupMenu( this );
470 menuBar1->insertItem( i18n("ME"), menuBar); 471 menuBar1->insertItem( i18n("ME"), menuBar);
471 menuBar->insertItem( i18n("File"), importMenu ); 472 menuBar->insertItem( i18n("File"), importMenu );
472 menuBar->insertItem( i18n("View"), viewMenu ); 473 menuBar->insertItem( i18n("View"), viewMenu );
473 menuBar->insertItem( i18n("Actions"), actionMenu ); 474 menuBar->insertItem( i18n("Actions"), actionMenu );
474 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 475 menuBar->insertItem( i18n("Synchronize"), syncMenu );
475 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 476 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
476 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 477 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
477 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 478 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
478 menuBar->insertItem( i18n("Help"), helpMenu ); 479 menuBar->insertItem( i18n("Help"), helpMenu );
479 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 480 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
480 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 481 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
481 } 482 }
482 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 483 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
483 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 484 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
484 485
485 // ****************** 486 // ******************
486 QAction *action; 487 QAction *action;
487 QIconSet icon; 488 QIconSet icon;
488 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 489 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
489 configureToolBarMenu->setCheckable( true ); 490 configureToolBarMenu->setCheckable( true );
490 491
491 QString pathString = ""; 492 QString pathString = "";
492 if ( !p->mToolBarMiniIcons ) { 493 if ( !p->mToolBarMiniIcons ) {
493 if ( QApplication::desktop()->width() < 480 ) 494 if ( QApplication::desktop()->width() < 480 )
494 pathString += "icons16/"; 495 pathString += "icons16/";
495 } else 496 } else
496 pathString += "iconsmini/"; 497 pathString += "iconsmini/";
497 configureAgendaMenu->setCheckable( true ); 498 configureAgendaMenu->setCheckable( true );
498 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 499 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
499 configureAgendaMenu->insertSeparator(); 500 configureAgendaMenu->insertSeparator();
500 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 501 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
501 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 502 configureAgendaMenu->insertItem(i18n("Small"), 6 );
502 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 503 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
503 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 504 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
504 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 505 configureAgendaMenu->insertItem(i18n("Large"), 12 );
505 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 506 configureAgendaMenu->insertItem(i18n("Big"), 14 );
506 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 507 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
507 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 508 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
508 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 509 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
509 510
510 icon = loadPixmap( pathString + "configure" ); 511 icon = loadPixmap( pathString + "configure" );
511 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 512 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
512 action->addTo( actionMenu ); 513 action->addTo( actionMenu );
513 connect( action, SIGNAL( activated() ), 514 connect( action, SIGNAL( activated() ),
514 mView, SLOT( edit_options() ) ); 515 mView, SLOT( edit_options() ) );
515 actionMenu->insertSeparator(); 516 actionMenu->insertSeparator();
516 icon = loadPixmap( pathString + "newevent" ); 517 icon = loadPixmap( pathString + "newevent" );
517 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 518 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
518 configureToolBarMenu->insertSeparator(); 519 configureToolBarMenu->insertSeparator();
519 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 520 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
520 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 521 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
521 ne_action->addTo( actionMenu ); 522 ne_action->addTo( actionMenu );
522 connect( ne_action, SIGNAL( activated() ), 523 connect( ne_action, SIGNAL( activated() ),
523 mView, SLOT( newEvent() ) ); 524 mView, SLOT( newEvent() ) );
524 icon = loadPixmap( pathString + "newtodo" ); 525 icon = loadPixmap( pathString + "newtodo" );
525 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 526 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
526 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 527 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
527 nt_action->addTo( actionMenu ); 528 nt_action->addTo( actionMenu );
528 connect( nt_action, SIGNAL( activated() ), 529 connect( nt_action, SIGNAL( activated() ),
529 mView, SLOT( newTodo() ) ); 530 mView, SLOT( newTodo() ) );
530 icon = loadPixmap( pathString + "navi" ); 531 icon = loadPixmap( pathString + "navi" );
531 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 532 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
532 action->addTo( viewMenu ); 533 action->addTo( viewMenu );
533 connect( action, SIGNAL( activated() ), 534 connect( action, SIGNAL( activated() ),
534 mView, SLOT( toggleDateNavigatorWidget() ) ); 535 mView, SLOT( toggleDateNavigatorWidget() ) );
535 icon = loadPixmap( pathString + "filter" ); 536 icon = loadPixmap( pathString + "filter" );