author | zautrix <zautrix> | 2005-07-01 18:39:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 18:39:59 (UTC) |
commit | c53efbe8f53f468d21d93f5e19b625d1a4beb242 (patch) (side-by-side diff) | |
tree | f8fe2180733b6bd3514c02845cefa9f26e967e27 /korganizer | |
parent | 98d29d15275c4b8e9a3348742925f6e6d03f7a07 (diff) | |
download | kdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.zip kdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.tar.gz kdepimpi-c53efbe8f53f468d21d93f5e19b625d1a4beb242.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 15 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 7 |
5 files changed, 16 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 70a1d2d..678143d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -381,192 +381,193 @@ void CalendarView::init() 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) ),mCalendar, SLOT( setReadOnly(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 * ) ) ); @@ -588,209 +589,213 @@ void CalendarView::init() 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::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 ) { block = false; return; } QDate d ( year,1,1 ); mNavigator->selectDates( d.addDays( val ), count ); block = false; #endif } - -void CalendarView::checkAlarms() +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("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); - KMessageBox::error(this,message); + 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 ) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index c9e9870..651194b 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -108,192 +108,193 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser public: /** Constructs a new calendar view widget. @param calendar calendar document @param parent parent window @param name Qt internal widget object name */ CalendarView( CalendarResources *calendar, QWidget *parent = 0, const char *name = 0 ); CalendarView( Calendar *calendar, QWidget *parent = 0, const char *name = 0 ); virtual ~CalendarView(); Calendar *calendar() { return mCalendar; } KOViewManager *viewManager(); KODialogManager *dialogManager(); QDate startDate(); QDate endDate(); QWidgetStack *viewStack(); QWidget *leftFrame(); DateNavigator *dateNavigator(); KDateNavigator *dateNavigatorWidget(); void addView(KOrg::BaseView *); void showView(KOrg::BaseView *); KOEventViewerDialog* getEventViewerDialog(); Incidence *currentSelection(); void checkSuspendAlarm(); signals: void save (); void saveStopTimer (); void tempDisableBR(bool); /** This todo has been modified */ void todoModified(Todo *, int); /** when change is made to options dialog, the topwidget will catch this * and emit this signal which notifies all widgets which have registered * for notification to update their settings. */ void configChanged(); /** emitted when the topwidget is closing down, so that any attached child windows can also close. */ void closingDown(); /** emitted right before we die */ void closed(QWidget *); /** Emitted when state of modified flag changes */ void modifiedChanged(bool); void signalmodified(); /** Emitted when state of read-only flag changes */ void readOnlyChanged(bool); /** Emitted when the unit of navigation changes */ void changeNavStringPrev(const QString &); void changeNavStringNext(const QString &); /** Emitted when state of events selection has changed and user is organizer*/ void organizerEventsSelected(bool); /** Emitted when state of events selection has changed and user is attendee*/ void groupEventsSelected(bool); /** Emitted when an incidence gets selected. If the selection is cleared the signal is emitted with 0 as argument. */ void incidenceSelected( Incidence * ); /** Emitted, when a todoitem is selected or deselected. */ void todoSelected( bool ); /** Emitted, when clipboard content changes. Parameter indicates if paste is possible or not. */ void pasteEnabled(bool); /** Emitted, when the number of incoming messages has changed. */ void numIncomingChanged(int); /** Emitted, when the number of outgoing messages has changed. */ void numOutgoingChanged(int); /** Send status message, which can e.g. be displayed in the status bar. */ void statusMessage(const QString &); void calendarViewExpanded( bool ); void updateSearchDialog(); void filtersUpdated(); public slots: void checkAlarms(); + void checkFiles(); void slotprintSelInc(); void showNextAlarms(); void showOpenError(); void watchSavedFile(); void recheckTimerAlarm(); void checkNextTimerAlarm(); void addAlarm(const QDateTime &qdt, const QString ¬i ); void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); void removeAlarm(const QDateTime &qdt, const QString ¬i ); /** options dialog made a changed to the configuration. we catch this * and notify all widgets which need to update their configuration. */ void updateConfig(); void insertBirthdays(const QString& uid, const QStringList& birthdayList, const QStringList& anniversaryList, const QStringList& realNameList, const QStringList& emailList, const QStringList& assembledNameList, const QStringList& uidList); /** Load calendar from file \a filename. If \a merge is true, load calendar into existing one, if it is false, clear calendar, before loading. Return true, if calendar could be successfully loaded. */ bool openCalendar(QString filename, bool merge=false); bool loadCalendars(); bool saveCalendars(); bool restoreCalendarSettings(); bool addCalendar( KopiCalendarFile * ); void addCalendarId( int id ); bool syncCalendar(QString filename,int mode = 0 ); /** Save calendar data to file. Return true if calendar could be successfully saved. */ bool saveCalendar(QString filename); /** Close calendar. Clear calendar data and reset views to display an empty calendar. */ void closeCalendar(); /** Archive old events of calendar */ void archiveCalendar(); void showIncidence(); void editIncidence(); void editIncidenceDescription(); void deleteIncidence(); void cloneIncidence(); void moveIncidence(); void beamIncidence(); void toggleCancelIncidence(); /** create an editeventwin with supplied date/time, and if bool is true, * make the event take all day. */ void newEvent(QDateTime, QDateTime, bool allDay ); void newEvent(QDateTime, QDateTime); void newEvent(QDateTime fh); void newEvent(QDate dt); /** create new event without having a date hint. Takes current date as default hint. */ void newEvent(); void newFloatingEvent(); /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ void showIncidence(Incidence *); void showIncidence(QString uid); /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ void editIncidence(Incidence *); /** Delete the supplied incidence. It calls the correct deleteXXX method*/ void deleteIncidence(Incidence *); void cloneIncidence(Incidence *); void cancelIncidence(Incidence *); /** Create an editor for the supplied event. */ void editEvent(Event *); /** Delete the supplied event. */ void deleteEvent(Event *); /** Delete the event with the given unique ID. Returns false, if event wasn't found. */ bool deleteEvent(const QString &uid); /** Create a read-only viewer dialog for the supplied event. */ void showEvent(Event *); void editJournal(Journal *); void showJournal(Journal *); void deleteJournal(Journal *); /** Create an editor dialog for a todo */ void editTodo(Todo *); /** Create a read-only viewer dialog for the supplied todo */ void showTodo(Todo *); /** create new todo */ void newTodo(); void newTodoDateTime(QDateTime, bool allday); diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 3cde103..20118aa 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -122,333 +122,335 @@ KOCalEditView::KOCalEditView(QWidget* parent, } KOCalEditView::~KOCalEditView() { // no need to delete child widgets, Qt does it all for us } void KOCalEditView::selectCal(int id ,bool b) { KOPrefs::instance()->getCalendar( id )->isEnabled = b; emit calendarEnabled ( id, b ); emit needsUpdate(); } void KOCalEditView::selectStdCal( int id, bool b ) { if ( !b ) { KOCalCheckButton* it = (KOCalCheckButton*) sender(); if ( it ) { it->blockSignals( true ); it->setChecked( true ); it->blockSignals( false ); return; } return; } KOCalRadioButton* sen = (KOCalRadioButton*) sender(); KOCalRadioButton* it = mStdandardB.first(); while ( it ) { if ( it->isChecked() ) { if ( it != sen ) { it->blockSignals( true ); it->setChecked( false ); it->blockSignals( false ); break; } } it = mStdandardB.next(); } KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { kkf->isStandard = false; kkf = KOPrefs::instance()->mCalendars.next(); } KOPrefs::instance()->getCalendar( id )->isStandard = true; emit setCalendarDefault ( id ); } void KOCalEditView::selectCalAlarm(int id ,bool b ) { KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; emit alarmEnabled ( id , b ); emit needsUpdate(); } void KOCalEditView::selectReadOnly(int id ,bool b ) { KOPrefs::instance()->getCalendar( id )->isReadOnly = b; emit calendarReadonly ( id , b ); if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { KOPrefs::instance()->getCalendar( id )->isStandard = false; KOPrefs::instance()->getCalendar( 1 )->isStandard = true; mStdandardB.at(0)->setChecked( true ); mStdandardB.at(id-1)->setChecked( false ); emit setCalendarDefault ( 1 ); } mStdandardB.at(id-1)->setEnabled( !b ); emit needsUpdate(); } void KOCalEditView::setColor( const QColor& c, int id ) { KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; emit needsUpdate(); } void KOCalEditView::deleteCal( int id ) { KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); QString name = kkf->mName; QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; if ( kkf->isStandard ) selectStdCal( 1, true ); emit removeCalendar ( id ); KOPrefs::instance()->mCalendars.remove ( kkf ); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); } void KOCalEditView::infoCal( int id ) { QString name = KOPrefs::instance()->getCalendar( id )->mName; QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { emit calendarAdded( id ); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); + QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); } } else KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); } void KOCalEditView::readConfig() { mStdandardB.clear(); mEnabledB.clear(); mAlarmB.clear(); mROB.clear(); if ( mw ) delete mw; mw = new QWidget ( viewport() ); addChild(mw); int ii = 0; mainLayout = new QGridLayout ( mw , 2, 8 ); mainLayout->setMargin( 2 ); mainLayout->setSpacing( 2 ); QPushButton * addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,0 ); addBut->setText( "D"); connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo())); //addBut->setPixmap ( SmallIcon("greenhook16")); addBut->setMaximumWidth( addBut->sizeHint().height() ); int max = addBut->sizeHint().height(); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("eye")); connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); mainLayout->addWidget( lab,0,++ii ); //lab = new QLabel ( i18n(" "), mw ); //mainLayout->addWidget( lab,0,++ii ); //lab->setFixedWidth( 1 ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("bell")); connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("pencil")); connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); addBut->setMaximumWidth( addBut->sizeHint().height() ); lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,0,++ii ); addBut = new QPushButton ( mw ); addBut->setFocusPolicy(NoFocus); mainLayout->addWidget( addBut,0,++ii ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); lab = new QLabel ( " ", mw ); mainLayout->addWidget( lab,0,++ii ); KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); int row = 1; while ( kkf ) { int iii = 0; KOCalRadioButton* rb = new KOCalRadioButton( mw ); mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); rb->setChecked( kkf->isStandard ); rb->setNum( kkf->mCalNumber ); connect (rb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) rb->setEnabled( false ); KOCalCheckButton* cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); cb->setChecked( kkf->isEnabled ); cb->setNum( kkf->mCalNumber ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); KOCalButton* name = new KOCalButton( mw ); name->setNum( kkf->mCalNumber ); name->setText( kkf->mName ); mainLayout->addWidget( name,row,++iii ); connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); //lab = new QLabel (" ", mw ); //mainLayout->addWidget( lab,row,++iii ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); cb->setChecked( kkf->isAlarmEnabled ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); cb->setChecked( kkf->isReadOnly ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); if ( row > 1) { KColorButton *colb = new KColorButton( mw ); mainLayout->addWidget( colb,row,++iii ); colb->setID( kkf->mCalNumber ); colb->setColor( kkf->mDefaultColor ); connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); KOCalButton* calb = new KOCalButton( mw ); mainLayout->addWidget( calb,row,++iii ); calb->setNum( kkf->mCalNumber ); calb->setPixmap ( SmallIcon("minus")); connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); int hei = calb->sizeHint().height(); //calb->setMaximumSize( hei*9/10, hei*9/10 ); } ++row; kkf = KOPrefs::instance()->mCalendars.next(); } lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,row,0 ); mw->show(); } void KOCalEditView::defaultInfo() { KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); } void KOCalEditView::addCal() { bool tryagain = true; QString name, file; while ( tryagain ) { KONewCalPrefs prefs ( this ); prefs.nameE->setText( name ); prefs.url->setURL( file ); if ( ! prefs.exec() ) return; name = prefs.calName(); file = prefs.calFileName(); tryagain = false; KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { if ( kkf->mName == name ) { KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); name = ""; tryagain = true; break; } if ( kkf->mFileName == file ) { KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); tryagain = true; file = ""; break; } kkf = KOPrefs::instance()->mCalendars.next(); } } addCalendar ( name, file ); + QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); } int KOCalEditView::addCalendar( QString name, QString file, bool ask ) { QFileInfo fi ( file ); if (!fi.exists() ) { if ( ask ) if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) return 0; QFile fileIn( file ); if (!fileIn.open( IO_WriteOnly ) ) { KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); return 0; } QTextStream tsIn( &fileIn ); tsIn.setCodec( QTextCodec::codecForName("utf8") ); tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; fileIn.close(); } KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); kkf->mName = name; kkf->mFileName = file; emit calendarAdded( kkf->mCalNumber ); if ( ask ) emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); return kkf->mCalNumber; } int KOCalEditView::getBirtdayID() { KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { if ( kkf->mName == i18n("Birthdays") ) return kkf->mCalNumber; kkf = KOPrefs::instance()->mCalendars.next(); } QString file = locateLocal( "data", "korganizer/birthdays.ics" ); return addCalendar( i18n("Birthdays"), file, false ); } void KOCalEditView::enableAll() { toggleList( mEnabledB ); } void KOCalEditView::enableAlarm() { toggleList( mAlarmB ); } void KOCalEditView::disableRO() { toggleList( mROB ); } void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) { bool dis = false; KOCalCheckButton* it = list.first(); while ( it ) { if ( !it->isChecked() ) { dis = true; break; } it = list.next(); } it = list.first(); while ( it ) { it->setChecked(dis); it = list.next(); } } void KOCalEditView::deleteAll() { qDebug("delteAll"); } diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 54fe2c5..02107cf 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -140,110 +140,111 @@ class KOCalCheckButton : public QCheckBox void selectNum ( int, bool ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } private slots : void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } }; class KOCalRadioButton : public QRadioButton { Q_OBJECT public: KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : QRadioButton( parent, name) { connect( this, SIGNAL( toggled ( bool ) ), SLOT( bottonClicked( bool ) )); mNumber = -1; setFocusPolicy(NoFocus); //setMaximumWidth( 10 ); } void setNum ( int num ) {mNumber = num; } signals: void selectNum ( int, bool ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } private slots : void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } }; class KOFilterView : public KOFilterView_base { Q_OBJECT public: KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); ~KOFilterView(); void updateFilters(); bool filtersEnabled(); void setFiltersEnabled(bool); CalFilter *selectedFilter(); void setSelectedFilter(QString); void setSelectedFilter( int ); signals: void filterChanged(); void editFilters(); private: QPtrList<CalFilter> *mFilters; }; class KOCalEditView : public QScrollView { Q_OBJECT public: KOCalEditView( QWidget* parent=0,const char* name=0); ~KOCalEditView(); int addCalendar( QString calName, QString fileName, bool ask = true ); int getBirtdayID(); public slots: void addCal(); void enableAll(); void enableAlarm(); void disableRO(); void deleteAll(); void selectStdCal(int,bool ); void selectCal(int,bool ); void selectCalAlarm(int,bool ); void selectReadOnly(int,bool ); void setColor(const QColor &,int) ; void deleteCal(int) ; void infoCal(int) ; void readConfig(); void defaultInfo(); signals: void alarmEnabled ( int cal, bool enable ); void calendarEnabled ( int cal, bool enable ); void calendarReadonly ( int cal, bool readonly ); void setCalendarDefault ( int cal ); void removeCalendar ( int cal ); void calendarAdded( int ); void needsUpdate(); + void checkCalendar(); private: QWidget *mw; void toggleList ( QPtrList<KOCalCheckButton> ); QPtrList<KOCalRadioButton> mStdandardB; QPtrList<KOCalCheckButton> mEnabledB; QPtrList<KOCalCheckButton> mAlarmB; QPtrList<KOCalCheckButton> mROB; QGridLayout* mainLayout; }; #endif // KOFILTERVIEW_H diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index b797d8c..501eed5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -305,197 +305,194 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : if ( iconToolBar->orientation () == Qt:: Horizontal ) { vh -= iconToolBar->height(); } else { vw -= iconToolBar->height(); } //mView->setMaximumSize( splash->size() ); //mView->resize( splash->size() ); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); mView->readSettings(); bool newFile = false; if( !QFile::exists( defaultFileName() ) ) { QFileInfo finfo ( defaultFileName() ); QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } else { oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } } mView->saveCalendar( defaultFileName() ); newFile = true; } QTime neededSaveTime = QDateTime::currentDateTime().time(); mView->loadCalendars(); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { KOPrefs::instance()->setAllDefaults(); } processIncidenceSelection( 0 ); connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); connect( mView, SIGNAL( tempDisableBR(bool) ), SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( sentSyncFile()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif #ifndef DESKTOP_VERSION infrared = 0; #endif updateFilterToolbar(); updateWeek( mView->startDate() ); connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( updateWeekNum( const KCal::DateList & ) ) ); mBRdisabled = false; //toggleBeamReceive(); - int tiint= 3000; -#ifndef DESKTOP_VERSION - tiint = 5000; -#endif - QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); + + QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location delete mCalendar; delete mSyncManager; #ifndef DESKTOP_VERSION if ( infrared ) delete infrared; #endif } void MainWindow::disableBR(bool b) { #ifndef DESKTOP_VERSION if ( b ) { if ( infrared ) { toggleBeamReceive(); mBRdisabled = true; } mBRdisabled = true; } else { if ( mBRdisabled ) { mBRdisabled = false; //makes no sense,because other cal ap is probably running // toggleBeamReceive(); } } #endif } bool MainWindow::beamReceiveEnabled() { #ifndef DESKTOP_VERSION return ( infrared != 0 ); #endif return false; } void MainWindow::toggleBeamReceive() { if ( mBRdisabled ) return; #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: |