-rw-r--r-- | korganizer/journalentry.cpp | 7 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
5 files changed, 16 insertions, 5 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 395392c..3c01eeb 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -246,30 +246,31 @@ void JournalEntry::writeJournal() mJournal = 0; bool conf = KOPrefs::instance()->mConfirm; KOPrefs::instance()->mConfirm = false; emit deleteJournal(j); KOPrefs::instance()->mConfirm = conf; } return; } // kdDebug() << "JournalEntry::writeJournal()..." << endl; if (!mJournal) { mJournal = new Journal; mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); mCalendar->addJournal(mJournal); } - - mJournal->setDescription(mEditor->text()); - mJournal->setSummary(mTitle->text()); + if ( mJournal->description() != mEditor->text() ) + mJournal->setDescription(mEditor->text()); + if ( mJournal->summary() != mTitle->text() ) + mJournal->setSummary(mTitle->text()); } void JournalEntry::flushEntry() { writeJournal(); } void JournalEntry::keyPressEvent ( QKeyEvent * e ) { e->ignore(); } diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index b659d53..51ae0a0 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -105,33 +105,37 @@ void KOJournalView::updateConfig() { JournalEntry* mEntry = jEntries.first(); while ( mEntry ) { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); mEntry = jEntries.next(); } } void KOJournalView::updateView() { JournalEntry* mEntry = jEntries.first(); while ( mEntry ) { mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); mEntry = jEntries.next(); } showDates( mDate, QDate() ); } - +void KOJournalView::checkModified() +{ + qDebug("checkmod "); + flushView(); +} void KOJournalView::flushView() { static bool ff = false; if ( ff ) return; ff = true; JournalEntry* mEntry = jEntries.first(); while ( mEntry ) { mEntry->flushEntry(); mEntry = jEntries.next(); } ff = false; } void KOJournalView::clearList() { JournalEntry* mEntry = jEntries.first(); diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 331bdfa..7fa94ae 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -37,32 +37,33 @@ class QLabel; * @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;}; + void checkModified(); signals: void deleteJournal(Journal *); public slots: void showOnly ( Journal* ); void newJournal(); void updateView(); void flushView(); void updateConfig(); void showDates( const QDate &start, const QDate &end ); void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); private: void showList(QPtrList<Journal> jl); Calendar *mCalendar; diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index d5a8e3b..2e6aaed 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -64,32 +64,33 @@ class KOViewManager : public QObject 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; } + KOJournalView *journalView() const { return mJournalView; } signals: void printWNV(); void signalFullScreen( bool ); void signalAgendaView( bool ); public slots: void setDefaultCalendar(int); 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(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d8373a6..fb6d6ec 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -34,32 +34,33 @@ #include <qapplication.h> //#include <resource.h> #endif #include <libkcal/calendarlocal.h> #include <libkcal/todo.h> #include <libkcal/phoneformat.h> #include <libkdepim/ksyncprofile.h> #include <libkdepim/phoneaccess.h> #include <libkcal/kincidenceformatter.h> #include <libkdepim/kpimglobalprefs.h> #include "calendarview.h" #include "koviewmanager.h" #include "datenavigator.h" #include "koagendaview.h" +#include "kojournalview.h" #include "koagenda.h" #include "kodialogmanager.h" #include "kdialogbase.h" #include "kapplication.h" #include "kofilterview.h" #include "kstandarddirs.h" #include "koprefs.h" #include "kfiledialog.h" #include "koglobals.h" #include "kglobal.h" #include "ktoolbar.h" #include "klocale.h" #include "kconfig.h" #include "externalapphandler.h" #include <kglobalsettings.h> @@ -1821,33 +1822,34 @@ void MainWindow::saveOnClose() if ( p->mToolBarHorV ) p->mToolBarUpV = viewToolBar->y() > height()/2; else p->mToolBarUpV = viewToolBar->x() > width()/2 ; if ( p->mToolBarHorN ) p->mToolBarUpN = navigatorToolBar->y() > height()/2; else p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; if ( filterToolBar ) { if ( p->mToolBarHorF ) p->mToolBarUpF = filterToolBar->y() > height()/2; else p->mToolBarUpF = filterToolBar->x() > width()/2 ; } #endif - + if ( mView->viewManager()->journalView() ) + mView->viewManager()->journalView()->checkModified(); if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) save(); mView->writeSettings(); } void MainWindow::slotModifiedChanged( bool changed ) { if ( mBlockAtStartup ) return; int msec; // we store the changes after 1 minute, // and for safety reasons after 10 minutes again if ( !mSyncManager->blockSave() ) msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; else msec = 1000 * 600; @@ -1886,32 +1888,34 @@ void MainWindow::backupAllFiles() int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); } cal = calendars.next(); } KOPrefs::instance()->mLastBackupDate = daysTo; setCaption(i18n("Backup succesfully finished" )); } else if ( retval == 2 ){ setCaption(i18n("Backup globally disabled" )); qDebug("KO: Backup globally cancelled."); // backup globally cancelled KPimGlobalPrefs::instance()->mBackupEnabled = false; } // retval == 3: do nothing, try again later } void MainWindow::save() { + if ( mView->viewManager()->journalView() ) + mView->viewManager()->journalView()->checkModified(); if ( !mCalendarModifiedFlag ) { qDebug("KO: Calendar not modified. Nothing saved."); return; } if ( mSyncManager->blockSave() ) return; mSyncManager->setBlockSave(true); if ( mView->checkAllFileVersions() ) { if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ QDate reference ( 2000,1,1); int daysTo = reference.daysTo ( QDate::currentDate() ); if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { backupAllFiles(); } ; // KPimGlobalPrefs::instance()->mLastBackupDate } |