-rw-r--r-- | korganizer/calendarview.cpp | 19 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 7 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 1 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 10 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 13 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 1 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 5 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 |
15 files changed, 67 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 608b73b..e13d0be 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1099,96 +1099,97 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t return; } if ( toDelete->type() == "Journal" ) return; Event* eve = lastSync.first(); while ( eve ) { QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name if ( !id.isEmpty() ) { QString des = eve->description(); QString pref = "e"; if ( toDelete->type() == "Todo" ) pref = "t"; des += pref+ id + ","; eve->setReadOnly( false ); eve->setDescription( des ); //qDebug("setdes %s ", des.latin1()); eve->setReadOnly( true ); } eve = lastSync.next(); } } void CalendarView::checkExternalId( Incidence * inc ) { QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; checkExternSyncEvent( lastSync, inc ); } bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) { bool syncOK = true; int addedEvent = 0; int addedEventR = 0; int deletedEventR = 0; int deletedEventL = 0; int changedLocal = 0; int changedRemote = 0; int filteredIN = 0; int filteredOUT = 0; //QPtrList<Event> el = local->rawEvents(); Event* eventR; QString uid; int take; Event* eventL; Event* eventRSync; Event* eventLSync; + clearAllViews(); QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); bool fullDateRange = false; local->resetTempSyncStat(); mLastCalendarSync = QDateTime::currentDateTime(); if ( mSyncManager->syncWithDesktop() ) { remote->resetPilotStat(1); if ( KSyncManager::mRequestedSyncEvent.isValid() ) { mLastCalendarSync = KSyncManager::mRequestedSyncEvent; qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); } else { qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); } } QDateTime modifiedCalendar = mLastCalendarSync; eventLSync = getLastSyncEvent(); eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); if ( eventR ) { eventRSync = (Event*) eventR->clone(); remote->deleteEvent(eventR ); } else { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { eventRSync = (Event*)eventLSync->clone(); } else { fullDateRange = true; eventRSync = new Event(); eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); eventRSync->setDtStart( mLastCalendarSync ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); eventRSync->setCategories( i18n("SyncEvent") ); } } if ( eventLSync->dtStart() == mLastCalendarSync ) fullDateRange = true; if ( ! fullDateRange ) { if ( eventLSync->dtStart() != eventRSync->dtStart() ) { // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); fullDateRange = true; } } if ( mSyncManager->syncWithDesktop() ) { fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); } @@ -1791,98 +1792,98 @@ bool CalendarView::importQtopia( const QString &categories, getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( mSyncManager->mWriteBackFile ) { // write back XML file } setModified( true ); } } else { QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return syncOK; #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } } bool CalendarView::openCalendar(QString filename, bool merge) { if (filename.isEmpty()) { return false; } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; + clearAllViews(); if (!merge) { - mTodoList->clearList(); mViewManager->setDocumentId( filename ); mCalendar->close(); } mStorage->setFileName( filename ); if ( mStorage->load() ) { if ( merge ) ;//setModified( true ); else { //setModified( true ); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } globalFlagBlockAgenda = 2; // if ( getLastSyncEvent() ) // getLastSyncEvent()->setReadOnly( true ); mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); if ( filename != MainWindow::defaultFileName() ) { saveCalendar( MainWindow::defaultFileName() ); } else { QFileInfo finf ( MainWindow::defaultFileName()); if ( finf.exists() ) { setLoadedFileVersion( finf.lastModified () ); } } return true; } else { // while failing to load, the calendar object could // have become partially populated. Clear it out. if ( !merge ) { mCalendar->close(); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); globalFlagBlockAgenda = 2; mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); } @@ -1903,129 +1904,131 @@ bool CalendarView::checkFileChanged(QString fn) return true; QDateTime dt = finf.lastModified (); if ( dt <= loadedFileVersion ) return false; return true; } void CalendarView::watchSavedFile() { QFileInfo finf ( MainWindow::defaultFileName()); if ( !finf.exists() ) return; QDateTime dt = finf.lastModified (); if ( dt < loadedFileVersion ) { //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); return; } loadedFileVersion = dt; } bool CalendarView::checkFileVersion(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); //qDebug("file on disk version %s",dt.toString().latin1()); if ( dt <= loadedFileVersion ) return true; int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , i18n("KO/Pi Warning"),i18n("Overwrite"), i18n("Sync+save")); if ( km == KMessageBox::Cancel ) return false; if ( km == KMessageBox::Yes ) return true; setSyncDevice("deleteaftersync" ); mSyncManager->mAskForPreferences = true; mSyncManager->mSyncAlgoPrefs = 3; mSyncManager->mWriteBackFile = false; mSyncManager->mWriteBackExistingOnly = false; mSyncManager->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); - mCalendar->deleteEvent ( e ); + if ( e ) + deleteEvent ( e ); updateView(); return true; } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); mStorage->setSaveFormat( new ICalFormat() ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } if ( filename == MainWindow::defaultFileName() ) { setLoadedFileVersion( lfv ); watchSavedFile(); } return true; } void CalendarView::closeCalendar() { // child windows no longer valid + clearAllViews(); emit closingDown(); mCalendar->close(); setModified(false); updateView(); } void CalendarView::archiveCalendar() { mDialogManager->showArchiveDialog(); } void CalendarView::readSettings() { // mViewManager->showAgendaView(); QString str; //qDebug("CalendarView::readSettings() "); // read settings from the KConfig, supplying reasonable // defaults where none are to be found KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> sizes = config->readIntListEntry("Separator1"); if (sizes.count() != 2) { sizes << mDateNavigator->minimumSizeHint().width(); sizes << 300; } mPanner->setSizes(sizes); sizes = config->readIntListEntry("Separator2"); if ( ( mResourceView && sizes.count() == 4 ) || ( !mResourceView && sizes.count() == 3 ) ) { mLeftSplitter->setSizes(sizes); } #endif globalFlagBlockAgenda = 1; mViewManager->showAgendaView(); //mViewManager->readSettings( config ); mTodoList->restoreLayout(config,QString("Todo Layout")); readFilterSettings(config); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list; @@ -2387,96 +2390,107 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action) updateUnmanagedViews(); //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); if ( action == KOGlobals::EVENTDELETED ) { //delete mCalendar->checkAlarmForIncidence( 0, true ); if ( mEventViewerDialog ) mEventViewerDialog->hide(); } else mCalendar->checkAlarmForIncidence( which , false ); } // most of the changeEventDisplays() right now just call the view's // total update mode, but they SHOULD be recoded to be more refresh-efficient. void CalendarView::changeEventDisplay(Event *which, int action) { // kdDebug() << "CalendarView::changeEventDisplay" << endl; changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); // } } else { mViewManager->currentView()->updateView(); } } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::updateView(const QDate &start, const QDate &end) { mTodoList->updateView(); mViewManager->updateView(start, end); //mDateNavigator->updateView(); } +void CalendarView::clearAllViews() +{ + mTodoList->clearList(); + mViewManager->clearAllViews(); + SearchDialog * sd = mDialogManager->getSearchDialog(); + if ( sd ) { + KOListView* kol = sd->listview(); + if ( kol ) + kol->clearList(); + } +} void CalendarView::updateView() { DateList tmpList = mNavigator->selectedDates(); if ( KOPrefs::instance()->mHideNonStartedTodos ) mTodoList->updateView(); // We assume that the navigator only selects consecutive days. updateView( tmpList.first(), tmpList.last() ); } void CalendarView::updateUnmanagedViews() { mDateNavigator->updateDayMatrix(); } int CalendarView::msgItemDelete(const QString name) { return KMessageBox::warningContinueCancel(this,name +"\n\n"+ i18n("This item will be\npermanently deleted."), i18n("KO/Pi Confirmation"),i18n("Delete")); } void CalendarView::edit_cut() { Event *anEvent=0; Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); if (mViewManager->currentView()->isEventView()) { if ( incidence && incidence->type() == "Event" ) { anEvent = static_cast<Event *>(incidence); } } if (!anEvent) { KNotifyClient::beep(); return; } DndFactory factory( mCalendar ); factory.cutIncidence(anEvent); changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); } void CalendarView::edit_copy() { Event *anEvent=0; @@ -3898,96 +3912,97 @@ void CalendarView::toggleFilerEnabled( ) mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); if ( !mFilterView->filtersEnabled() ) topLevelWidget()->setCaption( i18n("Filter disabled ") ); } void CalendarView::updateFilter() { CalFilter *filter = mFilterView->selectedFilter(); if (filter) { QString mess; if (mFilterView->filtersEnabled()) { mess = i18n("Filter selected: ")+filter->name(); filter->setEnabled(true); } else filter->setEnabled(false); mCalendar->setFilter(filter); updateView(); if ( !mess.isEmpty() ) topLevelWidget()->setCaption( mess ); } } void CalendarView::filterEdited() { mFilterView->updateFilters(); updateFilter(); writeSettings(); } void CalendarView::takeOverEvent() { Incidence *incidence = currentSelection(); if (!incidence) return; incidence->setOrganizer(KOPrefs::instance()->email()); incidence->recreate(); incidence->setReadOnly(false); updateView(); } void CalendarView::takeOverCalendar() { // TODO: Create Calendar::allIncidences() function and use it here + clearAllViews(); QPtrList<Event> events = mCalendar->events(); for(uint i=0; i<events.count(); ++i) { events.at(i)->setOrganizer(KOPrefs::instance()->email()); events.at(i)->recreate(); events.at(i)->setReadOnly(false); } QPtrList<Todo> todos = mCalendar->todos(); for(uint i=0; i<todos.count(); ++i) { todos.at(i)->setOrganizer(KOPrefs::instance()->email()); todos.at(i)->recreate(); todos.at(i)->setReadOnly(false); } QPtrList<Journal> journals = mCalendar->journals(); for(uint i=0; i<journals.count(); ++i) { journals.at(i)->setOrganizer(KOPrefs::instance()->email()); journals.at(i)->recreate(); journals.at(i)->setReadOnly(false); } updateView(); } void CalendarView::showIntro() { kdDebug() << "To be implemented." << endl; } QWidgetStack *CalendarView::viewStack() { return mRightFrame; } QWidget *CalendarView::leftFrame() { return ( QWidget *)mLeftFrame; } DateNavigator *CalendarView::dateNavigator() { return mNavigator; } KDateNavigator* CalendarView::dateNavigatorWidget() { return mDateNavigator->navigatorView(); } diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 084b6db..4600090 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -286,96 +286,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void showTodo(Todo *); /** create new todo */ void newTodo(); void newTodoDateTime(QDateTime, bool allday); /** create new todo with a parent todo */ void newSubTodo(); /** create new todo with a parent todo */ void newSubTodo(Todo *); /** Delete todo */ void deleteTodo(Todo *); /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is * emitted as result. */ void checkClipboard(); /** using the KConfig associated with the kapp variable, read in the * settings from the config file. */ void readSettings(); /** write current state to config file. */ void writeSettings(); /** read settings for calendar filters */ void readFilterSettings(KConfig *config); /** write settings for calendar filters */ void writeFilterSettings(KConfig *config); /** passes on the message that an event has changed to the currently * activated view so that it can make appropriate display changes. */ void changeEventDisplay(Event *, int); void changeIncidenceDisplay(Incidence *, int); void changeTodoDisplay(Todo *, int); void eventAdded(Event *); void eventChanged(Event *); void eventToBeDeleted(Event *); void eventDeleted(); void todoAdded(Todo *); void todoChanged(Todo *); void todoToBeDeleted(Todo *); void todoDeleted(); void updateView(const QDate &start, const QDate &end); void updateView(); + void clearAllViews(); /** Full update of visible todo views */ void updateTodoViews(); void updateUnmanagedViews(); /** cut the current appointment to the clipboard */ void edit_cut(); /** copy the current appointment(s) to the clipboard */ void edit_copy(); /** paste the current vobject(s) in the clipboard buffer into calendar */ void edit_paste(); /** edit viewing and configuration options. */ void edit_options(); /** Functions for printing, previewing a print, and setting up printing parameters. */ void print(); void printSetup(); void printPreview(); /** Export as iCalendar file */ void exportICalendar(); /** Export as vCalendar file */ bool exportVCalendar( QString fn); /** pop up a dialog to show an existing appointment. */ void appointment_show(); /** * pop up an Appointment Dialog to edit an existing appointment. Get * information on the appointment from the list of unique IDs that is * currently in the View, called currIds. */ void appointment_edit(); /** * pop up dialog confirming deletion of currently selected event in the * View. */ void appointment_delete(); /** mails the currently selected event to a particular user as a vCalendar attachment. */ void action_mail(); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index fd9bf29..1320a2e 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1286,96 +1286,103 @@ void KOAgendaView::fillAgenda() if ( globalFlagBlockAgenda == 2 ) { if ( KOPrefs::instance()->mSetTimeToDayStartAt ) setStartHour( KOPrefs::instance()->mDayBegins ); else if ( KOPrefs::instance()->mCenterOnCurrentTime ) setStartHour( QTime::currentTime ().hour() ); // qApp->processEvents(); } qApp->processEvents(); //qDebug("qApp->processEvents(); END "); globalFlagBlockAgenda = 0; // mAgenda->hideUnused(); //mAllDayAgenda->hideUnused(); mAllDayAgenda->drawContentsToPainter(); mAgenda->drawContentsToPainter(); repaintAgenda(); onlyOne = false; // mAgenda->finishUpdate(); //mAllDayAgenda->finishUpdate(); // repaintAgenda(); //qApp->processEvents(); // globalFlagBlockAgenda = 0; } void KOAgendaView::repaintAgenda() { // mAllDayAgenda->drawContentsToPainter(); // mAllDayAgenda->viewport()->repaint( false ); // mAgenda->drawContentsToPainter(); // mAgenda->viewport()->repaint( false ); // qApp->processEvents(); //qDebug("KOAgendaView::repaintAgenda() "); //qApp->processEvents(); mAgenda->viewport()->repaint( false ); mAllDayAgenda->viewport()->repaint( false ); mAgenda->finishUpdate(); mAllDayAgenda->finishUpdate(); } void KOAgendaView::clearView() { // kdDebug() << "ClearView" << endl; mAllDayAgenda->clear(); mAgenda->clear(); } +void KOAgendaView::clearList() +{ + // kdDebug() << "ClearView" << endl; + clearView(); + mAllDayAgenda->hideUnused(); + mAgenda->hideUnused(); +} void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER if (fd == td) calPrinter->preview(CalPrinter::Day, fd, td); else calPrinter->preview(CalPrinter::Week, fd, td); #endif } // void KOAgendaView::updateMovedTodo() // { // // updateConfig(); // // emit updateTodoViews(); // } void KOAgendaView::slotShowDateView( int mode , int d ) { if ( d >= mSelectedDates.count() ) { qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); } else { QDate day = mSelectedDates[d]; emit showDateView(mode , day ); } } void KOAgendaView::newEvent(int gx, int gy) { if (!mSelectedDates.count()) return; QDate day = mSelectedDates[gx]; QTime time = mAgenda->gyToTime(gy); QDateTime dt(day,time); // if ( dt < QDateTime::currentDateTime () ) // dt = QDateTime::currentDateTime ().addSecs( 3600 ); emit newEventSignal(dt); } void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) { if (!mSelectedDates.count()) return; QDate dayStart = mSelectedDates[gxStart]; QDate dayEnd = mSelectedDates[gxEnd]; diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index c6e6602..cc953fc 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -121,96 +121,97 @@ class EventIndicator : public QFrame { virtual ~EventIndicator(); void changeColumns(int columns); void setPaintWidget( KDGanttMinimizeSplitter* ); void setXOffset( int ); void enableColumn(int column, bool enable); protected: void drawContents(QPainter *); private: int mXOffset; KDGanttMinimizeSplitter* mPaintWidget; int mColumns; QHBox *mTopBox; QBoxLayout *mTopLayout; Location mLocation; QPixmap mPixmap; QMemArray<bool> mEnabled; }; /** KOAgendaView is the agenda-like view used to display events in an one or multi-day view. */ class KOAgendaView : public KOEventView { Q_OBJECT public: KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); virtual ~KOAgendaView(); void setStartHour( int ); void toggleAllDay(); /** Returns maximum number of days supported by the koagendaview */ virtual int maxDatesHint(); /** Returns number of currently shown dates. */ virtual int currentDateCount(); /** returns the currently selected events */ virtual QPtrList<Incidence> selectedIncidences(); /** returns the currently selected events */ virtual DateList selectedDates(); /** Remove all events from view */ void clearView(); + void clearList(); KOAgenda *agenda() { return mAgenda;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); /** start-datetime of selection */ QDateTime selectionStart() {return mTimeSpanBegin;} /** end-datetime of selection */ QDateTime selectionEnd() {return mTimeSpanEnd;} /** returns true if selection is for whole day */ bool selectedIsAllDay() {return mTimeSpanInAllDay;} /** make selected start/end invalid */ void deleteSelectedDateTime(); void repaintAgenda(); public slots: void setInitStartHour(); virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void updateTodo( Todo *, int ); void changeEventDisplay(Event *, int); void clearSelection(); void newTodo(int gx,int gy); void newEvent(int gx,int gy); void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); void newEventAllDay(int gx, int gy); void newTodoAllDay(int gx, int gy); void startDrag(Event *); void readSettings(); void readSettings(KConfig *); void writeSettings(KConfig *); void setContentsPos(int y); void scrollOneHourUp(); void scrollOneHourDown(); void addToCalSlot(Incidence *, Incidence *); void slotShowDateView( int, int ); signals: void showDateView( int, QDate ); void newTodoSignal( QDateTime ,bool ); void toggleExpand(); diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 6e6a939..bc16037 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -33,80 +33,84 @@ #include <libkcal/calendar.h> #include "journalentry.h" #include "kojournalview.h" using namespace KOrg; KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { mEntry = new JournalEntry(calendar,this); mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(mEntry); connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; } KOJournalView::~KOJournalView() { } int KOJournalView::currentDateCount() { return 0; } QPtrList<Incidence> KOJournalView::selectedIncidences() { QPtrList<Incidence> eventList; return eventList; } void KOJournalView::updateConfig() { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); } void KOJournalView::updateView() { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); } void KOJournalView::flushView() { mEntry->flushEntry(); } +void KOJournalView::clearList() +{ + mEntry->clear(); +} void KOJournalView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOJournalView::selectDates()" << endl; mEntry->setDate(start); Journal *j = calendar()->journal(start); if (j) mEntry->setJournal(j); else mEntry->clear(); // emit incidenceSelected( 0 ); } void KOJournalView::showEvents(QPtrList<Event>) { // After new creation of list view no events are selected. // emit incidenceSelected( 0 ); } void KOJournalView::changeEventDisplay(Event *, int /*action*/) { updateView(); } void KOJournalView::keyPressEvent ( QKeyEvent * e ) { //qDebug("keyPressEven "); if ( e->state() == Qt::ControlButton ) { if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) e->ignore(); } } diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 1c0be82..445f940 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -1,67 +1,68 @@ /* This file is part of KOrganizer. Copyright (c) 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. */ #ifndef _KOJOURNALVIEW_H #define _KOJOURNALVIEW_H #include <korganizer/baseview.h> class JournalEntry; /** * This class provides a journal view. * @short View for Journal components. * @author Cornelius Schumacher <schumacher@kde.org> * @see KOBaseView */ class KOJournalView : public KOrg::BaseView { Q_OBJECT public: KOJournalView(Calendar *calendar, QWidget *parent = 0, const char *name = 0); ~KOJournalView(); virtual int currentDateCount(); + void clearList(); virtual QPtrList<Incidence> selectedIncidences(); DateList selectedDates() {DateList q; return q;}; signals: void deleteJournal(Journal *); public slots: void updateView(); void flushView(); void updateConfig(); void showDates( const QDate &start, const QDate &end ); void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); private: JournalEntry *mEntry; void keyPressEvent ( QKeyEvent * ) ; }; #endif diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 5f32e79..bc52281 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -318,96 +318,100 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, 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 } 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::updateList() { // qDebug(" KOListView::updateList() "); } +void KOListView::clearList() +{ + clear (); +} void KOListView::addCat( ) { setCategories( false ); } void KOListView::setCat() { setCategories( true ); } void KOListView::setAlarm() { KOAlarmPrefs kap( this); if ( !kap.exec() ) return; QStringList itemList; QPtrList<KOListViewItem> sel ; QListViewItem *qitem = mListView->firstChild (); while ( qitem ) { if ( qitem->isSelected() ) { Incidence* inc = ((KOListViewItem *) qitem)->data(); if ( inc->type() != "Journal" ) { if ( inc->type() == "Todo" ) { if ( ((Todo*)inc)->hasDueDate() ) sel.append(((KOListViewItem *)qitem)); } else sel.append(((KOListViewItem *)qitem)); } } qitem = qitem->nextSibling(); } int count = 0; KOListViewItem * item, *temp; item = sel.first(); Incidence* inc; while ( item ) { inc = item->data(); ++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); diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index dee69f6..f4d6879 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -212,96 +212,97 @@ class KOListView; class KOListViewListView : public KListView { Q_OBJECT public: KOListViewListView(KOListView * lv ); bool hasMultiSelection(QListViewItem*); signals: void newEvent(); void showIncidence( Incidence* ); public slots: void popupMenu(); private: QPoint mEventPos; QPoint mEventGlobalPos; QTimer* mPopupTimer; int mYMousePos; void keyPressEvent ( QKeyEvent * ) ; void contentsMouseDoubleClickEvent(QMouseEvent *e); void contentsMousePressEvent(QMouseEvent *e); void contentsMouseReleaseEvent(QMouseEvent *e); void contentsMouseMoveEvent(QMouseEvent *e); bool mMouseDown; }; class KOListView : public KOEventView { Q_OBJECT public: KOListView(Calendar *calendar, QWidget *parent = 0, const char *name = 0); ~KOListView(); virtual int maxDatesHint(); virtual int currentDateCount(); virtual QPtrList<Incidence> selectedIncidences(); virtual DateList selectedDates(); void showDates(bool show); Incidence* currentItem(); void addTodos(QPtrList<Todo> eventList); void addJournals(QPtrList<Journal> eventList); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); void readSettings(KConfig *config, QString setting = "KOListView Layout"); void writeSettings(KConfig *config, QString setting = "KOListView Layout"); void updateList(); + void clearList(); void setStartDate(const QDate &start); int count(); QString getWhatsThisText(QPoint p); signals: void signalNewEvent(); void beamIncidenceList(QPtrList<Incidence>); public slots: void resetFocus(); virtual void updateView(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void clearSelection(); void allSelection(); void clear(); void beamDone( Ir *ir ); void showDates(); void hideDates(); void deleteAll(); void saveToFile(); void saveToFileVCS(); void saveDescriptionToFile(); void beamSelected(); void updateConfig(); void addCat(); void setCat(); void setAlarm(); void setCategories( bool removeOld ); void changeEventDisplay(Event *, int); void defaultItemAction(QListViewItem *item); void popupMenu(QListViewItem *item,const QPoint &,int); protected slots: void processSelectionChange(QListViewItem *); protected: void writeToFile( bool iCal ); void addEvents(QPtrList<Event> eventList); void addIncidence(Incidence *); KOListViewItem *getItemForEvent(Event *event); private: KOListViewWhatsThis *mKOListViewWhatsThis; KOListViewListView *mListView; KOEventPopupMenu *mPopupMenu; KOListViewItem *mActiveItem; diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 8ee1363..678cab6 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1370,96 +1370,106 @@ void KOMonthView::updateConfig() } updateDayLabels(); //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; //resizeEvent( 0 ); for (uint i = 0; i < mCells.count(); ++i) { mCells[i]->updateConfig(); } for (uint i = 0; i < mCellsW.count(); ++i) { mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); } #ifdef DESKTOP_VERSION MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); #endif updateView(); } void KOMonthView::updateDayLabels() { QPtrVector<QLabel> *mDayLabelsT; mDayLabelsT = &mDayLabelsW; for (int i = 0; i < 7; i++) { { bool show = mShortDayLabelsW; if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } } mDayLabelsT = &mDayLabels; for (int i = 0; i < 7; i++) { if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { bool show = mShortDayLabelsM; if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } else { if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); } } } +void KOMonthView::clearList() +{ + unsigned int i; + for( i = 0; i < mCells.size(); ++i ) { + mCells[i]->clear(); + } + for( i = 0; i < mCellsW.size(); ++i ) { + mCellsW[i]->clear(); + } +} void KOMonthView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; QPtrVector<MonthViewCell> *cells; QPtrVector<QLabel> *dayLabels; QPtrVector<KOWeekButton> *weekLabels; int weekNum = 6; mStartDate = start; if ( mShowWeekView ) { weekNum = 1; cells = &mCellsW; dayLabels = &mDayLabelsW; weekLabels = &mWeekLabelsW; if ( !KGlobal::locale()->weekStartsMonday() ) { mStartDate = mStartDate.addDays( 1 ); } } else { cells = &mCells; dayLabels = &mDayLabels; weekLabels = &mWeekLabels; } int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { mWeekStartsMonday = true; } int startWeekDay = mWeekStartsMonday ? 1 : 7; while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { mStartDate = mStartDate.addDays( -1 ); } bool primary = false; uint i; for( i = 0; i < (*cells).size(); ++i ) { QDate date = mStartDate.addDays( i ); (*cells)[i]->setDate( date ); #ifndef KORG_NOPLUGINS // add holiday, if present QString hstring(KOCore::self()->holiday(date)); (*cells)[i]->setHoliday( hstring ); #endif } QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); for( i = 0; i < weekNum; ++i ) { diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index de5c014..65b5e77 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -211,96 +211,97 @@ public slots: bool mHoliday; QString mHolidayString; //QLabel *mLabel; QPushButton *mLabel; //QListBox *mItemList; #ifdef DESKTOP_VERSION static QToolTipGroup *mToolTipGroup; #endif QSize mLabelSize; QSize mLabelBigSize; QPalette mHolidayPalette; QPalette mStandardPalette; QPalette mPrimaryPalette; QPalette mNonPrimaryPalette; void setMyPalette(); QPalette getPalette (); }; class KOMonthView: public KOEventView { Q_OBJECT public: KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); ~KOMonthView(); /** Returns maximum number of days supported by the komonthview */ virtual int maxDatesHint(); /** Returns number of currently shown dates. */ virtual int currentDateCount(); /** returns the currently selected events */ virtual QPtrList<Incidence> selectedIncidences(); /** returns dates of the currently selected events */ virtual DateList selectedDates(); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); bool isMonthView() { return !mShowWeekView; } bool isUpdatePossible() { return updatePossible; } MonthViewCell * selectedCell(); bool skipResize; NavigatorBar* navigatorBar() { return mNavigatorBar ;} + void clearList(); public slots: void nextCell(); void prevCell(); virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); void clearSelection(); void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); void setPopupCell( MonthViewCell * ); void switchView(); void setKeyBoardFocus(); void setKeyBFocus(); protected slots: void slotNewTodo(); void slotNewEvent(); void slotEditJournal(); void slotComputeLayout(); void selectInternalWeekNum ( int ); void processSelectionChange(); signals: void nextMonth(); void prevMonth(); void selectWeekNum ( int ); void selectMonth (); void showDaySignal( QDate ); void newTodoSignal( QDateTime, bool ); void showJournalSignal( int,QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: QTimer* mComputeLayoutTimer; NavigatorBar* mNavigatorBar; int currentWeek(); bool clPending; QWidgetStack * mWidStack; QWidget* mMonthView; QWidget* mWeekView; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index fb4de37..5d9af6d 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -313,96 +313,108 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) } 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() { @@ -787,52 +799,51 @@ void KOViewManager::showJournalView() } 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->clearList(); mTodoView->setDocumentId( id ); } } diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 8dc03e0..838583b 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -22,96 +22,97 @@ without including the source code for Qt in the source distribution. */ #ifndef KOVIEWMANAGER_H #define KOVIEWMANAGER_H #include <qobject.h> #include <korganizer/baseview.h> class CalendarView; class KOListView; class KOAgendaView; class KOMonthView; class KOTimeSpanView; class KOTodoView; class KOWhatsNextView; class KOJournalView; using namespace KCal; /** This class manages the views of the calendar. It owns the objects and handles creation and selection. */ class KOViewManager : public QObject { Q_OBJECT public: KOViewManager( CalendarView * ); virtual ~KOViewManager(); /** changes the view to be the currently selected view */ void showView(KOrg::BaseView *, bool fullScreen = false ); void updateWNview(); void readSettings(KConfig *config); void writeSettings(KConfig *config); bool showsNextDays(); /** Read which view was shown last from config file */ void readCurrentView(KConfig *); /** Write which view is currently shown to config file */ void writeCurrentView(KConfig *); KOrg::BaseView *currentView(); void setDocumentId( const QString & ); void updateView( const QDate &start, const QDate &end ); + void clearAllViews(); void raiseCurrentView( bool fullScreen = false , bool updateView = false); void addView(KOrg::BaseView *); Incidence *currentSelection(); QDate currentSelectionDate(); KOAgendaView *agendaView() const { return mAgendaView; } signals: void printWNV(); void signalFullScreen( bool ); void signalAgendaView( bool ); public slots: void slotprintWNV(); void showNextView(); void showMonth( const QDate & ); void showDateView( int, QDate ); void updateView(); void showWhatsNextView(); void showListView(); void showAgendaView( bool fullScreen = false ); void showDayView(); void showWorkWeekView(); void showWeekView(); void showNextXView(); void showMonthView(); void showMonthViewWeek(); void showTodoView(); void showJournalView(); void showTimeSpanView(); private: void resetDateSilent( QDate date , int days ); int flagResetViewChangeDate; QDate currentViewChangeDate; void createMonthView(); CalendarView *mMainView; int mCurrentAgendaView; KOAgendaView *mAgendaView; KOListView *mListView; KOMonthView *mMonthView; KOTodoView *mTodoView; KOWhatsNextView *mWhatsNextView; KOJournalView *mJournalView; KOTimeSpanView *mTimeSpanView; diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 65d8ac3..62d7ede 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -94,96 +94,101 @@ void WhatsNextTextBrowser::printMe() KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { // mDateLabel = // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); // mDateLabel->setMargin(2); // mDateLabel->setAlignment(AlignCenter); setFont( KOPrefs::instance()->mWhatsNextFont ); mView = new WhatsNextTextBrowser(this); connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); QStyleSheet* stsh = mView->styleSheet(); QStyleSheetItem * style ; style = stsh->item ("h2" ); if ( style ) { style->setMargin(QStyleSheetItem::MarginAll,0); } style = stsh->item ("h3" ); if ( style ) { style->setMargin(QStyleSheetItem::MarginAll,0); } mEventViewer = 0; QBoxLayout *topLayout = new QVBoxLayout(this); // topLayout->addWidget(mDateLabel); topLayout->addWidget(mView); mTimer = new QTimer( this ); connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); } KOWhatsNextView::~KOWhatsNextView() { } int KOWhatsNextView::maxDatesHint() { return 0; } int KOWhatsNextView::currentDateCount() { return 0; } +void KOWhatsNextView::clearList() +{ + mTimer->stop(); + mView->setText(" "); +} QPtrList<Incidence> KOWhatsNextView::selectedIncidences() { QPtrList<Incidence> eventList; return eventList; } void KOWhatsNextView::printMe() { #ifdef DESKTOP_VERSION mView->printMe(); #endif } void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOWhatsNextView::updateConfig() { setFont( KOPrefs::instance()->mWhatsNextFont ); updateView(); } void KOWhatsNextView::showEvent ( QShowEvent * e ) { //qDebug("KOWhatsNextView::showEvent "); restartTimer(); QWidget::showEvent ( e ); } void KOWhatsNextView::hideEvent ( QHideEvent * e) { //qDebug(" KOWhatsNextView::hideEvent"); mTimer->stop(); QWidget::hideEvent ( e ); } void KOWhatsNextView::restartTimer() { //qDebug("KOWhatsNextView::restartTimer() "); mTimer->start( 300000 ); //mTimer->start( 5000 ); } void KOWhatsNextView::updateView() { //qDebug("KOWhatsNextView::updateView() "); if ( mTimer->isActive() ) diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index d6727ac..93574ef 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h @@ -14,88 +14,89 @@ 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. */ #ifndef KOWHATSNEXTVIEW_H #define KOWHATSNEXTVIEW_H #include <qtextbrowser.h> #include <qtimer.h> #include <korganizer/baseview.h> class QListView; class QLabel; class KOEventViewerDialog; #include <qpainter.h> #include <qwidget.h> class WhatsNextTextBrowser : public QTextBrowser { Q_OBJECT public: WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}; void setSource(const QString &); void printMe(); signals: void showIncidence(const QString &uid); }; /** This class provides a view of the next events and todos */ class KOWhatsNextView : public KOrg::BaseView { Q_OBJECT public: KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, const char *name = 0); ~KOWhatsNextView(); virtual int maxDatesHint(); virtual int currentDateCount(); void setEventViewer(KOEventViewerDialog* v ); virtual QPtrList<Incidence> selectedIncidences(); + void clearList(); DateList selectedDates() {DateList q; return q;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); public slots: virtual void updateView(); void printMe(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void updateConfig(); void changeEventDisplay(Event *, int); protected: bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); void appendDay( int i, QDate date ); QDate mEventDate; virtual void showEvent ( QShowEvent * ); virtual void hideEvent ( QHideEvent * ); private slots: void showIncidence(const QString &); void restartTimer(); private: int mCurrentMaxPrio; //void createEventViewer(); QTimer* mTimer; WhatsNextTextBrowser *mView; QString mText; // QLabel *mDateLabel; KOEventViewerDialog *mEventViewer; QValueList<Incidence *> mTodos; }; #endif diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 63053a5..d959a7a 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1625,96 +1625,97 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); } } else startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); if ( !incidence->location().isEmpty() ) startString += " (" +incidence->location()+")"; setCaption( incidence->summary()+startString); enableIncidenceActions( true ); if ( incidence->type() == "Event" ) { mShowAction->setText( i18n("Show Event...") ); mEditAction->setText( i18n("Edit Event...") ); mDeleteAction->setText( i18n("Delete Event...") ); mNewSubTodoAction->setEnabled( false ); } else if ( incidence->type() == "Todo" ) { mShowAction->setText( i18n("Show Todo...") ); mEditAction->setText( i18n("Edit Todo...") ); mDeleteAction->setText( i18n("Delete Todo...") ); mNewSubTodoAction->setEnabled( true ); } else { mShowAction->setText( i18n("Show...") ); mShowAction->setText( i18n("Edit...") ); mShowAction->setText( i18n("Delete...") ); mNewSubTodoAction->setEnabled( false ); } } void MainWindow::enableIncidenceActions( bool enabled ) { mShowAction->setEnabled( enabled ); mEditAction->setEnabled( enabled ); mDeleteAction->setEnabled( enabled ); mCloneAction->setEnabled( enabled ); mMoveAction->setEnabled( enabled ); mBeamAction->setEnabled( enabled ); mCancelAction->setEnabled( enabled ); } void MainWindow::importOL() { #ifdef _OL_IMPORT_ + mView->clearAllViews(); KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); id->exec(); delete id; mView->updateView(); #endif } void MainWindow::importBday() { int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), i18n("Import!"), i18n("Cancel"), 0, 0, 1 ); if ( result == 0 ) { mView->importBday(); } } void MainWindow::importQtopia() { //#ifndef DESKTOP_VERSION QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); #ifdef DESKTOP_VERSION mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); #endif int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, i18n("Import!"), i18n("Cancel"), 0, 0, 1 ); if ( result == 0 ) { #ifndef DESKTOP_VERSION QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; #else QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; #endif mView->importQtopia( categories, datebook, todolist ); } #if 0 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("Not supported \non desktop!\n"), i18n("Ok"), i18n("Cancel"), 0, 0, 1 ); #endif |