-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 12 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 7 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
5 files changed, 23 insertions, 19 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a10e93c..72221fd 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -293,779 +293,785 @@ class KOBeamPrefs : public QDialog QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); resize( 200, 200 ); } bool beamVcal() { return vcal->isChecked(); } bool beamLocal() { return local->isChecked(); } private: QRadioButton* vcal, *ical, *local, *tz; }; class KOCatPrefs : public QDialog { public: KOCatPrefs( QWidget *parent=0, const char *name=0 ) : QDialog( parent, name, true ) { setCaption( i18n("Manage new Categories") ); QVBoxLayout* lay = new QVBoxLayout( this ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); lay->addWidget( lab ); QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; addCatBut = new QRadioButton(i18n("Add to category list"), format ); new QRadioButton(i18n("Remove from Events/Todos"), format ); addCatBut->setChecked( true ); QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); lay->addWidget( ok ); QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); lay->addWidget( cancel ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); resize( 200, 200 ); } bool addCat() { return addCatBut->isChecked(); } private: QRadioButton* addCatBut; }; CalendarView::CalendarView( CalendarResources *calendar, QWidget *parent, const char *name ) : CalendarViewBase( parent, name ), mCalendar( calendar ), mResourceManager( calendar->resourceManager() ) { mEventEditor = 0; mTodoEditor = 0; init(); } CalendarView::CalendarView( Calendar *calendar, QWidget *parent, const char *name ) : CalendarViewBase( parent, name ), mCalendar( calendar ), mResourceManager( 0 ) { mEventEditor = 0; mTodoEditor = 0; init(); } void CalendarView::init() { mNextAlarmDateTime = QDateTime::currentDateTime(); setFocusPolicy ( NoFocus ); mViewerCallerIsSearchDialog = false; mBlockShowDates = false; mDatePickerMode = 0; mCurrentSyncDevice = ""; mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); mEventViewerDialog = 0; mModified = false; mReadOnly = false; mSelectedIncidence = 0; mCalPrinter = 0; mFilters.setAutoDelete(true); mCalendar->registerObserver( this ); // TODO: Make sure that view is updated, when calendar is changed. mStorage = new FileStorage( mCalendar ); mNavigator = new DateNavigator( this, "datevav", mViewManager ); QBoxLayout *topLayout = (QBoxLayout*)layout(); #ifndef KORG_NOSPLITTER // create the main layout frames. mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); topLayout->addWidget(mPanner); mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, "CalendarView::LeftFrame"); mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); mDateNavigator = new DateNavigatorContainer( mLeftSplitter, "CalendarView::DateNavigator" ); mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); mTodoList->setNavigator( mNavigator ); mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); #ifdef KORG_NORESOURCEVIEW mResourceView = 0; #else if ( mResourceManager ) { mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); mResourceView->updateView(); connect( mResourceView, SIGNAL( resourcesChanged() ), SLOT( updateView() ) ); } else { mResourceView = 0; } #endif QWidget *rightBox = new QWidget( mPanner ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 1 ); mLeftFrame = mLeftSplitter; #else //QWidget *mainBox = new QWidget( this ); //QWidget *leftFrame = new QWidget( mainBox ); //QBoxLayout * mainBoxLayout; if ( KOPrefs::instance()->mVerticalScreen ) { //mainBoxLayout = new QVBoxLayout(mainBox); //leftFrameLayout = new QHBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { //mainBoxLayout = new QHBoxLayout(mainBox); //leftFrameLayout = new QVBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); //QBoxLayout * leftFrameLayout; topLayout->addWidget( mMainFrame ); #ifdef DESKTOP_VERSION mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); topLayout->addWidget( mDateScrollBar ); connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); if ( QApplication::desktop()->width() < 800 ) mDateScrollBar->hide(); #endif //mainBoxLayout->addWidget (mLeftFrame); mDateNavigator = new DateNavigatorContainer( mLeftFrame, "CalendarView::DateNavigator" ); #if 0 // FIXME mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, "CalendarView::DateNavigator", QDate::currentDate()); #endif // mDateNavigator->blockSignals( true ); //leftFrameLayout->addWidget( mDateNavigator ); mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); mTodoList->setNavigator( mNavigator ); #if 0 if ( QApplication::desktop()->width() < 480 ) { leftFrameLayout->addWidget(mFilterView); leftFrameLayout->addWidget(mTodoList, 2 ); } else { leftFrameLayout->addWidget(mTodoList,2 ); leftFrameLayout->addWidget(mFilterView ); } #endif mFilterView->hide(); mCalEditView->hide(); QWidget *rightBox = new QWidget( mMainFrame ); //mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 10 ); //mLeftFrame = (QWidget *)leftFrame; if ( KOPrefs::instance()->mVerticalScreen ) { //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); } else { //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) mDateNavigator->hide(); //qDebug("Calendarview Size %d %d ", width(), height()); #endif connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( showDates( const KCal::DateList & ) ) ); connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), mViewManager, SLOT( showMonth( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mDateNavigator, SIGNAL( goNextYear() ), mNavigator, SLOT( selectNextYear() ) ); connect( mDateNavigator, SIGNAL( goPrevMonth() ), mNavigator, SLOT( selectPreviousMonth() ) ); connect( mDateNavigator, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); connect( mDateNavigator, SIGNAL( goPrevious() ), mNavigator, SLOT( selectPrevious() ) ); connect( mDateNavigator, SIGNAL( goNext() ), mNavigator, SLOT( selectNext() ) ); connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), mNavigator, SLOT( slotMonthSelect( int ) ) ); connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); #if 0 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), SLOT( incidenceAdded( Incidence *) ) ); #endif // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); connect( this, SIGNAL( configChanged() ), mDateNavigator, SLOT( updateConfig() ) ); connect( mTodoList, SIGNAL( newTodoSignal() ), SLOT( newTodo() ) ); connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), SLOT( newSubTodo( Todo * ) ) ); connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), SLOT( editTodo( Todo * ) ) ); connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), SLOT( showTodo( Todo *) ) ); connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), SLOT( deleteTodo( Todo *) ) ); connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); connect( mTodoList, SIGNAL( purgeCompletedSignal() ), SLOT( purgeCompleted() ) ); connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), SIGNAL( todoModified( Todo *, int ) ) ); connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), this, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), this, SLOT (cancelIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), this, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), this, SLOT ( beamIncidence( Incidence * ) ) ); connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), this, SLOT ( todo_unsub( Todo * ) ) ); connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), this, SLOT ( todo_resub( Todo *,Todo * ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, SLOT( updateTodo( Todo *, int ) ) ); connect( this, SIGNAL( todoModified( Todo *, int )), this, SLOT( changeTodoDisplay( Todo *, int ) ) ); connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); connect(QApplication::clipboard(),SIGNAL(dataChanged()), SLOT(checkClipboard())); connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processTodoListSelection( Incidence * ) ) ); connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); // kdDebug() << "CalendarView::CalendarView() done" << endl; mDateFrame = new QVBox(0,0,WType_Popup); //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); mDateFrame->setLineWidth(3); mDateFrame->hide(); mDateFrame->setCaption( i18n( "Pick a date to display")); mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); mEventEditor = mDialogManager->getEventEditor(); mTodoEditor = mDialogManager->getTodoEditor(); mFlagEditDescription = false; mSuspendTimer = new QTimer( this ); mAlarmTimer = new QTimer( this ); mRecheckAlarmTimer = new QTimer( this ); connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); mAlarmDialog = new AlarmDialog( this ); connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); mAlarmDialog->setServerNotification( false ); mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); #ifndef DESKTOP_VERSION //US listen for arriving address resultsets connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); #endif mDateNavigator->setCalendar( mCalendar ); } CalendarView::~CalendarView() { // kdDebug() << "~CalendarView()" << endl; //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; delete mViewManager; delete mStorage; delete mDateFrame ; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } void CalendarView::setCalReadOnly( int id, bool readO ) { if ( readO ) { emit save(); } mCalendar->setReadOnly( id, readO ); } void CalendarView::setScrollBarStep(int val ) { #ifdef DESKTOP_VERSION mDateScrollBar->setLineStep ( val ); #endif } void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; static bool block = false; if ( block ) return; block = true; - val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); - //qDebug("VAL %d ",val ); int count = mNavigator->selectedDates().count(); - int year = mNavigator->selectedDates().first().year(); int day = mNavigator->selectedDates().first().dayOfYear(); - if ( val == day -1 ) { + int stepdays = val; + if ( mDateScrollBar->lineStep () <= count ) { + val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + //qDebug("VAL %d ",val ); + stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + stepdays = day-1+stepdays; + if ( stepdays < 0 ) stepdays = 0; + } + if ( stepdays == day -1 ) { block = false; return; } + int year = mNavigator->selectedDates().first().year(); QDate d ( year,1,1 ); - mNavigator->selectDates( d.addDays( val ), count ); + mNavigator->selectDates( d.addDays( stepdays) , count ); block = false; #endif } void CalendarView::checkFiles() { QString message; QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); while ( cal ) { if ( cal->mErrorOnLoad ) { message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; } cal = calendars.next(); } if ( !message.isEmpty() ) { message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); } QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); } void CalendarView::checkAlarms() { KConfig *config = KOGlobals::config(); config->setGroup( "AppRun" ); QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); int daysto = dt.daysTo( QDate::currentDate() ); int days = config->readNumEntry( "LatestProgramStopDays" , daysto); dt = dt.addDays( days ); int secto = dt.secsTo( QDateTime::currentDateTime() ); int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; //qDebug("KO: Reading program stop %d ", secs); //secs -= ( 3600 * 24*3 ); // debug only QDateTime latest = dt.addSecs ( secs ); qDebug("KO: Last termination on %s ", latest.toString().latin1()); //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); QPtrList<Incidence> el = mCalendar->rawIncidences(); QPtrList<Incidence> al; Incidence* inL = el.first(); QDateTime cur = QDateTime::currentDateTime().addSecs(-59); qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); while ( inL ) { bool ok = false; int offset = 0; QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; if ( ok ) { //qDebug("OK %s",next.toString().latin1()); if ( next < cur ) { al.append( inL ); //qDebug("found missed alarm: %s ", inL->summary().latin1() ); } } inL = el.next(); } if ( al.count() ) { QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); dia->setCaption( i18n("KO/Pi: Missing alarms!") ); QVBoxLayout* lay = new QVBoxLayout( dia ); lay->setSpacing( 0 ); lay->setMargin( 0 ); MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); lay->addWidget( matb ); if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { int wid = 210; int x = QApplication::desktop()->width() - wid - 7; int y = QApplication::desktop()->height() - wid - 70; dia->setGeometry ( x,y,wid,wid); } else { int si = 220; if ( QApplication::desktop()->width() > 470 ) si = 400; dia->resize(si,si/2); } dia->setBackgroundColor( QColor( 255, 255, 255 ) ); dia->show(); } } void CalendarView::showDay( QDate d ) { dateNavigator()->blockSignals( true ); dateNavigator()->selectDate( d ); dateNavigator()->blockSignals( false ); mViewManager->showDayView(); //dateNavigator()->selectDate( d ); } void CalendarView::timerAlarm() { //qDebug("CalendarView::timerAlarm() "); computeAlarm(mAlarmNotification ); } void CalendarView::suspendAlarm() { //qDebug(" CalendarView::suspendAlarm() "); computeAlarm(mSuspendAlarmNotification ); } void CalendarView::startAlarm( QString mess , QString filename) { topLevelWidget()->showNormal(); topLevelWidget()->setActiveWindow(); topLevelWidget()->raise(); mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); } void CalendarView::checkNextTimerAlarm() { mCalendar->checkAlarmForIncidence( 0, true ); } void CalendarView::computeAlarm( QString msg ) { QString mess = msg; QString mAlarmMessage = mess.mid( 9 ); QString filename = MainWindow::resourcePath(); filename += "koalarm.wav"; QString tempfilename; if ( mess.left( 13 ) == "suspend_alarm") { bool error = false; int len = mess.mid( 13 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 13, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( ! error ) { filename = tempfilename; } mAlarmMessage = mess.mid( 13+len+3 ); //qDebug("suspend file %s ",tempfilename.latin1() ); startAlarm( mAlarmMessage, filename); return; } if ( mess.left( 11 ) == "timer_alarm") { //mTimerTime = 0; startAlarm( mess.mid( 11 ), filename ); return; } if ( mess.left( 10 ) == "proc_alarm") { bool error = false; int len = mess.mid( 10 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 10, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( error ) { mAlarmMessage = "Procedure Alarm\nError - File not found\n"; mAlarmMessage += mess.mid( 10+len+3+9 ); } else { //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); //qDebug("-----system command %s ",tempfilename.latin1() ); #ifndef _WIN32_ if ( vfork () == 0 ) { execl ( tempfilename.latin1(), 0 ); return; } #else QProcess* p = new QProcess(); p->addArgument( tempfilename.latin1() ); p->start(); return; #endif return; } //qDebug("+++++++system command %s ",tempfilename.latin1() ); } if ( mess.left( 11 ) == "audio_alarm") { bool error = false; int len = mess.mid( 11 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 11, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( ! error ) { filename = tempfilename; } mAlarmMessage = mess.mid( 11+len+3+9 ); //qDebug("audio file command %s ",tempfilename.latin1() ); } if ( mess.left( 9 ) == "cal_alarm") { mAlarmMessage = mess.mid( 9 ) ; } startAlarm( mAlarmMessage, filename ); } void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) { //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); mSuspendAlarmNotification = noti; int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); mSuspendTimer->start( ms , true ); } void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) { mNextAlarmDateTime = qdt; //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { #ifndef DESKTOP_VERSION AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); #endif return; } int maxSec; //maxSec = 5; //testing only maxSec = 86400+3600; // one day+1hour mAlarmNotification = noti; int sec = QDateTime::currentDateTime().secsTo( qdt ); if ( sec > maxSec ) { mRecheckAlarmTimer->start( maxSec * 1000 ); // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); return; } else { mRecheckAlarmTimer->stop(); } //qDebug("Alarm timer started with secs: %d ", sec); mAlarmTimer->start( sec *1000 , true ); } // called by mRecheckAlarmTimer to get next alarm // we need this, because a QTimer has only a max range of 25 days void CalendarView::recheckTimerAlarm() { mAlarmTimer->stop(); mRecheckAlarmTimer->stop(); mCalendar->checkAlarmForIncidence( 0, true ); } #ifndef DESKTOP_VERSION void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) #else void CalendarView::removeAlarm(const QDateTime &, const QString & ) #endif { //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { #ifndef DESKTOP_VERSION AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); #endif return; } mAlarmTimer->stop(); } void CalendarView::selectWeekNum ( int num ) { dateNavigator()->blockSignals( true ); dateNavigator()->selectWeek( num ); dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); } KOViewManager *CalendarView::viewManager() { return mViewManager; } KODialogManager *CalendarView::dialogManager() { return mDialogManager; } QDate CalendarView::startDate() { DateList dates = mNavigator->selectedDates(); return dates.first(); } QDate CalendarView::endDate() { DateList dates = mNavigator->selectedDates(); return dates.last(); } void CalendarView::createPrinter() { #ifndef KORG_NOPRINTER if (!mCalPrinter) { mCalPrinter = new CalPrinter(this, mCalendar); connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); } #endif } //KOPrefs::instance()->mWriteBackFile //KOPrefs::instance()->mWriteBackExistingOnly // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) { // 0 equal // 1 take local // 2 take remote // 3 cancel QDateTime lastSync = mLastCalendarSync; QDateTime localMod = local->lastModified(); QDateTime remoteMod = remote->lastModified(); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); //if ( remCh ) //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); locCh = ( localMod > mLastCalendarSync ); if ( !remCh && ! locCh ) { //qDebug("both not changed "); lastSync = localMod.addDays(1); if ( mode <= SYNC_PREF_ASK ) return 0; } else { if ( locCh ) { //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); lastSync = localMod.addDays( -1 ); if ( !remCh ) remoteMod = ( lastSync.addDays( -1 ) ); } else { //qDebug(" not loc changed "); lastSync = localMod.addDays( 1 ); if ( remCh ) remoteMod =( lastSync.addDays( 1 ) ); } } full = true; if ( mode < SYNC_PREF_ASK ) mode = SYNC_PREF_ASK; } else { if ( localMod == remoteMod ) // if ( local->revision() == remote->revision() ) return 0; } // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); //full = true; //debug only if ( full ) { bool equ = false; if ( local->typeID() == eventID ) { equ = (*((Event*) local) == *((Event*) remote)); } else if ( local->typeID() == todoID ) equ = (*((Todo*) local) == (*(Todo*) remote)); else if ( local->typeID() == journalID ) equ = (*((Journal*) local) == *((Journal*) remote)); if ( equ ) { //qDebug("equal "); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); } diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 0b0fe8e..77322e7 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp @@ -1,195 +1,201 @@ /* This file is part of KOrganizer. Copyright (c) 2000,2001 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 <qcursor.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <libkcal/event.h> #include "koeventpopupmenu.h" #include "koprefs.h" KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() { mCurrentIncidence = 0; mHasAdditionalItems = false; mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); mEditOnlyItems.append(insertItem (i18n("&Delete..."), this,SLOT(popupDelete()))); mEditOnlyItems.append(insertItem (i18n("&Clone..."), this,SLOT(popupClone()))); mEditOnlyItems.append(insertItem (i18n("&Move..."), this,SLOT(popupMove()))); #ifndef DESKTOP_VERSION mEditOnlyItems.append(insertItem (i18n("&Beam..."), this,SLOT(popupBeam()))); #endif mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), this,SLOT(popupCancel()))); isDisabled = false; mCatPopup = new QPopupMenu ( this ); mCatPopup->setCheckable (true); connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); mCalPopup = new QPopupMenu ( this ); mCalPopup->setCheckable (true); connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); - mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); - mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); + //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); + //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); + insertItem (i18n("Categories"),mCatPopup ); + insertItem (i18n("Calendar"),mCalPopup ); QValueList<int>::Iterator it; for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { mSingleOnlyItems.append(*it); } } void KOEventPopupMenu::enableDefault( bool enable ) { isDisabled = !enable; QValueList<int>::Iterator it; for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { setItemEnabled(*it,enable); } } void KOEventPopupMenu::fillCalPopup() // CAL { mCalPopup->clear(); if (!mCurrentIncidence) return; + bool readO = mCurrentIncidence->isReadOnly()|| isDisabled; KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); - if ( kkf->mErrorOnLoad || kkf->isReadOnly ) + if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) mCalPopup->setItemEnabled( index, false ); mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); kkf = KOPrefs::instance()->mCalendars.next(); } } void KOEventPopupMenu::computeCalPopup( int index ) // CAL { if (!mCurrentIncidence) return; mCurrentIncidence->setCalID( index ); emit categoryChanged( mCurrentIncidence ); } void KOEventPopupMenu::fillCatPopup() { mCatPopup->clear(); if (!mCurrentIncidence) return; + bool readO = mCurrentIncidence->isReadOnly() || isDisabled; QStringList checkedCategories = mCurrentIncidence->categories(); int index = 0; for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); it != KOPrefs::instance()->mCustomCategories.end (); ++it) { mCatPopup->insertItem (*it, index ); if (checkedCategories.find (*it) != checkedCategories.end ()) { mCatPopup->setItemChecked (index, true); } + if ( readO ) + mCatPopup->setItemEnabled( index, false ); ++index; } } void KOEventPopupMenu::computeCatPopup( int index ) { if (!mCurrentIncidence) return; QStringList categories = mCurrentIncidence->categories(); QString colcat = categories.first(); if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) categories.remove (KOPrefs::instance()->mCustomCategories[index]); else categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); categories.sort (); if ( !colcat.isEmpty() ) { if ( categories.find ( colcat ) != categories.end () ) { categories.remove( colcat ); categories.prepend( colcat ); } } mCurrentIncidence->setCategories( categories ); emit categoryChanged( mCurrentIncidence ); } void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) { if ( !incidence) return; mCurrentIncidence = incidence; if (mCurrentIncidence) { // Enable/Disabled menu items only valid for editable events. if ( !isDisabled ) { QValueList<int>::Iterator it; for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); } } popup(QCursor::pos()); } } void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, const QObject *receiver, const char *member, bool editOnly) { if (!mHasAdditionalItems) { mHasAdditionalItems = true; insertSeparator(); } int id = insertItem(icon,text,receiver,member); if (editOnly) mEditOnlyItems.append(id); } void KOEventPopupMenu::popupShow() { if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupEdit() { if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupDelete() { if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupClone() { if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupCancel() { if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupMove() { if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence); } void KOEventPopupMenu::popupBeam() { if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence); } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index cec0476..25e599d 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1,735 +1,735 @@ /* This file is part of KOrganizer. Copyright (c) 1999 Preston Brown Copyright (c) 2000,2001 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 <qlistview.h> #include <qlayout.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qprogressbar.h> #include <qfileinfo.h> #include <qmessagebox.h> #include <qdialog.h> #include <qtextstream.h> #include <qdir.h> #include <qwhatsthis.h> #include <qregexp.h> #include <qpainter.h> #include <qpaintdevicemetrics.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <kglobal.h> #include <libkdepim/kpimglobalprefs.h> #include <libkcal/calendar.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include <libkcal/vcalformat.h> #include <libkcal/recurrence.h> #include <libkcal/filestorage.h> #include <libkdepim/categoryselectdialog.h> #include <libkcal/kincidenceformatter.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koglobals.h" #include "koprefs.h" #include "kfiledialog.h" #include "kolistview.h" #include "koeventviewer.h" extern QPixmap* sgListViewCompletedPix[6]; class KOListViewWhatsThis :public QWhatsThis { public: KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; protected: virtual QString text( const QPoint& p) { return _view->getWhatsThisText(p) ; } private: QWidget* _wid; KOListView * _view; }; ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) { mItem = item; mDate = date; } ListItemVisitor::~ListItemVisitor() { } bool ListItemVisitor::visit(Event *e) { bool ok = false; QString start, end; QDate ds, de; if ( e->doesRecur() ) { ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); if ( ok ) { int days = e->dtStart().date().daysTo(e->dtEnd().date() ); start = KGlobal::locale()->formatDate(ds,true); de = ds.addDays( days); end = KGlobal::locale()->formatDate(de,true); } } if ( ! ok ) { start =e->dtStartDateStr(); end = e->dtEndDateStr(); ds = e->dtStart().date(); de = e->dtEnd().date(); } mItem->setText(0,e->summary()); mItem->setText(1,start); if ( e->doesFloat() ) mItem->setText(2,"---"); else mItem->setText(2,e->dtStartTimeStr()); mItem->setText(3,end); if ( e->doesFloat() ) mItem->setText(4,"---"); else mItem->setText(4,e->dtEndTimeStr()); if ( e->isAlarmEnabled() ) { mItem->setText(5,e->alarms().first()->offsetText() ); } else { mItem->setText(5, i18n("No")); } mItem->setText(6, e->recurrence()->recurrenceText()); if( ! e->doesRecur() ) mItem->setSortKey( 6, "-" ); mItem->setText(7,"---"); mItem->setText(8,"---"); mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,e->categoriesStr()); mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); QString key; QDate d = e->lastModified().date(); QTime t = e->lastModified().time(); key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); mItem->setSortKey(12,key); t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); mItem->setSortKey(1,key); t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); mItem->setSortKey(3,key); return true; } bool ListItemVisitor::visit(Todo *t) { mItem->setText(0,t->summary()); if ( t->isCompleted() ) { mItem->setSortKey(0,"99"+ t->summary().left(10)); } else mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); if (t->hasStartDate()) { mItem->setText(1,t->dtStartDateStr()); if (t->doesFloat()) { mItem->setText(2,"---"); } else { mItem->setText(2,t->dtStartTimeStr()); } } else { mItem->setText(1,"---"); mItem->setText(2,"---"); } mItem->setText(3,"---"); mItem->setText(4,"---"); if ( t->isAlarmEnabled() ) { mItem->setText(5,t->alarms().first()->offsetText() ); } else { mItem->setText(5, i18n("No")); } mItem->setText(6, t->recurrence()->recurrenceText()); if( ! t->doesRecur() ) mItem->setSortKey( 6, "-" ); if (t->hasDueDate()) { mItem->setText(7,t->dtDueDateStr()); if (t->doesFloat()) { mItem->setText(8,"---"); } else { mItem->setText(8,t->dtDueTimeStr()); } } else { mItem->setText(7,"---"); mItem->setText(8,"---"); } mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,t->categoriesStr()); mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); QString key; QDate d = t->lastModified().date(); QTime tm = t->lastModified().time(); key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); mItem->setSortKey(12,key); if (t->hasDueDate()) { d = t->dtDue().date(); tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); mItem->setSortKey(7,key); } if ( t->hasStartDate() ) { d = t->dtStart().date(); tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); mItem->setSortKey(1,key); } return true; } bool ListItemVisitor::visit(Journal * j) { QString des; if ( !j->summary().isEmpty() ) { des = j->summary(); } else { des = j->description().left(30); des = des.simplifyWhiteSpace (); des.replace (QRegExp ("\\n"),"" ); des.replace (QRegExp ("\\r"),"" ); } mItem->setText(0,i18n("Journal: ")+des.left(25)); mItem->setText(1,j->dtStartDateStr()); mItem->setText(2,"---"); mItem->setText(3,"---"); mItem->setText(4,"---"); mItem->setText(5,"---"); mItem->setText(6,"---"); mItem->setText(7,j->dtStartDateStr()); mItem->setText(8,"---"); mItem->setText(9,"---"); mItem->setText(10,j->categoriesStr()); mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); QString key; QDate d = j->lastModified().date(); QTime tm = j->lastModified().time(); key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); mItem->setSortKey(12,key); d = j->dtStart().date(); key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); mItem->setSortKey(1,key); mItem->setSortKey(7,key); return true; } KOListView::KOListView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView(calendar, parent, name) { mActiveItem = 0; mForceShowCompletedTodos = false; mListView = new KOListViewListView(this); mListView->addColumn(i18n("Summary")); mListView->addColumn(i18n("Start Date")); mListView->addColumn(i18n("Start Time")); mListView->addColumn(i18n("End Date")); mListView->addColumn(i18n("End Time")); mListView->addColumn(i18n("Alarm")); // alarm set? mListView->addColumn(i18n("Recurs")); // recurs? mListView->addColumn(i18n("Due Date")); mListView->addColumn(i18n("Due Time")); mListView->addColumn(i18n("Cancelled")); mListView->addColumn(i18n("Categories")); mListView->addColumn(i18n("Calendar")); mListView->addColumn(i18n("Last Modified")); mListView->setColumnAlignment(0,AlignLeft); mListView->setColumnAlignment(1,AlignLeft); mListView->setColumnAlignment(2,AlignHCenter); mListView->setColumnAlignment(3,AlignLeft); mListView->setColumnAlignment(4,AlignHCenter); mListView->setColumnAlignment(5,AlignLeft); mListView->setColumnAlignment(6,AlignLeft); mListView->setColumnAlignment(7,AlignLeft); mListView->setColumnAlignment(8,AlignLeft); mListView->setColumnAlignment(9,AlignLeft); mListView->setColumnAlignment(10,AlignLeft); mListView->setColumnAlignment(11,AlignLeft); mListView->setColumnAlignment(12,AlignLeft); mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); int iii = 0; for ( iii = 0; iii< 13 ; ++iii ) mListView->setColumnWidthMode( iii, QListView::Manual ); QBoxLayout *layoutTop = new QVBoxLayout(this); layoutTop->addWidget(mListView); mListView->setFont ( KOPrefs::instance()->mListViewFont ); mPopupMenu = eventPopup(); QPopupMenu* selPopup = new QPopupMenu ( this ); mPopupMenu->insertSeparator(); selPopup->insertItem(i18n("All"),this, SLOT(allSelection())); selPopup->insertItem(i18n("None"),this, SLOT(clearSelection())); selPopup->insertItem(i18n("Delete selected..."),this, SLOT(deleteAll())); mPopupMenu->insertItem(i18n("Selection"), selPopup ); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Hide all selected"),this, SLOT(hideAll()),true); selPopup->insertSeparator(); + QPopupMenu * exportPO = new QPopupMenu ( this ); + selPopup->insertItem( i18n("Export"), exportPO ); #ifdef DESKTOP_VERSION mPopupMenu->insertSeparator(); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), - i18n("Print complete list"),this, + i18n("Print complete list..."),this, SLOT(printList()),true); #endif mCalPopup = new QPopupMenu ( this ); selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); selPopup->insertItem(i18n("Set categories")+"...",this, SLOT(setCat()) ); selPopup->insertItem( i18n("Set alarm..."),this, SLOT(setAlarm())); #if 0 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Set categories")+"...",this, SLOT(setCat()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Set alarm..."),this, SLOT(setAlarm()),true); #endif QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, SLOT( populateCalPopup() )); QObject::connect(mCalPopup,SIGNAL(activated( int )),this, SLOT( setCalendar( int ) )); QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, SLOT( catChanged( Incidence * ) )); - QPopupMenu * exportPO = new QPopupMenu ( this ); - selPopup->insertItem( i18n("Export"), exportPO ); exportPO->insertItem( i18n("As iCal (ics) file..."),this, SLOT(saveToFile())); exportPO->insertItem( i18n("As vCal (vcs) file..."),this, SLOT(saveToFileVCS())); exportPO->insertItem( i18n("Journal/Details..."),this, SLOT(saveDescriptionToFile())); // mPopupMenu->insertSeparator(); // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), // i18n("Add Categ. to selected..."),this, // SLOT(addCat()),true); //mPopupMenu->insertSeparator(); #ifndef DESKTOP_VERSION selPopup->insertSeparator(); selPopup->insertItem( i18n("Beam via IR..."),this, SLOT(beamSelected())); #if 0 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Beam via IR"),this, SLOT(beamSelected()),true); #endif #endif /* mPopupMenu = new QPopupMenu; mPopupMenu->insertItem(i18n("Edit Event"), this, SLOT (editEvent())); mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, SLOT (deleteEvent())); mPopupMenu->insertSeparator(); mPopupMenu->insertItem(i18n("Show Dates"), this, SLOT(showDates())); mPopupMenu->insertItem(i18n("Hide Dates"), this, SLOT(hideDates())); */ QObject::connect(mListView,SIGNAL( newEvent()), this,SIGNAL(signalNewEvent())); QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), this,SLOT(defaultItemAction(QListViewItem *))); QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, const QPoint &, int )), this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), SLOT(processSelectionChange(QListViewItem *))); QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), SIGNAL(showIncidenceSignal(Incidence *)) ); readSettings(KOGlobals::config(),"KOListView Layout"); } KOListView::~KOListView() { delete mPopupMenu; #if QT_VERSION >= 0x030000 #else delete mKOListViewWhatsThis; #endif } void KOListView::catChanged( Incidence* inc) { KOListViewItem* item = getItemForEvent(inc); if (item) { ListItemVisitor v(item, mStartDate ); inc->accept(v); } } QString KOListView::getWhatsThisText(QPoint p) { KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); if ( item ) return KIncidenceFormatter::instance()->getFormattedText( item->data(), KOPrefs::instance()->mWTshowDetails, KOPrefs::instance()->mWTshowCreated, KOPrefs::instance()->mWTshowChanged); return i18n("That is the list view" ); } void KOListView::setCalendar( int c ) { int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), i18n("Continue"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { return; } QPtrList<Incidence> delSel = getSelectedIncidences() ; int icount = delSel.count(); if ( icount ) { Incidence *incidence = delSel.first(); while ( incidence ) { incidence->setCalID( c ); KOListViewItem * item = getItemForEvent( incidence ); if ( item ) { ListItemVisitor v(item, mStartDate ); incidence->accept(v); } incidence = delSel.next(); } } QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); while ( cal ) { mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); if ( cal->isStandard ) mCalendar->setDefaultCalendar( cal->mCalNumber ); cal = calendars.next(); } mCalendar->setSyncEventsReadOnly(); mCalendar->reInitAlarmSettings(); } void KOListView::populateCalPopup() { mCalPopup->clear(); KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) mCalPopup->setItemEnabled( index, false ); kkf = KOPrefs::instance()->mCalendars.next(); } } void KOListView::updateList() { // qDebug(" KOListView::updateList() "); } void KOListView::clearList() { clear (); } void KOListView::setCat() { bool set = true; int result = KMessageBox::warningYesNoCancel(this, i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), i18n("Set categories"), i18n("Add"), i18n("Reset")); if (result == KMessageBox::Cancel) return; if (result == KMessageBox::Yes) set = false; setCategories( set ); } void KOListView::setAlarm() { KOAlarmPrefs kap( this); if ( !kap.exec() ) return; QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos Incidence* inc = delSel.first(); int count = 0; while ( inc ) { ++count; if (kap.mAlarmButton->isChecked()) { if (inc->alarms().count() == 0) inc->newAlarm(); QPtrList<Alarm> alarms = inc->alarms(); Alarm *alarm; for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { alarm->setEnabled(true); int j = kap.mAlarmTimeEdit->value()* -60; if (kap.mAlarmIncrCombo->currentItem() == 1) j = j * 60; else if (kap.mAlarmIncrCombo->currentItem() == 2) j = j * (60 * 24); alarm->setStartOffset( j ); if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { alarm->setProcedureAlarm(kap.mAlarmProgram); } else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) alarm->setAudioAlarm(kap.mAlarmSound); else alarm->setType(Alarm::Invalid); //alarm->setAudioAlarm("default"); // TODO: Deal with multiple alarms break; // For now, stop after the first alarm } } else { Alarm* alarm = inc->alarms().first(); if ( alarm ) { alarm->setEnabled(false); alarm->setType(Alarm::Invalid); } } KOListViewItem* item = getItemForEvent(inc); if (item) { ListItemVisitor v(item, mStartDate ); inc->accept(v); } inc = delSel.next(); } topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); qDebug("KO: Set alarm for %d items", count); calendar()->reInitAlarmSettings(); QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::setCategories( bool removeOld ) { KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); csd->setColorEnabled(); if (! csd->exec()) { delete csd; return; } QStringList catList = csd->selectedCategories(); delete csd; QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; Incidence* inc = delSel.first(); while ( inc ) { if ( removeOld ) { inc->setCategories( catList, false ); } else { inc->addCategories( catList, false ); } KOListViewItem* item = getItemForEvent(inc); if (item) { ListItemVisitor v(item, mStartDate ); inc->accept(v); } inc = delSel.next(); } QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::beamSelected() { QPtrList<Incidence> delSel = getSelectedIncidences() ; if ( delSel.count() ) emit beamIncidenceList( delSel ); } void KOListView::saveDescriptionToFile() { int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), i18n("Continue"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { return; } QPtrList<Incidence> delSel = getSelectedIncidences() ; int icount = delSel.count(); if ( icount ) { QString fn = KOPrefs::instance()->mLastSaveFile; fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("File already exists!\nOld 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 ) { QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); Incidence *incidence = delSel.first(); icount = 0; while ( incidence ) { if ( incidence->typeID() == journalID ) { text += "\n************************************\n"; if ( !incidence->summary().isEmpty() ) text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); else text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); if ( !incidence->location().isEmpty() ) text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); ++icount; } else { if ( !incidence->description().isEmpty() ) { text += "\n************************************\n"; if ( incidence->typeID() == todoID ) text += i18n("To-Do: "); text += incidence->summary(); if ( !incidence->location().isEmpty() ) text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; if ( incidence->hasStartDate() ) text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); text += "\n" + i18n("Description: ") + "\n" + incidence->description(); ++icount; } } incidence = delSel.next(); } QFile file( fn ); if (!file.open( IO_WriteOnly ) ) { topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); return; } QTextStream ts( &file ); ts << text; file.close(); //qDebug("%s ", text.latin1()); mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); } } } void KOListView::saveToFileVCS() { writeToFile( false ); } void KOListView::saveToFile() { writeToFile( true ); } QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) { QPtrList<Incidence> delSel ; bool addSubTodos = false; bool askSubTodos = true; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { Incidence* inc = ((KOListViewItem *)item)->data(); if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { if ( (inc->typeID() == todoID && includeTodos) || (inc->typeID() == eventID && includeEvents) || (inc->typeID() == journalID && includeJournals) ) { if ( inc->typeID() == todoID && onlyDueTodos ) { if ( ((Todo*)inc)->hasDueDate() ) delSel.append( inc ); } else delSel.append( inc ); } } if ( inc->typeID() == todoID ) { Todo * todo = (Todo*) inc; if ( todo->relations().count() ) { if ( askSubTodos ) { int result = KMessageBox::warningYesNoCancel(this, i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), i18n("Todo has subtodos"), i18n("Yes"), i18n("No")); if ( result == KMessageBox::Cancel ) { delSel.clear(); return delSel; } if (result == KMessageBox::Yes) addSubTodos = true; askSubTodos = false; } if ( addSubTodos ) { QPtrList<Incidence> tempSel ; inc->addRelationsToList( &tempSel ); Incidence* tempinc = tempSel.first(); while ( tempinc ) { if ( delSel.findRef( tempinc ) == -1 ) { if ( tempinc->typeID() == todoID && onlyDueTodos ) { if ( ((Todo*)tempinc)->hasDueDate() ) delSel.append( tempinc ); } else delSel.append( tempinc ); } tempinc = tempSel.next(); } @@ -931,516 +931,515 @@ void KOListView::showDates(bool show) oldColWidth1 = mListView->columnWidth(1); oldColWidth3 = mListView->columnWidth(3); mListView->setColumnWidth(1, 0); mListView->setColumnWidth(3, 0); } else { mListView->setColumnWidth(1, oldColWidth1); mListView->setColumnWidth(3, oldColWidth3); } mListView->repaint(); } void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOListView::showDates() { showDates(true); } void KOListView::hideDates() { showDates(false); } void KOListView::resetFocus() { topLevelWidget()->setActiveWindow(); topLevelWidget()->raise(); mListView->setFocus(); } void KOListView::updateView() { mListView->setFocus(); if ( mListView->firstChild () ) mListView->setCurrentItem( mListView->firstChild () ); } void KOListView::updateConfig() { mListView->setFont ( KOPrefs::instance()->mListViewFont ); updateView(); } void KOListView::setStartDate(const QDate &start) { mStartDate = start; } void KOListView::showDates(const QDate &start, const QDate &end) { clear(); mStartDate = start; QDate date = start; while( date <= end ) { addEvents(calendar()->events(date)); addTodos(calendar()->todos(date)); addJournals( calendar()->journals4Date(date) ); date = date.addDays( 1 ); } emit incidenceSelected( 0 ); updateView(); } void KOListView::addEvents(QPtrList<Event> eventList) { Event *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } if ( !mListView->currentItem() ){ updateView(); } } void KOListView::addTodos(QPtrList<Todo> eventList) { Todo *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } if ( !mListView->currentItem() ){ updateView(); } } void KOListView::addJournals(QPtrList<Journal> eventList) { Journal *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } if ( !mListView->currentItem() ){ updateView(); } } void KOListView::showCompletedTodos() { mForceShowCompletedTodos = true; } void KOListView::addIncidence(Incidence *incidence) { if ( mUidDict.find( incidence->uid() ) ) return; // mListView->setFont ( KOPrefs::instance()->mListViewFont ); if ( incidence->typeID() == todoID ) { if ( ! mForceShowCompletedTodos ) { if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) return; } } mUidDict.insert( incidence->uid(), incidence ); KOListViewItem *item = new KOListViewItem( incidence, mListView ); ListItemVisitor v(item, mStartDate ); if (incidence->accept(v)) { return; } else delete item; } void KOListView::showEvents(QPtrList<Event> eventList) { clear(); addEvents(eventList); // After new creation of list view no events are selected. emit incidenceSelected( 0 ); } int KOListView::count() { return mListView->childCount(); } void KOListView::changeEventDisplay(Event *event, int action) { KOListViewItem *item; switch(action) { case KOGlobals::EVENTADDED: addIncidence( event ); break; case KOGlobals::EVENTEDITED: item = getItemForEvent(event); if (item) { ListItemVisitor v(item, mStartDate ); ((Incidence*)event)->accept(v); } break; case KOGlobals::EVENTDELETED: item = getItemForEvent(event); if (item) { mUidDict.remove( event->uid() ); delete item; } break; default: ; } } KOListViewItem *KOListView::getItemForEvent(Incidence *event) { KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); while (item) { if (item->data() == event) return item; item = (KOListViewItem *)item->nextSibling(); } return 0; } void KOListView::defaultItemAction(QListViewItem *i) { KOListViewItem *item = static_cast<KOListViewItem *>( i ); if ( item ) defaultAction( item->data() ); } void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) { mActiveItem = (KOListViewItem *)item; if (mActiveItem) { Incidence *incidence = mActiveItem->data(); mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); mPopupMenu->showIncidencePopup(incidence); /* if ( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>( incidence ); mPopupMenu->showEventPopup(event); } */ } } void KOListView::readSettings(KConfig *config, QString setting) { // qDebug("KOListView::readSettings "); mListView->restoreLayout(config,setting); } void KOListView::writeSettings(KConfig *config, QString setting) { // qDebug("KOListView::writeSettings "); mListView->saveLayout(config, setting); } void KOListView::processSelectionChange(QListViewItem *) { KOListViewItem *item = static_cast<KOListViewItem *>( mListView->currentItem() ); if ( !item ) { emit incidenceSelected( 0 ); } else { emit incidenceSelected( item->data() ); } } void KOListView::clearSelection() { mListView->selectAll( false ); } void KOListView::allSelection() { mListView->selectAll( true ); } void KOListView::clear() { mListView->clear(); mUidDict.clear(); } Incidence* KOListView::currentItem() { if ( mListView->currentItem() ) return ((KOListViewItem*) mListView->currentItem())->data(); return 0; } void KOListView::keyPressEvent ( QKeyEvent *e) { if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { deleteAll(); return; } e->ignore(); } void KOListViewListView::keyPressEvent ( QKeyEvent *e) { switch ( e->key() ) { case Qt::Key_Down: if ( e->state() == ShiftButton ) { QListViewItem* cn = currentItem(); if ( !cn ) cn = firstChild(); if ( !cn ) return; while ( cn->nextSibling() ) cn = cn->nextSibling(); setCurrentItem ( cn ); ensureItemVisible ( cn ); e->accept(); return; } if ( e->state() == ControlButton ) { int count = childCount (); int jump = count / 5; QListViewItem* cn; cn = currentItem(); if ( ! cn ) return; if ( jump == 0 ) jump = 1; while ( jump && cn->nextSibling() ) { cn = cn->nextSibling(); --jump; } setCurrentItem ( cn ); ensureItemVisible ( cn ); } else QListView::keyPressEvent ( e ) ; e->accept(); break; case Qt::Key_Up: if ( e->state() == ShiftButton ) { QListViewItem* cn = firstChild(); if ( cn ) { setCurrentItem ( cn ); ensureItemVisible ( cn ); } e->accept(); return; } if ( e->state() == ControlButton ) { int count = childCount (); int jump = count / 5; QListViewItem* cn; cn = currentItem(); if ( ! cn ) return; if ( jump == 0 ) jump = 1; while ( jump && cn->itemAbove ()) { cn = cn->itemAbove (); --jump; } setCurrentItem ( cn ); ensureItemVisible ( cn ); } else QListView::keyPressEvent ( e ) ; e->accept(); break; case Qt::Key_I: { QListViewItem* cn; cn = currentItem(); if ( cn ) { KOListViewItem* ci = (KOListViewItem*)( cn ); if ( ci ){ //emit showIncidence( ci->data()); cn = cn->nextSibling(); if ( cn ) { setCurrentItem ( cn ); ensureItemVisible ( cn ); } emit showIncidence( ci->data()); } } e->accept(); } break; case Qt::Key_Return: case Qt::Key_Enter: { QListViewItem* cn; cn = currentItem(); if ( cn ) { KOListViewItem* ci = (KOListViewItem*)( cn ); if ( ci ){ if ( e->state() == ShiftButton ) ci->setSelected( false ); else ci->setSelected( true ); cn = cn->nextSibling(); if ( cn ) { setCurrentItem ( cn ); ensureItemVisible ( cn ); } } } e->accept(); } break; default: e->ignore(); } } KOListViewListView::KOListViewListView(KOListView * lv ) : KListView( lv, "kolistlistview", false ) { mYMousePos = 0; mPopupTimer = new QTimer(this); connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); #ifndef DESKTOP_VERSION //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif setSelectionMode( QListView::Multi ); setMultiSelection( true); } bool KOListViewListView::hasMultiSelection(QListViewItem* item) { - int selCount = 0; QListViewItem *qitem = firstChild (); while ( qitem ) { if ( qitem->isSelected() && item != qitem ) return true; qitem = qitem->nextSibling(); } return false; } void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) { if (!e) return; QPoint vp = contentsToViewport(e->pos()); QListViewItem *item = itemAt(vp); if (!item) { emit newEvent(); return; } KListView::contentsMouseDoubleClickEvent(e); } #if 0 void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) { //qDebug("contentsMousePressEvent++++ "); KListView::contentsMousePressEvent( e ); if ( e->button() == RightButton ) { QListViewItem* ci = currentItem(); clearSelection () ; if ( ci ) ci->setSelected( true ); } } void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) { KListView::contentsMouseReleaseEvent(e); } void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) { KListView::contentsMouseMoveEvent(e); } #endif void KOListViewListView::popupMenu() { mPopupTimer->stop(); QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); QApplication::postEvent( this->viewport(), e ); } void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) { //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); mYMousePos = mapToGlobal( (e->pos())).y(); if ( e->button() == LeftButton ) { mPopupTimer->start( 600 ); mEventPos = contentsToViewport(e->pos()); mEventGlobalPos = e->globalPos(); } KListView::contentsMousePressEvent( e ); if ( e->button() == RightButton ) { QListViewItem* ci = currentItem(); //clearSelection(); if ( ci ) ci->setSelected( true ); } } void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) { mPopupTimer->stop(); KListView::contentsMouseReleaseEvent(e); } void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) { // qDebug("contentsMouseMoveEv....... "); // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); int diff = mYMousePos - mapToGlobal( (e->pos())).y(); if ( diff < 0 ) diff = -diff; if ( diff > 15 ) mPopupTimer->stop(); else { mEventPos = contentsToViewport(e->pos()); mEventGlobalPos = e->globalPos(); } KListView::contentsMouseMoveEvent(e); } #define protected public #include <qheader.h> #undef protected void KOListViewListView::printList() { #ifdef DESKTOP_VERSION KOPrintPrefs pp ( this ); if (!pp.exec() ) return; int scaleval = pp.printMode() ; QPrinter printer; if (!printer.setup() ) return; clearSelection (); QPainter p; p.begin ( &printer ); QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); float dx, dy; int wid = (m.width() * 9)/10; dx = (float) wid/(float)contentsWidth (); dy = (float)(m.height()) / (float)contentsHeight (); float scale; // scale to fit the width or height of the paper if ( dx < dy ) scale = dx; else scale = dy; p.translate( m.width()/10,m.width()/10 ); if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { p.scale( scale, scale ); } int cou = header()->count(); int iii; QRect rect ( 0,0,0, header()->height()); for ( iii = 0; iii < cou; ++iii ) { rect.setLeft ( header()->sectionPos( iii ) ); rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); header()->paintSection ( & p, header()->mapToIndex (iii), rect ); } p.translate( 0, header()->height()); drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); p.end(); #endif } diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 792a7b8..ba3bc05 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -174,695 +174,692 @@ void KOViewManager::showDateView( int view, QDate date) void KOViewManager::writeSettings(KConfig *config) { config->setGroup("General"); QString view; if (mCurrentView == mWhatsNextView) view = "WhatsNext"; else if (mCurrentView == mMonthView) view = "Month"; else if (mCurrentView == mListView) view = "List"; else if (mCurrentView == mJournalView) view = "Journal"; else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; else if (mCurrentView == mTodoView) view = "Todo"; else view = "Agenda"; config->writeEntry("Current View",view); if (mAgendaView) { mAgendaView->writeSettings(config); } if (mTimeSpanView) { mTimeSpanView->writeSettings(config); } if (mListView) { mListView->writeSettings(config); } if (mTodoView) { mTodoView->saveLayout(config,"Todo View"); } } void KOViewManager::showNextView() { static int selecteddatescount = 0; static QDate selecteddate = QDate ( 2000, 1, 1 ); static QDate baseCycleDate = QDate ( 2000, 1, 1 ); int newCount = mMainView->dateNavigator()->selectedDates().count(); if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { flagResetViewChangeDate = 1; } if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) flagResetViewChangeDate = 1; if ( flagResetViewChangeDate > 0 ) { baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); //qDebug("newCycle "); } if (mCurrentView == mWhatsNextView) goto NEXT_X; if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; if (mCurrentView == mJournalView ) goto DAY_1; if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; if (mCurrentView == mAgendaView ) goto DAY_6; if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; if (mCurrentView == mMonthView ) goto LIST; if (mCurrentView == mListView ) goto TODO; // if (mCurrentView == mTodoView ) goto NEXT; NEXT: if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} NEXT_X: if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView(); goto ENTE ; } JOURNAL: if ( KOPrefs::instance()->mShowIconJournal ) { resetDateSilent( baseCycleDate , 1 ); showJournalView() ;goto ENTE ;} DAY_1: if ( KOPrefs::instance()->mShowIconDay1 ) { resetDateSilent( baseCycleDate , 2 ); showDayView() ;goto ENTE ;} DAY_5: if ( KOPrefs::instance()->mShowIconDay5 ) { resetDateSilent( baseCycleDate , 2 ); showWorkWeekView() ;goto ENTE ;} DAY_7: if ( KOPrefs::instance()->mShowIconDay7 ) { resetDateSilent( baseCycleDate , 2 ); showWeekView();goto ENTE ;} DAY_6: if ( KOPrefs::instance()->mShowIconDay6 ) { resetDateSilent( baseCycleDate , 2 ); showMonthViewWeek();goto ENTE ;} MONTH: if ( KOPrefs::instance()->mShowIconMonth ) { resetDateSilent( baseCycleDate , 2 ); showMonthView();goto ENTE ;} LIST: if ( KOPrefs::instance()->mShowIconList ) { resetDateSilent( baseCycleDate , 2 ); showListView() ;goto ENTE ;} TODO: if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} ENTE: flagResetViewChangeDate = 0; selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); selecteddate = mMainView->dateNavigator()->selectedDates().first(); } void KOViewManager::resetDateSilent( QDate date , int days ) { mMainView->dateNavigator()->blockSignals( true ); mMainView->dateNavigator()->selectDates( date , days ); mMainView->dateNavigator()->blockSignals( false ); } void KOViewManager::setDefaultCalendar(int) { if ( mJournalView && mCurrentView == mJournalView ) mJournalView->updateView(); } void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) { if ( flagResetViewChangeDate < 10 ) ++flagResetViewChangeDate; //mFlagShowNextxDays = false; //if(view == mCurrentView) return; if ( view == 0 ) { view = mCurrentView; if ( view == 0 ) return; } bool callupdate = !(view == mCurrentView); bool full = fullScreen; if(view == mCurrentView && view != mWhatsNextView ) { if ( mCurrentAgendaView < 0 ) return; if ( view != mMonthView ) full = mMainView->leftFrame()->isVisible(); } else { if ( view == mMonthView && mMonthView) ;//mMonthView->skipResize = true ; mCurrentView = view; // bool full = fullScreen; bool isFull = !mMainView->leftFrame()->isVisible(); if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) full = true; if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) full = false; } if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); //raiseCurrentView( full ); mMainView->processIncidenceSelection( 0 ); //mMainView->updateView(); raiseCurrentView( full, callupdate ); mMainView->adaptNavigationUnits(); mMainView->updateUnmanagedViews(); } void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) { mCurrentAgendaView = 0; if ( fullScreen ) { mMainView->leftFrame()->hide(); } else { mMainView->leftFrame()->show(); } //if ( mCurrentView == mMonthView ) qApp->processEvents(); emit signalFullScreen( !fullScreen ); if ( callUpdateView ) mMainView->updateView(); if ( globalFlagBlockAgenda == 5 ) { globalFlagBlockAgenda = 4; globalFlagBlockAgendaItemPaint = 1; } mMainView->viewStack()->raiseWidget(mCurrentView); if ( globalFlagBlockAgenda == 4 ) { if ( mCurrentView == mAgendaView ) { //globalFlagBlockAgenda =1 ; if ( KOPrefs::instance()->mSetTimeToDayStartAt ) mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); else if ( KOPrefs::instance()->mCenterOnCurrentTime ) mAgendaView->setStartHour( QTime::currentTime ().hour() ); qApp->processEvents(); //qDebug("qApp->processEvents() "); globalFlagBlockAgenda = 0; mAgendaView->repaintAgenda(); } globalFlagBlockAgenda = 0; } emit signalAgendaView( mCurrentView == mAgendaView ); //qDebug("raiseCurrentView ende "); } void KOViewManager::clearAllViews() { if ( mTodoView ) mTodoView->clearList(); if ( mListView ) mListView->clearList(); if ( mAgendaView ) mAgendaView->clearList(); if ( mMonthView ) mMonthView->clearList(); if ( mWhatsNextView ) mWhatsNextView->clearList(); if ( mJournalView ) mJournalView->clearList(); } void KOViewManager::updateView() { // qDebug("KOViewManager::updateView() "); // if we are updating mTodoView, we get endless recursion if ( mTodoView == mCurrentView ) return; if ( mCurrentView ) mCurrentView->updateView(); } void KOViewManager::updateView(const QDate &start, const QDate &end) { // kdDebug() << "KOViewManager::updateView()" << endl; if (mCurrentView) mCurrentView->showDates(start, end); if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); } void KOViewManager::updateWNview() { if ( mCurrentView == mWhatsNextView && mWhatsNextView ) mWhatsNextView->updateView(); if ( mCurrentView == mMonthView && mMonthView ) mMonthView->updateView(); } void KOViewManager::showWhatsNextView() { if (!mWhatsNextView) { mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::WhatsNextView"); mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); addView(mWhatsNextView); connect(this, SIGNAL( printWNV() ), mWhatsNextView, SLOT( printMe() ) ); } globalFlagBlockAgenda = 1; KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; showView(mWhatsNextView, true ); //mWhatsNextView->updateView(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; } void KOViewManager::slotprintWNV() { if (!mWhatsNextView) showWhatsNextView(); emit printWNV(); } void KOViewManager::showListView() { if (!mListView) { mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); addView(mListView); connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mListView, SIGNAL( signalNewEvent() ), mMainView, SLOT( newEvent() ) ); connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mListView, SIGNAL( beamIncidenceList( QPtrList<Incidence> ) ), mMainView, SLOT ( beamIncidenceList( QPtrList<Incidence> ) ) ); } // bool temp = mFlagShowNextxDays; //globalFlagBlockPainting = true; globalFlagBlockAgenda = 1; if ( KOPrefs::instance()->mListViewMonthTimespan ) { mMainView->setBlockShowDates( true ); mMainView->dateNavigator()->selectMonth(); mMainView->setBlockShowDates( false ); } KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; mMainView->setScrollBarStep( 7 ); } void KOViewManager::showAgendaView( bool fullScreen ) { mMainView->dialogManager()->hideSearchDialog(); // qDebug("KOViewManager::showAgendaView "); bool full; full = fullScreen; if (!mAgendaView) { full = false; mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); addView(mAgendaView); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); #endif connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); // SIGNALS/SLOTS FOR DAY/WEEK VIEW connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), mMainView, SLOT(newTodoDateTime(QDateTime,bool))); connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), mMainView, SLOT(newEvent(QDateTime))); connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), mMainView, SLOT(newEvent(QDateTime,QDateTime))); connect(mAgendaView,SIGNAL(newEventSignal(QDate)), mMainView, SLOT(newEvent(QDate))); connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect(mAgendaView, SIGNAL( toggleExpand() ), mMainView, SLOT( toggleExpand() ) ); connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, SLOT( updateTodo( Todo *, int ) ) ); connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), mMainView, SIGNAL( todoModified( Todo *, int ))); connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); mAgendaView->readSettings(); mAgendaView->updateConfig(); } KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; showView( mAgendaView, full); KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; mMainView->setScrollBarStep( 1 ); } void KOViewManager::showDayView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockLabel = 1; globalFlagBlockAgenda = 1; if ( mCurrentAgendaView != 1 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); globalFlagBlockAgenda = 2; globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectDates( 1 ); mCurrentAgendaView = 1 ; - mMainView->setScrollBarStep( 1 ); } void KOViewManager::showWorkWeekView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockAgenda = 1; globalFlagBlockLabel = 1; if ( mCurrentAgendaView != 5 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); globalFlagBlockAgenda = 2; globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectWorkWeek(); mCurrentAgendaView = 5 ; - mMainView->setScrollBarStep( 1 ); } void KOViewManager::showWeekView() { mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); mFlagShowNextxDays = false; globalFlagBlockAgenda = 1; globalFlagBlockLabel = 1; if ( mCurrentAgendaView != 7 ) mCurrentAgendaView = -1; showAgendaView(); qApp->processEvents(); globalFlagBlockAgenda = 2; globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectWeek(); mCurrentAgendaView = 7 ; - mMainView->setScrollBarStep( 1 ); } void KOViewManager::showNextXView() { KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; globalFlagBlockAgenda = 1; if ( mCurrentAgendaView != 3 ) mCurrentAgendaView = -1; showAgendaView(KOPrefs::instance()->mFullViewMonth); globalFlagBlockAgenda = 2; mMainView->dateNavigator()->selectDates( QDate::currentDate(), KOPrefs::instance()->mNextXDays ); mFlagShowNextxDays = true; mCurrentAgendaView = 3 ; KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays ); } bool KOViewManager::showsNextDays() { return mFlagShowNextxDays; } void KOViewManager::createMonthView() { if (!mMonthView) { mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); addView(mMonthView); // mMonthView->show(); // SIGNALS/SLOTS FOR MONTH VIEW connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), mMainView, SLOT(newTodoDateTime(QDateTime, bool))); connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), mMainView, SLOT(newEvent(QDateTime))); connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), mMainView, SLOT(showIncidence(Incidence *))); connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), mMainView, SLOT(editIncidence(Incidence *))); connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), mMainView, SLOT(deleteIncidence(Incidence *))); connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( selectWeekNum( int ) ), mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); connect( mMonthView, SIGNAL( selectMonth() ), mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), mMainView, SLOT ( showDay( QDate ) ) ); connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); connect( mMonthView, SIGNAL(nextMonth() ), mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); connect( mMonthView, SIGNAL(prevMonth() ), mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), mMainView->dateNavigator(), SLOT( selectNextYear() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); } } void KOViewManager::showMonthViewWeek() { createMonthView(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; globalFlagBlockAgenda = 1; bool full = true; if ( mCurrentView == mMonthView) full = mMainView->leftFrame()->isVisible(); if ( !KOPrefs::instance()->mMonthViewWeek ) { mMonthView->switchView(); if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) full = false; else full = true; } mMainView->dateNavigator()->selectWeek(); showView(mMonthView, full ); mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; mMainView->setScrollBarStep( 7 ); } void KOViewManager::showMonth( const QDate & date ) { mMainView->dateNavigator()->blockSignals( true ); mMainView->dateNavigator()->selectDate( date ); mMainView->dateNavigator()->blockSignals( false ); showMonthView(); } void KOViewManager::showMonthView() { createMonthView(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; globalFlagBlockAgenda = 1; //mFlagShowNextxDays = false; bool full = true; if ( mCurrentView == mMonthView) full = mMainView->leftFrame()->isVisible(); // if(mMonthView == mCurrentView) return; if ( KOPrefs::instance()->mMonthViewWeek ) { mMonthView->switchView(); if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) full = false; else full = true; } mMainView->dateNavigator()->selectMonth(); showView(mMonthView, full ); mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; mMainView->setScrollBarStep( 7 ); } void KOViewManager::showTodoView() { //mFlagShowNextxDays = false; if ( !mTodoView ) { mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), "KOViewManager::TodoView" ); addView( mTodoView ); // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); // SIGNALS/SLOTS FOR TODO VIEW connect( mTodoView, SIGNAL( newTodoSignal() ), mMainView, SLOT( newTodo() ) ); connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), mMainView, SLOT( newSubTodo( Todo *) ) ); connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), mMainView, SLOT( showTodo( Todo * ) ) ); connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), mMainView, SLOT( editTodo( Todo * ) ) ); connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), mMainView, SLOT( deleteTodo( Todo * ) ) ); connect( mTodoView, SIGNAL( purgeCompletedSignal() ), mMainView, SLOT( purgeCompleted() ) ); connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); connect( mMainView, SIGNAL( configChanged() ), mTodoView, SLOT( updateConfig() ) ); connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, SLOT( updateTodo( Todo *, int ) ) ); connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), mMainView, SLOT ( todo_unsub( Todo * ) ) ); connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); KConfig *config = KOGlobals::config(); mTodoView->restoreLayout(config,"Todo View"); mTodoView->setNavigator( mMainView->dateNavigator() ); } KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; globalFlagBlockAgenda = 1; showView( mTodoView, true ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; mMainView->setScrollBarStep( 7 ); } void KOViewManager::showJournalView() { //mFlagShowNextxDays = false; if (!mJournalView) { mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::JournalView"); connect( mMainView, SIGNAL( configChanged() ), mJournalView, SLOT( updateConfig() ) ); connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); addView(mJournalView); } KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; showView(mJournalView); mMainView->dateNavigator()->selectDates( 1 ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; mMainView->setScrollBarStep( 1 ); } void KOViewManager::showTimeSpanView() { //mFlagShowNextxDays = false; if (!mTimeSpanView) { mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), "KOViewManager::TimeSpanView"); addView(mTimeSpanView); mTimeSpanView->readSettings(); } showView(mTimeSpanView); } Incidence *KOViewManager::currentSelection() { if (!mCurrentView) return 0; if ( mCurrentView == mListView ) { if ( mListView->currentItem() ) return mListView->currentItem(); } return mCurrentView->selectedIncidences().first(); } QDate KOViewManager::currentSelectionDate() { QDate qd; if (mCurrentView) { DateList qvl = mCurrentView->selectedDates(); if (!qvl.isEmpty()) qd = qvl.first(); } return qd; } void KOViewManager::addView(KOrg::BaseView *view) { #if QT_VERSION >= 0x030000 mMainView->viewStack()->addWidget( view ); #else mMainView->viewStack()->addWidget( view, 1 ); #endif } void KOViewManager::setDocumentId( const QString &id ) { if (mTodoView) { mTodoView->setDocumentId( id ); } } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7a5f3e5..5d26d35 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -449,772 +449,768 @@ void MainWindow::toggleBeamReceive() #ifndef DESKTOP_VERSION if ( infrared ) { qDebug("KO: Disable BeamReceive "); delete infrared; infrared = 0; brAction->setOn(false); return; } qDebug("KO: Enable BeamReceive "); brAction->setOn(true); infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); #endif } void MainWindow::showMaximized () { #ifndef DESKTOP_VERSION if ( ! globalFlagBlockStartup ) if ( mClosed ) mView->goToday(); #endif QWidget::showMaximized () ; mClosed = false; } void MainWindow::closeEvent( QCloseEvent* ce ) { if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); mClosed = true; ce->accept(); return; } switch( QMessageBox::information( this, "KO/Pi", i18n("Do you really want\nto close KO/Pi?"), i18n("Close"), i18n("No"), 0, 0 ) ) { case 0: saveOnClose(); mClosed = true; ce->accept(); break; case 1: ce->ignore(); break; case 2: default: break; } } void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); //QString datamess; //qDebug("message "); qDebug("KO: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "setDocument(QString)" ) { QDataStream stream( data, IO_ReadOnly ); QString fileName; stream >> fileName; //qDebug("filename %s ", fileName.latin1()); showMaximized(); raise(); KOPrefs::instance()->mLastSyncedLocalFile = fileName ; mSyncManager->slotSyncMenu( 1002 ); return; } if ( cmsg == "-writeFile" ) { // I made from the "-writeFile" an "-writeAlarm" mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); showMaximized(); raise(); return; } if ( cmsg == "-writeFileSilent" ) { // I made from the "-writeFile" an "-writeAlarm" // mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); //showMaximized(); //raise(); hide(); return; } if ( cmsg == "-newCountdown" ) { qDebug("newCountdown "); } QString msg ; QString allmsg = cmsg; while ( allmsg.length() > 0 ) { int nextC = allmsg.find( "-", 1 ); if ( nextC == -1 ) { msg = allmsg; allmsg = ""; } else{ msg = allmsg.left( nextC ); allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); } //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); if ( msg == "-newEvent" ) { QTimer::singleShot( 0, mView, SLOT ( newEvent())); } if ( msg == "-newTodo" ) { QTimer::singleShot( 0, mView, SLOT ( newTodo())); } if ( msg == "-showWN" ) { mView->viewManager()->showWhatsNextView(); } if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } if ( msg == "-showList" ) { mView->viewManager()->showListView(); } else if ( msg == "-showDay" ) { mView->viewManager()->showDayView(); } else if ( msg == "-showWWeek" ) { mView->viewManager()->showWorkWeekView(); } else if ( msg == "-ringSync" ) { QTimer::singleShot( 0, this, SLOT (startMultiSync())); } else if ( msg == "-showWeek" ) { mView->viewManager()->showWeekView(); } else if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } else if ( msg == "-showJournal" ) { mView->dateNavigator()->selectDates( 1 ); mView->dateNavigator()->selectToday(); mView->viewManager()->showJournalView(); } else if ( msg == "-showKO" ) { mView->viewManager()->showNextXView(); } else if ( msg == "-showWNext" ) { mView->viewManager()->showWhatsNextView(); } else if ( msg == "nextView()" ) { mView->viewManager()->showNextView(); } else if ( msg == "-showNextXView" ) { mView->viewManager()->showNextXView(); } } showMaximized(); raise(); } void MainWindow::startMultiSync() { QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), question, i18n("Yes"), i18n("No"), 0, 0 ) != 0 ) { setCaption(i18n("Aborted! Nothing synced!")); return; } mSyncManager->multiSync( false ); #ifndef DESKTOP_VERSION QCopEnvelope e("QPE/Application/kapi", "doRingSync"); #endif } QPixmap MainWindow::loadPixmap( QString name ) { return SmallIcon( 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 ); mCurrentItemMenu = new QPopupMenu ( this ); 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/"; pixWid = 18; pixHei = 16; } } else { pathString += "iconsmini/"; pixWid = 18; pixHei = 16; } if ( KOPrefs::instance()->mShowFullMenu ) { QMenuBar *menuBar1; menuBar1 = menuBar(); menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); menuBar1->insertItem( i18n("Action"), actionMenu ); #ifdef DESKTOP_VERSION menuBar1->insertItem( i18n("Synchronize"), syncMenu ); menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); #else menuBar1->insertItem( i18n("Sync"), syncMenu ); menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); #endif //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { QPEMenuBar *menuBar1; menuBar1 = new QPEMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); icon = loadPixmap( pathString + "z_menu" ); menuBar1->insertItem( icon.pixmap(), menuBar); //menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); menuBar->insertItem( i18n("Action"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); mWeekBgColor = iconToolBar->backgroundColor(); mWeekPixmap.resize( pixWid , pixHei ); mWeekPixmap.fill( mWeekBgColor ); icon = mWeekPixmap; mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); if ( p-> mShowIconWeekNum ) mWeekAction->addTo( iconToolBar ); mWeekFont = font(); int fontPoint = mWeekFont.pointSize(); QFontMetrics f( mWeekFont ); int fontWid = f.width( "30" ); while ( fontWid > pixWid ) { --fontPoint; mWeekFont.setPointSize( fontPoint ); QFontMetrics f( mWeekFont ); fontWid = f.width( "30" ); //qDebug("dec-- "); } connect( mWeekAction, SIGNAL( activated() ), this, SLOT( weekAction() ) ); connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); if ( p->mShowIconFilterview ) { icon = loadPixmap( pathString + "filter" ); actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); connect( actionFilterMenuTB, SIGNAL( activated() ), this, SLOT( fillFilterMenuTB() ) ); actionFilterMenuTB->addTo( iconToolBar ); selectFilterMenuTB = new QPopupMenu( this ); selectFilterMenuTB->setCheckable( true ); connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); } //#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() ) ); actionMenu->insertSeparator(); action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); action->addTo( mCurrentItemMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( undo_delete() ) ); mCurrentItemMenu->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 ); //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 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() ) ); // *********************** 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" ); action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleFilter() ) ); mToggleFilter = action; icon = loadPixmap( pathString + "navi" ); configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleDateNavigatorWidget() ) ); mToggleNav = action ; icon = loadPixmap( pathString + "allday" ); configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 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 ) ) ); 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() ) ); icon = loadPixmap( pathString + "xdays" ); configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); xdays_action->addTo( viewMenu ); connect( xdays_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showNextXView() ) ); icon = loadPixmap( pathString + "journal" ); configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); viewjournal_action->addTo( viewMenu ); connect( viewjournal_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showJournalView() ) ); icon = loadPixmap( pathString + "day" ); configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); day1_action->addTo( viewMenu ); // action->addTo( toolBar ); connect( day1_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showDayView() ) ); icon = loadPixmap( pathString + "workweek" ); configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); day5_action->addTo( viewMenu ); connect( day5_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWorkWeekView() ) ); icon = loadPixmap( pathString + "week" ); configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); day7_action->addTo( viewMenu ); connect( day7_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWeekView() ) ); icon = loadPixmap( pathString + "workweek2" ); configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); day6_action->addTo( viewMenu ); connect( day6_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showMonthViewWeek() ) ); icon = loadPixmap( pathString + "month" ); configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); month_action->addTo( viewMenu ); connect( month_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showMonthView() ) ); icon = loadPixmap( pathString + "list" ); configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); showlist_action->addTo( viewMenu ); connect( showlist_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showListView() ) ); icon = loadPixmap( pathString + "todo" ); configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); todoview_action->addTo( viewMenu ); connect( todoview_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showTodoView() ) ); #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() ) ); action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); actionMenu->insertSeparator(); action = new QAction( "manage cat", i18n("Edit category list..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 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->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 ); connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); //#ifndef DESKTOP_VERSION importMenu_X->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, this ); action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); //#else #ifdef _OL_IMPORT_ importMenu_X->insertSeparator(); action = new QAction( "import_ol", i18n("Import from OL"), 0, this ); action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); #endif //#endif //importMenu->insertSeparator(); #if 0 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); #endif action = new QAction( "save_cal", i18n("Save Backup..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); importMenu->insertSeparator(); importMenu->insertItem( i18n("Import"), importMenu_X ); //importMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, this ); action->addTo( exportMenu_X ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); //LR QPopupMenu *ex2phone = new QPopupMenu( this ); ex2phone->insertItem(i18n("Complete calendar..."), 1 ); ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); importMenu->insertItem( i18n("Export"), exportMenu_X ); #ifndef DESKTOP_VERSION //importMenu->insertSeparator(); brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, this ); brAction->addTo( beamMenu_X ); brAction->setToggleAction (true ) ; connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); importMenu->insertItem( i18n("Beam"), beamMenu_X ); #else //importMenu->insertSeparator(); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), this, SLOT( printCal() ) ); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), this, SLOT( printSel() ) ); action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), 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( "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 ); connect( action, SIGNAL( activated() ), SLOT( whatsNew() ) ); action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( features() ) ); action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( keyBindings() ) ); action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( storagehowto() ) ); action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( timetrackinghowto() ) ); action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( synchowto() ) ); action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( kdesynchowto() ) ); action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( multisynchowto() ) ); action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( aboutAutoSaving() ) ); action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( aboutKnownBugs() ) ); action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( usertrans() ) ); action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( faq() ) ); action = new QAction( "licence", i18n("Licence..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( licence() ) ); action = new QAction( "about", i18n("About..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( about() ) ); //menuBar->insertSeparator(); // ****************************************************** // menubar icons //menuBar->insertItem( iconToolBar ); //xdays_action |