-rw-r--r-- | korganizer/mainwindow.cpp | 2 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 856f7db..468fd5b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1649,418 +1649,418 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) if ( e->state() == Qt::ControlButton) pro += 10; break; case Qt::Key_M: mView->viewManager()->showMonthView(); showSelectedDates = true; break; case Qt::Key_Insert: mView->newEvent(); break; case Qt::Key_S : if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) mView->newSubTodo(); else mView->dialogManager()->showSearchDialog(); break; case Qt::Key_Y : case Qt::Key_Z : mView->viewManager()->showWorkWeekView(); showSelectedDates = true; break; case Qt::Key_U : mView->viewManager()->showWeekView(); showSelectedDates = true; break; case Qt::Key_H : keyBindings(); break; case Qt::Key_W: mView->viewManager()->showWhatsNextView(); break; case Qt::Key_L: mView->viewManager()->showListView(); break; case Qt::Key_N: mView->viewManager()->showNextXView(); showSelectedDates = true; break; case Qt::Key_V: mView->viewManager()->showTodoView(); break; case Qt::Key_C: mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); break; case Qt::Key_P: mView->showDatePicker( ); break; case Qt::Key_F: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->editFilters(); else mView->toggleFilter(); break; case Qt::Key_X: mView->toggleDateNavigatorWidget(); break; case Qt::Key_Space: mView->toggleExpand(); break; case Qt::Key_A: mView->toggleAllDaySize(); break; case Qt::Key_T: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->newTodo(); else { mView->goToday(); showSelectedDates = true; } break; case Qt::Key_J: mView->viewManager()->showJournalView(); break; case Qt::Key_B: mView->editIncidenceDescription();; break; // case Qt::Key_Return: case Qt::Key_E: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->newEvent(); else mView->editIncidence(); break; case Qt::Key_Plus: size = p->mHourSize +2; if ( size <= 22 ) configureAgenda( size ); break; case Qt::Key_Minus: size = p->mHourSize - 2; if ( size >= 4 ) configureAgenda( size ); break; default: e->ignore(); } if ( pro > 0 ) { mView->selectFilter( pro-1 ); } if ( showSelectedDates ) { ;// setCaptionToDates(); } } void MainWindow::fillFilterMenu() { selectFilterMenu->clear(); bool disable = false; selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); selectFilterMenu->insertSeparator(); if ( mView->filterView()->filtersEnabled() ) { selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); } else { selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); disable = true; } selectFilterMenu->insertSeparator(); QPtrList<CalFilter> fili = mView->filters(); CalFilter *curfilter = mView->filterView()->selectedFilter(); CalFilter *filter = fili.first(); int iii = 2; while(filter) { selectFilterMenu->insertItem( filter->name(), iii ); if ( filter == curfilter) selectFilterMenu->setItemChecked( iii, true ); if ( disable ) selectFilterMenu->setItemEnabled( iii, false ); filter = fili.next(); ++iii; } } void MainWindow::selectFilter( int fil ) { if ( fil == 0 ) { mView->editFilters( ); } else if ( fil == 1 ){ mView->toggleFilerEnabled( ); } else { mView->selectFilter( fil-2 ); } } void MainWindow::configureToolBar( int item ) { configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); KOPrefs *p = KOPrefs::instance(); p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 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 ); // initActions(); } void MainWindow::setCaptionToDates() { QString selDates; selDates = KGlobal::locale()->formatDate(mView->startDate(), true); if (mView->startDate() < mView->endDate() ) selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); else { QString addString; if ( mView->startDate() == QDateTime::currentDateTime().date() ) addString = i18n("Today"); else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) addString = i18n("Tomorrow"); if ( !addString.isEmpty() ) selDates = addString+", "+selDates ; } setCaption( i18n("Dates: ") + selDates ); } void MainWindow::showConfigureAgenda( ) { int iii; for ( iii = 1;iii<= 10 ;++iii ){ configureAgendaMenu->setItemChecked( (iii+1)*2, false ); } configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); } void MainWindow::configureAgenda( int item ) { if ( KOPrefs::instance()->mHourSize == item ) return; KOPrefs::instance()->mHourSize=item; mView->viewManager()->agendaView()->updateConfig(); } void MainWindow::saveCalendar() { QString fn = KOPrefs::instance()->mLastSaveFile; fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { createbup = false; } } if ( createbup ) { mView->saveCalendar( fn ); mes = i18n("KO/Pi:Saved %1").arg(fn); KOPrefs::instance()->mLastSaveFile = fn; setCaption(mes); } } void MainWindow::loadCalendar() { QString fn = KOPrefs::instance()->mLastLoadFile; fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mess; bool loadbup = true; if ( info. exists() ) { mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); int result = QMessageBox::warning( this, "KO/Pi: Warning!", mess, i18n("Load!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { loadbup = false; } } else { QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 0, 1 ); return; } if ( loadbup ) { mView->openCalendar( fn ); KOPrefs::instance()->mLastLoadFile = fn; mess = i18n("KO/Pi:Loaded %1").arg(fn) ; setCaption(mess); } } void MainWindow::quickImportIcal() { importFile( KOPrefs::instance()->mLastImportFile, false ); } void MainWindow::importFile( QString fn, bool quick ) { QFileInfo info; info.setFile( fn ); QString mess; bool loadbup = true; if ( !info. exists() ) { mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), mess ); return; } int result = 0; if ( !quick ) { mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); result = QMessageBox::warning( this, "KO/Pi: Warning!", mess, "Import", "Cancel", 0, 0, 1 ); } if ( result == 0 ) { if ( mView->openCalendar( fn, true )) { KOPrefs::instance()->mLastImportFile = fn; setCaption(i18n("Imported file successfully")); } else { setCaption(i18n("Error importing file")); } } } void MainWindow::importIcal() { QString fn =KOPrefs::instance()->mLastImportFile; fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); if ( fn == "" ) return; importFile( fn, true ); } void MainWindow::exportVCalendar() { QString fn = KOPrefs::instance()->mLastVcalFile; fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { createbup = false; } } if ( createbup ) { if ( mView->exportVCalendar( fn ) ) { KOPrefs::instance()->mLastVcalFile = fn; if ( fn.length() > 20 ) mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; else mes = i18n("KO/Pi:Exported to %1").arg(fn ); setCaption(mes); } } } void MainWindow::syncFileRequest() { if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { mSyncManager->slotSyncMenu( 999 ); } save(); } void MainWindow::getFile( bool success ) { if ( ! success ) { setCaption( i18n("Error receiving file. Nothing changed!") ); return; } mView->openCalendar( defaultFileName() ); if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { mSyncManager->slotSyncMenu( 999 ); } setCaption( i18n("Pi-Sync successful!") ); } void MainWindow::printSel( ) { mView->viewManager()->agendaView()->agenda()->printSelection(); } void MainWindow::printCal() { mView->print();//mCp->showDialog(); } #include "libkdepim/kdatepicker.h" #include <kdatetbl.h> void MainWindow::weekAction() { int month; KPopupFrame* popup = new KPopupFrame(this); - KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup); + KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); picker->setFocus(); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); int x = 0; int y = iconToolBar->height(); int dX = 0; int dY = 0; if ( iconToolBar->orientation () == Qt:: Horizontal ) { if ( iconToolBar->y() > height()/2 ) { dY = picker->sizeHint().height()+8; y = 0; } } else { if ( iconToolBar->x() > width()/2 ) { // right side x=0; dX= picker->sizeHint().width()+8; y = 0; } else { x= iconToolBar->width(); y = 0; } } //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) { month = picker->getResult(); emit selectWeek ( month ); //qDebug("weekSelected %d ", month); } delete popup; } diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 4a31c77..2b8fd4f 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -1,203 +1,200 @@ /* This file is part of KOrganizer. Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qstring.h> #include <qtooltip.h> #include <qpushbutton.h> #include <qlayout.h> #include <qframe.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qapplication.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include "libkdepim/kdatepicker.h" #include <knotifyclient.h> #include "kdatetbl.h" #include "koglobals.h" #include <kglobalsettings.h> #include "koprefs.h" #ifndef KORG_NOPLUGINS #include "kocore.h" #endif #include <kcalendarsystem.h> #include "navigatorbar.h" NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) : QWidget( parent, name ) { QBoxLayout *topLayout = new QHBoxLayout( this ); // Set up the control buttons and date label mCtrlFrame = new QFrame( this ); mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); mCtrlFrame->setLineWidth(1); topLayout->addWidget( mCtrlFrame ); QFont tfont = KGlobalSettings::generalFont();//font(); if ( QApplication::desktop()->width() >= 480 ) tfont.setPointSize(tfont.pointSize()+2); tfont.setBold(true); bool isRTL = KOGlobals::self()->reverseLayout(); #ifndef DESKTOP_VERSION bool isDesktop = false; #else bool isDesktop = true; #endif if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons mPrevYear = new QPushButton( mCtrlFrame ); mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); QToolTip::add( mPrevYear, i18n("Previous Year") ); mPrevMonth = new QPushButton( mCtrlFrame ); mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); QToolTip::add( mPrevMonth, i18n("Previous Month") ); // Create forward navigation buttons mNextMonth = new QPushButton( mCtrlFrame ); mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); QToolTip::add( mNextMonth, i18n("Next Month") ); mNextYear = new QPushButton( mCtrlFrame ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); QToolTip::add( mNextYear, i18n("Next Year") ); mSelectMonth = new QPushButton( mCtrlFrame ); // Create month name label //selectMonth->setFont( tfont ); // selectMonth->setAlignment( AlignCenter ); //mDateLabel = new QLabel( selectMonth ); //mDateLabel->setFont( tfont ); //mDateLabel->setAlignment( AlignCenter ); if ( QString ( name ) == QString("useBigPixmaps") ) { mNextMonth->setFlat( true); mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); mPrevMonth->setFlat( true); } mSelectMonth->setFont( tfont ); // Set minimum width to width of widest month name label int i; int maxwidth = 0; QFontMetrics fm ( mSelectMonth->font() ); int width = fm.width("September '00" ); // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); // ++i ) { // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); // int width = fm.width("September 2000" ); // if ( width > maxwidth ) maxwidth = width; // } maxwidth = width+2; int size = fm.height()+2; if ( QApplication::desktop()->width() >= 480 ) { size += 6; maxwidth+= 6; } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); mPrevYear->setFocusPolicy(NoFocus); mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } NavigatorBar::~NavigatorBar() { } void NavigatorBar::selectMonth() { int month; KPopupFrame* popup = new KPopupFrame(this); - int size = 12; - if ( QApplication::desktop()->width() >= 480 ) - size = 18; - KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); + KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); // ----- picker->resize(picker->sizeHint()); popup->setMainWidget(picker); picker->setFocus(); connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) { month = picker->getResult(); emit monthSelected ( month ); } else { KNotifyClient::beep(); } delete popup; } void NavigatorBar::selectDates( const KCal::DateList &dateList ) { if (dateList.count() > 0) { QDate date = dateList.first(); const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); // compute the label at the top of the navigator QString dtstr = i18n(calSys->monthName( date )) + " '" + QString::number( calSys->year( date ) ).right(2); mSelectMonth->setText( dtstr ); } } |