author | zautrix <zautrix> | 2005-07-01 11:19:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 11:19:13 (UTC) |
commit | 5d603fd22bc8126c6a9a6f377701669d3cee18f2 (patch) (side-by-side diff) | |
tree | 9fdef25d24a3a57e3ecf5ae2e4b1cc3d3fb0e0bf /korganizer/mainwindow.cpp | |
parent | 409f5296344084e22833b35c03923b89d7be653b (diff) | |
download | kdepimpi-5d603fd22bc8126c6a9a6f377701669d3cee18f2.zip kdepimpi-5d603fd22bc8126c6a9a6f377701669d3cee18f2.tar.gz kdepimpi-5d603fd22bc8126c6a9a6f377701669d3cee18f2.tar.bz2 |
many menu fixes
-rw-r--r-- | korganizer/mainwindow.cpp | 171 |
1 files changed, 99 insertions, 72 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 23537a6..a5d8824 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -641,32 +641,37 @@ QPixmap MainWindow::loadPixmap( QString name ) } void MainWindow::setUsesBigPixmaps ( bool b ) { qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); if ( b ) qDebug("KO: BigPixmaps are not supported "); } void MainWindow::initActions() { //KOPrefs::instance()->mShowFullMenu iconToolBar->clear(); KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); +#ifdef DESKTOP_VERSION + mCurrentItemMenu = actionMenu; +#else + mCurrentItemMenu = new QPopupMenu ( this ); +#endif QPopupMenu *importMenu = new QPopupMenu( this ); QPopupMenu *importMenu_X = new QPopupMenu( this ); QPopupMenu *exportMenu_X = new QPopupMenu( this ); QPopupMenu *beamMenu_X = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); QIconSet icon; int pixWid = 22, pixHei = 22; QString pathString = ""; if ( !p->mToolBarMiniIcons ) { if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { pathString += "icons16/"; @@ -752,76 +757,120 @@ void MainWindow::initActions() //#endif // ****************** QAction *action; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); configureAgendaMenu->setCheckable( true ); int iii ; for ( iii = 1;iii<= 10 ;++iii ){ configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); } //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); connect( configureAgendaMenu, SIGNAL( aboutToShow()), this, SLOT( showConfigureAgenda( ) ) ); + icon = loadPixmap( pathString + "today" ); + QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); + today_action->addTo( actionMenu ); + connect( today_action, SIGNAL( activated() ), + mView, SLOT( goToday() ) ); + + icon = loadPixmap( pathString + "picker" ); + QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); + dPickerAction->addTo( actionMenu ); + connect( dPickerAction, SIGNAL( activated() ), + mView, SLOT( showDatePicker() ) ); + + icon = loadPixmap( pathString + "search" ); + QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); + search_action->addTo( actionMenu ); + connect( search_action, SIGNAL( activated() ), + mView->dialogManager(), SLOT( showSearchDialog() ) ); - icon = loadPixmap( pathString + "configure" ); - action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); - action->addTo( actionMenu ); - connect( action, SIGNAL( activated() ), - mView, SLOT( edit_options() ) ); - icon = loadPixmap( pathString + "configure" ); - action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); - action->addTo( actionMenu ); - connect( action, SIGNAL( activated() ), - mView, SLOT( edit_global_options() ) ); actionMenu->insertSeparator(); + + action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( undo_delete() ) ); - actionMenu->insertSeparator(); icon = loadPixmap( pathString + "newevent" ); configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(i18n("Week Number"), 400); configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); + +#ifndef DESKTOP_VERSION + actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); +#endif + mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); + mShowAction->addTo( mCurrentItemMenu ); + connect( mShowAction, SIGNAL( activated() ), + mView, SLOT( showIncidence() ) ); + + mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); + mEditAction->addTo( mCurrentItemMenu ); + connect( mEditAction, SIGNAL( activated() ), + mView, SLOT( editIncidence() ) ); + + mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); + mDeleteAction->addTo( mCurrentItemMenu ); + connect( mDeleteAction, SIGNAL( activated() ), + mView, SLOT( deleteIncidence() ) ); + + + mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); + mCloneAction->addTo( mCurrentItemMenu ); + connect( mCloneAction, SIGNAL( activated() ), + mView, SLOT( cloneIncidence() ) ); + mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); + mMoveAction->addTo( mCurrentItemMenu ); + connect( mMoveAction, SIGNAL( activated() ), + mView, SLOT( moveIncidence() ) ); + mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); + mBeamAction->addTo(mCurrentItemMenu ); + connect( mBeamAction, SIGNAL( activated() ), + mView, SLOT( beamIncidence() ) ); + mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); + mCancelAction->addTo( mCurrentItemMenu ); + connect( mCancelAction, SIGNAL( activated() ), + mView, SLOT( toggleCancelIncidence() ) ); +#ifdef DESKTOP_VERSION + actionMenu->insertSeparator(); +#endif + + QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); ne_action->addTo( actionMenu ); connect( ne_action, SIGNAL( activated() ), mView, SLOT( newEvent() ) ); icon = loadPixmap( pathString + "newtodo" ); configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); nt_action->addTo( actionMenu ); connect( nt_action, SIGNAL( activated() ), mView, SLOT( newTodo() ) ); - icon = loadPixmap( pathString + "today" ); - QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); - today_action->addTo( viewMenu ); - connect( today_action, SIGNAL( activated() ), - mView, SLOT( goToday() ) ); - viewMenu->insertSeparator(); + // *********************** if ( KOPrefs::instance()->mVerticalScreen ) { icon = SmallIcon( "1updownarrow" ); } else { icon = SmallIcon("1leftrightarrow" ); } configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); FSaction->addTo( viewMenu ); connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); icon = loadPixmap( pathString + "filter" ); configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); icon = loadPixmap( pathString + "configure" ); @@ -842,39 +891,34 @@ void MainWindow::initActions() action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleAllDaySize() ) ); mToggleAllday = action; connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), mToggleNav, SLOT( setEnabled ( bool ) ) ); //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), // mToggleFilter, SLOT( setEnabled ( bool ) ) ); connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), mToggleAllday, SLOT( setEnabled ( bool ) ) ); // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); - viewMenu->insertSeparator(); - icon = loadPixmap( pathString + "picker" ); - action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); - action->addTo( viewMenu ); - connect( action, SIGNAL( activated() ), - mView, SLOT( showDatePicker() ) ); - action->addTo( iconToolBar ); + + dPickerAction->addTo( iconToolBar ); viewMenu->insertSeparator(); if ( p-> mShowIconToggleFull ) FSaction->addTo( iconToolBar ); if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); //******************** if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); icon = loadPixmap( pathString + "whatsnext" ); configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); whatsnext_action->addTo( viewMenu ); connect( whatsnext_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWhatsNextView() ) ); @@ -947,85 +991,66 @@ void MainWindow::initActions() #if 0 action = new QAction( "view_timespan", "Time Span", 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView->viewManager(), SLOT( showTimeSpanView() ) ); #endif mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, this ); mNewSubTodoAction->addTo( actionMenu ); connect( mNewSubTodoAction, SIGNAL( activated() ), mView, SLOT( newSubTodo() ) ); - actionMenu->insertSeparator(); - - mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); - mShowAction->addTo( actionMenu ); - connect( mShowAction, SIGNAL( activated() ), - mView, SLOT( showIncidence() ) ); + action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, + this ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); - mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); - mEditAction->addTo( actionMenu ); - connect( mEditAction, SIGNAL( activated() ), - mView, SLOT( editIncidence() ) ); + + configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); - mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); - mDeleteAction->addTo( actionMenu ); - connect( mDeleteAction, SIGNAL( activated() ), - mView, SLOT( deleteIncidence() ) ); - mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); - mCloneAction->addTo( actionMenu ); - connect( mCloneAction, SIGNAL( activated() ), - mView, SLOT( cloneIncidence() ) ); - mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); - mMoveAction->addTo( actionMenu ); - connect( mMoveAction, SIGNAL( activated() ), - mView, SLOT( moveIncidence() ) ); - mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); - mBeamAction->addTo( actionMenu ); - connect( mBeamAction, SIGNAL( activated() ), - mView, SLOT( beamIncidence() ) ); - mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); - mCancelAction->addTo( actionMenu ); - connect( mCancelAction, SIGNAL( activated() ), - mView, SLOT( toggleCancelIncidence() ) ); - actionMenu->insertSeparator(); - - action = new QAction( "purge_completed", i18n("Purge Completed"), 0, + action = new QAction( "manage cat", i18n("Edit category list..."), 0, this ); - action->addTo( actionMenu ); - connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); - icon = loadPixmap( pathString + "search" ); - QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); - configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); - search_action->addTo( actionMenu ); - connect( search_action, SIGNAL( activated() ), - mView->dialogManager(), SLOT( showSearchDialog() ) ); + action = new QAction( "manage cat", i18n("Manage new categories..."), 0, + this ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); - + actionMenu->insertSeparator(); + icon = loadPixmap( pathString + "configure" ); + action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( edit_options() ) ); + icon = loadPixmap( pathString + "configure" ); + action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( edit_global_options() ) ); if ( KOPrefs::instance()->mShowFullMenu ) { - actionMenu->insertSeparator(); actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); } // actionMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, this ); action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); action = new QAction( "import_quick", i18n("Import last file"), 0, this ); action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); importMenu_X->insertSeparator(); action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, this ); action->addTo( importMenu_X ); @@ -1111,37 +1136,33 @@ void MainWindow::initActions() mView->viewManager(), SLOT( slotprintWNV() ) ); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), this, SLOT( printListView() ) ); action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView, SLOT( slotprintSelInc() ) ); importMenu->insertItem( i18n("Print"), beamMenu_X ); #endif - importMenu->insertSeparator(); - action = new QAction( "manage cat", i18n("Manage new categories..."), 0, - this ); - action->addTo( importMenu ); - connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); + importMenu->insertSeparator(); action = new QAction( "beam all", i18n("Save"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); action = new QAction( "beam all", i18n("Exit (+save)"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); //menuBar->insertItem( "Configure",configureMenu ); //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); icon = loadPixmap( "korganizer/korganizer" ); action = new QAction( "Whats New", i18n("What's new?"), 0,this ); action->addTo( helpMenu ); @@ -1701,40 +1722,45 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) mShowAction->setText( i18n("Show Todo...") ); mEditAction->setText( i18n("Edit Todo...") ); mDeleteAction->setText( i18n("Delete Todo...") ); mNewSubTodoAction->setEnabled( true ); } else { mShowAction->setText( i18n("Show...") ); mShowAction->setText( i18n("Edit...") ); mShowAction->setText( i18n("Delete...") ); mNewSubTodoAction->setEnabled( false ); } } void MainWindow::enableIncidenceActions( bool enabled ) { + +#ifndef DESKTOP_VERSION + mCurrentItemMenu->setEnabled( enabled ); +#else mShowAction->setEnabled( enabled ); mEditAction->setEnabled( enabled ); mDeleteAction->setEnabled( enabled ); mCloneAction->setEnabled( enabled ); mMoveAction->setEnabled( enabled ); mBeamAction->setEnabled( enabled ); mCancelAction->setEnabled( enabled ); +#endif } void MainWindow::importOL() { #ifdef _OL_IMPORT_ mView->clearAllViews(); KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); id->exec(); delete id; mView->calendar()->checkAlarmForIncidence( 0, true ); mView->updateView(); #endif } void MainWindow::importBday() { int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), @@ -2261,32 +2287,33 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); // initActions(); + setCaption ( i18n("Toolbar changes needs a restart!") ); } void MainWindow::setCaption ( const QString & c ) { QString cap = c; cap.replace( QRegExp("\n"), " " ); cap = cap.stripWhiteSpace(); if ( cap.isEmpty() ) cap = "KO/Pi"; QWidget::setCaption( cap ); } void MainWindow::setCaptionToDates() { QString selDates; QDate date = mView->startDate(); if ( ! date.isValid() ) { setCaption(""); |