author | zautrix <zautrix> | 2005-06-30 06:47:32 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 06:47:32 (UTC) |
commit | 0e4ec4bb2a13a89d3d6145ea076a5734481cb252 (patch) (unidiff) | |
tree | fecf6ecb38a726323fb9522eaae1764930ec49cf | |
parent | 0fc571a7eadda739fd1a93d627e7129b9956c9f6 (diff) | |
download | kdepimpi-0e4ec4bb2a13a89d3d6145ea076a5734481cb252.zip kdepimpi-0e4ec4bb2a13a89d3d6145ea076a5734481cb252.tar.gz kdepimpi-0e4ec4bb2a13a89d3d6145ea076a5734481cb252.tar.bz2 |
fixixix
-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 | |||
@@ -214,62 +214,63 @@ Journal *JournalEntry::journal() const | |||
214 | 214 | ||
215 | void JournalEntry::clear() | 215 | void JournalEntry::clear() |
216 | { | 216 | { |
217 | mJournal = 0; | 217 | mJournal = 0; |
218 | mEditor->setText(""); | 218 | mEditor->setText(""); |
219 | mTitle->setText(""); | 219 | mTitle->setText(""); |
220 | } | 220 | } |
221 | 221 | ||
222 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 222 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
223 | { | 223 | { |
224 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 224 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
225 | 225 | ||
226 | if ( e->type() == QEvent::FocusOut ) { | 226 | if ( e->type() == QEvent::FocusOut ) { |
227 | writeJournal(); | 227 | writeJournal(); |
228 | } | 228 | } |
229 | if ( e->type() == QEvent::KeyPress ) { | 229 | if ( e->type() == QEvent::KeyPress ) { |
230 | QKeyEvent * k = (QKeyEvent *) e; | 230 | QKeyEvent * k = (QKeyEvent *) e; |
231 | if ( k->state() == Qt::ControlButton ) { | 231 | if ( k->state() == Qt::ControlButton ) { |
232 | k->ignore(); | 232 | k->ignore(); |
233 | //return true; | 233 | //return true; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | return QFrame::eventFilter( o, e ); // standard event processing | 237 | return QFrame::eventFilter( o, e ); // standard event processing |
238 | } | 238 | } |
239 | 239 | ||
240 | void JournalEntry::writeJournal() | 240 | void JournalEntry::writeJournal() |
241 | { | 241 | { |
242 | if ( !visibleMode ) return; | 242 | if ( !visibleMode ) return; |
243 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { | 243 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { |
244 | if ( mJournal ) { | 244 | if ( mJournal ) { |
245 | Journal* j = mJournal; | 245 | Journal* j = mJournal; |
246 | mJournal = 0; | 246 | mJournal = 0; |
247 | bool conf = KOPrefs::instance()->mConfirm; | 247 | bool conf = KOPrefs::instance()->mConfirm; |
248 | KOPrefs::instance()->mConfirm = false; | 248 | KOPrefs::instance()->mConfirm = false; |
249 | emit deleteJournal(j); | 249 | emit deleteJournal(j); |
250 | KOPrefs::instance()->mConfirm = conf; | 250 | KOPrefs::instance()->mConfirm = conf; |
251 | } | 251 | } |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | 254 | ||
255 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 255 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
256 | 256 | ||
257 | if (!mJournal) { | 257 | if (!mJournal) { |
258 | mJournal = new Journal; | 258 | mJournal = new Journal; |
259 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 259 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
260 | mCalendar->addJournal(mJournal); | 260 | mCalendar->addJournal(mJournal); |
261 | } | 261 | } |
262 | 262 | if ( mJournal->description() != mEditor->text() ) | |
263 | mJournal->setDescription(mEditor->text()); | 263 | mJournal->setDescription(mEditor->text()); |
264 | mJournal->setSummary(mTitle->text()); | 264 | if ( mJournal->summary() != mTitle->text() ) |
265 | mJournal->setSummary(mTitle->text()); | ||
265 | } | 266 | } |
266 | 267 | ||
267 | void JournalEntry::flushEntry() | 268 | void JournalEntry::flushEntry() |
268 | { | 269 | { |
269 | writeJournal(); | 270 | writeJournal(); |
270 | } | 271 | } |
271 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 272 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
272 | { | 273 | { |
273 | e->ignore(); | 274 | e->ignore(); |
274 | 275 | ||
275 | } | 276 | } |
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index b659d53..51ae0a0 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -73,97 +73,101 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, | |||
73 | mDateLabel->setAlignment(AlignCenter); | 73 | mDateLabel->setAlignment(AlignCenter); |
74 | connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); | 74 | connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); |
75 | getNewEntry(); | 75 | getNewEntry(); |
76 | } | 76 | } |
77 | 77 | ||
78 | KOJournalView::~KOJournalView() | 78 | KOJournalView::~KOJournalView() |
79 | { | 79 | { |
80 | } | 80 | } |
81 | 81 | ||
82 | int KOJournalView::currentDateCount() | 82 | int KOJournalView::currentDateCount() |
83 | { | 83 | { |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | JournalEntry* KOJournalView::getNewEntry() | 86 | JournalEntry* KOJournalView::getNewEntry() |
87 | { | 87 | { |
88 | JournalEntry* Entry = new JournalEntry(mCalendar,parWid); | 88 | JournalEntry* Entry = new JournalEntry(mCalendar,parWid); |
89 | jEntries.append( Entry ); | 89 | jEntries.append( Entry ); |
90 | mTopLayout->addWidget(Entry); | 90 | mTopLayout->addWidget(Entry); |
91 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 91 | Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
92 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; | 92 | connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; |
93 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; | 93 | connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; |
94 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; | 94 | connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; |
95 | return Entry; | 95 | return Entry; |
96 | } | 96 | } |
97 | 97 | ||
98 | QPtrList<Incidence> KOJournalView::selectedIncidences() | 98 | QPtrList<Incidence> KOJournalView::selectedIncidences() |
99 | { | 99 | { |
100 | QPtrList<Incidence> eventList; | 100 | QPtrList<Incidence> eventList; |
101 | 101 | ||
102 | return eventList; | 102 | return eventList; |
103 | } | 103 | } |
104 | void KOJournalView::updateConfig() | 104 | void KOJournalView::updateConfig() |
105 | { | 105 | { |
106 | JournalEntry* mEntry = jEntries.first(); | 106 | JournalEntry* mEntry = jEntries.first(); |
107 | while ( mEntry ) { | 107 | while ( mEntry ) { |
108 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 108 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
109 | mEntry = jEntries.next(); | 109 | mEntry = jEntries.next(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | void KOJournalView::updateView() | 112 | void KOJournalView::updateView() |
113 | { | 113 | { |
114 | JournalEntry* mEntry = jEntries.first(); | 114 | JournalEntry* mEntry = jEntries.first(); |
115 | while ( mEntry ) { | 115 | while ( mEntry ) { |
116 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); | 116 | mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); |
117 | mEntry = jEntries.next(); | 117 | mEntry = jEntries.next(); |
118 | } | 118 | } |
119 | showDates( mDate, QDate() ); | 119 | showDates( mDate, QDate() ); |
120 | } | 120 | } |
121 | 121 | void KOJournalView::checkModified() | |
122 | { | ||
123 | qDebug("checkmod "); | ||
124 | flushView(); | ||
125 | } | ||
122 | void KOJournalView::flushView() | 126 | void KOJournalView::flushView() |
123 | { | 127 | { |
124 | static bool ff = false; | 128 | static bool ff = false; |
125 | if ( ff ) return; | 129 | if ( ff ) return; |
126 | ff = true; | 130 | ff = true; |
127 | JournalEntry* mEntry = jEntries.first(); | 131 | JournalEntry* mEntry = jEntries.first(); |
128 | while ( mEntry ) { | 132 | while ( mEntry ) { |
129 | mEntry->flushEntry(); | 133 | mEntry->flushEntry(); |
130 | mEntry = jEntries.next(); | 134 | mEntry = jEntries.next(); |
131 | } | 135 | } |
132 | ff = false; | 136 | ff = false; |
133 | } | 137 | } |
134 | 138 | ||
135 | void KOJournalView::clearList() | 139 | void KOJournalView::clearList() |
136 | { | 140 | { |
137 | JournalEntry* mEntry = jEntries.first(); | 141 | JournalEntry* mEntry = jEntries.first(); |
138 | while ( mEntry ) { | 142 | while ( mEntry ) { |
139 | mEntry->clear(); | 143 | mEntry->clear(); |
140 | mEntry = jEntries.next(); | 144 | mEntry = jEntries.next(); |
141 | } | 145 | } |
142 | } | 146 | } |
143 | void KOJournalView::newJournal() | 147 | void KOJournalView::newJournal() |
144 | { | 148 | { |
145 | //qDebug(" KOJournalView::newJournal()"); | 149 | //qDebug(" KOJournalView::newJournal()"); |
146 | flushView(); | 150 | flushView(); |
147 | Journal* mJournal = new Journal; | 151 | Journal* mJournal = new Journal; |
148 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 152 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
149 | mCalendar->addJournal(mJournal); | 153 | mCalendar->addJournal(mJournal); |
150 | showDates( mDate, QDate() ); | 154 | showDates( mDate, QDate() ); |
151 | } | 155 | } |
152 | 156 | ||
153 | void KOJournalView::showOnly ( Journal* j ) | 157 | void KOJournalView::showOnly ( Journal* j ) |
154 | { | 158 | { |
155 | //qDebug("showOnly %x ", j); | 159 | //qDebug("showOnly %x ", j); |
156 | flushView(); | 160 | flushView(); |
157 | if ( j == 0 ) { | 161 | if ( j == 0 ) { |
158 | showDates( mDate, QDate() ); | 162 | showDates( mDate, QDate() ); |
159 | return; | 163 | return; |
160 | } | 164 | } |
161 | QPtrList<Journal> jl; | 165 | QPtrList<Journal> jl; |
162 | jl.append ( j ); | 166 | jl.append ( j ); |
163 | showList( jl ); | 167 | showList( jl ); |
164 | JournalEntry* mEntry = jEntries.first(); | 168 | JournalEntry* mEntry = jEntries.first(); |
165 | mEntry->setShowOnly(); | 169 | mEntry->setShowOnly(); |
166 | } | 170 | } |
167 | void KOJournalView::showList(QPtrList<Journal> jl) | 171 | void KOJournalView::showList(QPtrList<Journal> jl) |
168 | { | 172 | { |
169 | //qDebug("KOJournalView::showList %d",jl.count() ); | 173 | //qDebug("KOJournalView::showList %d",jl.count() ); |
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 331bdfa..7fa94ae 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h | |||
@@ -5,75 +5,76 @@ | |||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KOJOURNALVIEW_H | 23 | #ifndef _KOJOURNALVIEW_H |
24 | #define _KOJOURNALVIEW_H | 24 | #define _KOJOURNALVIEW_H |
25 | 25 | ||
26 | #include <korganizer/baseview.h> | 26 | #include <korganizer/baseview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | class JournalEntry; | 29 | class JournalEntry; |
30 | class QLabel; | 30 | class QLabel; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * This class provides a journal view. | 33 | * This class provides a journal view. |
34 | 34 | ||
35 | * @short View for Journal components. | 35 | * @short View for Journal components. |
36 | * @author Cornelius Schumacher <schumacher@kde.org> | 36 | * @author Cornelius Schumacher <schumacher@kde.org> |
37 | * @see KOBaseView | 37 | * @see KOBaseView |
38 | */ | 38 | */ |
39 | class KOJournalView : public KOrg::BaseView | 39 | class KOJournalView : public KOrg::BaseView |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | KOJournalView(Calendar *calendar, QWidget *parent = 0, | 43 | KOJournalView(Calendar *calendar, QWidget *parent = 0, |
44 | const char *name = 0); | 44 | const char *name = 0); |
45 | ~KOJournalView(); | 45 | ~KOJournalView(); |
46 | 46 | ||
47 | virtual int currentDateCount(); | 47 | virtual int currentDateCount(); |
48 | void clearList(); | 48 | void clearList(); |
49 | virtual QPtrList<Incidence> selectedIncidences(); | 49 | virtual QPtrList<Incidence> selectedIncidences(); |
50 | DateList selectedDates() | 50 | DateList selectedDates() |
51 | {DateList q; | 51 | {DateList q; |
52 | return q;}; | 52 | return q;}; |
53 | void checkModified(); | ||
53 | signals: | 54 | signals: |
54 | void deleteJournal(Journal *); | 55 | void deleteJournal(Journal *); |
55 | public slots: | 56 | public slots: |
56 | void showOnly ( Journal* ); | 57 | void showOnly ( Journal* ); |
57 | void newJournal(); | 58 | void newJournal(); |
58 | void updateView(); | 59 | void updateView(); |
59 | void flushView(); | 60 | void flushView(); |
60 | void updateConfig(); | 61 | void updateConfig(); |
61 | void showDates( const QDate &start, const QDate &end ); | 62 | void showDates( const QDate &start, const QDate &end ); |
62 | void showEvents(QPtrList<Event> eventList); | 63 | void showEvents(QPtrList<Event> eventList); |
63 | 64 | ||
64 | void changeEventDisplay(Event *, int); | 65 | void changeEventDisplay(Event *, int); |
65 | 66 | ||
66 | private: | 67 | private: |
67 | void showList(QPtrList<Journal> jl); | 68 | void showList(QPtrList<Journal> jl); |
68 | Calendar *mCalendar; | 69 | Calendar *mCalendar; |
69 | JournalEntry* getNewEntry(); | 70 | JournalEntry* getNewEntry(); |
70 | QPtrList<JournalEntry> jEntries; | 71 | QPtrList<JournalEntry> jEntries; |
71 | void keyPressEvent ( QKeyEvent * ) ; | 72 | void keyPressEvent ( QKeyEvent * ) ; |
72 | QBoxLayout *mTopLayout; | 73 | QBoxLayout *mTopLayout; |
73 | QWidget *parWid; | 74 | QWidget *parWid; |
74 | QLabel * mDateLabel; | 75 | QLabel * mDateLabel; |
75 | QDate mDate; | 76 | QDate mDate; |
76 | 77 | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | #endif | 80 | #endif |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index d5a8e3b..2e6aaed 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -32,96 +32,97 @@ class CalendarView; | |||
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView( const QDate &start, const QDate &end ); | 69 | void updateView( const QDate &start, const QDate &end ); |
70 | void clearAllViews(); | 70 | void clearAllViews(); |
71 | 71 | ||
72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); | 72 | void raiseCurrentView( bool fullScreen = false , bool updateView = false); |
73 | 73 | ||
74 | void addView(KOrg::BaseView *); | 74 | void addView(KOrg::BaseView *); |
75 | 75 | ||
76 | Incidence *currentSelection(); | 76 | Incidence *currentSelection(); |
77 | QDate currentSelectionDate(); | 77 | QDate currentSelectionDate(); |
78 | 78 | ||
79 | KOAgendaView *agendaView() const { return mAgendaView; } | 79 | KOAgendaView *agendaView() const { return mAgendaView; } |
80 | KOJournalView *journalView() const { return mJournalView; } | ||
80 | 81 | ||
81 | signals: | 82 | signals: |
82 | void printWNV(); | 83 | void printWNV(); |
83 | void signalFullScreen( bool ); | 84 | void signalFullScreen( bool ); |
84 | void signalAgendaView( bool ); | 85 | void signalAgendaView( bool ); |
85 | public slots: | 86 | public slots: |
86 | void setDefaultCalendar(int); | 87 | void setDefaultCalendar(int); |
87 | void slotprintWNV(); | 88 | void slotprintWNV(); |
88 | void showNextView(); | 89 | void showNextView(); |
89 | void showMonth( const QDate & ); | 90 | void showMonth( const QDate & ); |
90 | void showDateView( int, QDate ); | 91 | void showDateView( int, QDate ); |
91 | void updateView(); | 92 | void updateView(); |
92 | void showWhatsNextView(); | 93 | void showWhatsNextView(); |
93 | void showListView(); | 94 | void showListView(); |
94 | void showAgendaView( bool fullScreen = false ); | 95 | void showAgendaView( bool fullScreen = false ); |
95 | void showDayView(); | 96 | void showDayView(); |
96 | void showWorkWeekView(); | 97 | void showWorkWeekView(); |
97 | void showWeekView(); | 98 | void showWeekView(); |
98 | void showNextXView(); | 99 | void showNextXView(); |
99 | void showMonthView(); | 100 | void showMonthView(); |
100 | void showMonthViewWeek(); | 101 | void showMonthViewWeek(); |
101 | void showTodoView(); | 102 | void showTodoView(); |
102 | void showJournalView(); | 103 | void showJournalView(); |
103 | void showTimeSpanView(); | 104 | void showTimeSpanView(); |
104 | 105 | ||
105 | private: | 106 | private: |
106 | void resetDateSilent( QDate date , int days ); | 107 | void resetDateSilent( QDate date , int days ); |
107 | int flagResetViewChangeDate; | 108 | int flagResetViewChangeDate; |
108 | QDate currentViewChangeDate; | 109 | QDate currentViewChangeDate; |
109 | void createMonthView(); | 110 | void createMonthView(); |
110 | CalendarView *mMainView; | 111 | CalendarView *mMainView; |
111 | 112 | ||
112 | int mCurrentAgendaView; | 113 | int mCurrentAgendaView; |
113 | KOAgendaView *mAgendaView; | 114 | KOAgendaView *mAgendaView; |
114 | KOListView *mListView; | 115 | KOListView *mListView; |
115 | KOMonthView *mMonthView; | 116 | KOMonthView *mMonthView; |
116 | KOTodoView *mTodoView; | 117 | KOTodoView *mTodoView; |
117 | KOWhatsNextView *mWhatsNextView; | 118 | KOWhatsNextView *mWhatsNextView; |
118 | KOJournalView *mJournalView; | 119 | KOJournalView *mJournalView; |
119 | KOTimeSpanView *mTimeSpanView; | 120 | KOTimeSpanView *mTimeSpanView; |
120 | 121 | ||
121 | KOrg::BaseView *mCurrentView; // currently active event view | 122 | KOrg::BaseView *mCurrentView; // currently active event view |
122 | 123 | ||
123 | int mAgendaViewMode; | 124 | int mAgendaViewMode; |
124 | bool mFlagShowNextxDays; | 125 | bool mFlagShowNextxDays; |
125 | 126 | ||
126 | }; | 127 | }; |
127 | 128 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d8373a6..fb6d6ec 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -2,96 +2,97 @@ | |||
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "kojournalview.h" | ||
50 | #include "koagenda.h" | 51 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 52 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 53 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 54 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 55 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 56 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 57 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 58 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 59 | #include "koglobals.h" |
59 | #include "kglobal.h" | 60 | #include "kglobal.h" |
60 | #include "ktoolbar.h" | 61 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 62 | #include "klocale.h" |
62 | #include "kconfig.h" | 63 | #include "kconfig.h" |
63 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
64 | #include <kglobalsettings.h> | 65 | #include <kglobalsettings.h> |
65 | 66 | ||
66 | using namespace KCal; | 67 | using namespace KCal; |
67 | #ifndef _WIN32_ | 68 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 69 | #include <unistd.h> |
69 | #else | 70 | #else |
70 | #ifdef _OL_IMPORT_ | 71 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 72 | #include "koimportoldialog.h" |
72 | #endif | 73 | #endif |
73 | #endif | 74 | #endif |
74 | #include "mainwindow.h" | 75 | #include "mainwindow.h" |
75 | 76 | ||
76 | 77 | ||
77 | class KOex2phonePrefs : public QDialog | 78 | class KOex2phonePrefs : public QDialog |
78 | { | 79 | { |
79 | public: | 80 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 81 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 82 | QDialog( parent, name, true ) |
82 | { | 83 | { |
83 | setCaption( i18n("Export to phone options") ); | 84 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 85 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 86 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 87 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 88 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 89 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 90 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 91 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 92 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 93 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 94 | mPhoneDevice = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 95 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 96 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Connection: "), temphb ); | 97 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 98 | mPhoneConnection = new QLineEdit( temphb); |
@@ -1789,161 +1790,164 @@ void MainWindow::saveOnClose() | |||
1789 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1790 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1790 | } | 1791 | } |
1791 | #ifdef DESKTOP_VERSION | 1792 | #ifdef DESKTOP_VERSION |
1792 | 1793 | ||
1793 | QPoint myP; | 1794 | QPoint myP; |
1794 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1795 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1795 | if ( p->mToolBarHor ) | 1796 | if ( p->mToolBarHor ) |
1796 | p->mToolBarUp = myP.y() > height()/2; | 1797 | p->mToolBarUp = myP.y() > height()/2; |
1797 | else | 1798 | else |
1798 | p->mToolBarUp = myP.x() > width()/2; | 1799 | p->mToolBarUp = myP.x() > width()/2; |
1799 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1800 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1800 | if ( p->mToolBarHorV ) | 1801 | if ( p->mToolBarHorV ) |
1801 | p->mToolBarUpV = myP.y() > height()/2; | 1802 | p->mToolBarUpV = myP.y() > height()/2; |
1802 | else | 1803 | else |
1803 | p->mToolBarUpV = myP.x() > width()/2 ; | 1804 | p->mToolBarUpV = myP.x() > width()/2 ; |
1804 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1805 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1805 | if ( p->mToolBarHorN ) | 1806 | if ( p->mToolBarHorN ) |
1806 | p->mToolBarUpN = myP.y() > height()/2; | 1807 | p->mToolBarUpN = myP.y() > height()/2; |
1807 | else | 1808 | else |
1808 | p->mToolBarUpN = myP.x() > width()/2 ; | 1809 | p->mToolBarUpN = myP.x() > width()/2 ; |
1809 | if ( filterToolBar ) { | 1810 | if ( filterToolBar ) { |
1810 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1811 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1811 | if ( p->mToolBarHorF ) | 1812 | if ( p->mToolBarHorF ) |
1812 | p->mToolBarUpF = myP.y() > height()/2; | 1813 | p->mToolBarUpF = myP.y() > height()/2; |
1813 | else | 1814 | else |
1814 | p->mToolBarUpF = myP.x() > width()/2 ; | 1815 | p->mToolBarUpF = myP.x() > width()/2 ; |
1815 | } | 1816 | } |
1816 | #else | 1817 | #else |
1817 | if ( p->mToolBarHor ) | 1818 | if ( p->mToolBarHor ) |
1818 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1819 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1819 | else | 1820 | else |
1820 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1821 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1821 | if ( p->mToolBarHorV ) | 1822 | if ( p->mToolBarHorV ) |
1822 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1823 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1823 | else | 1824 | else |
1824 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1825 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1825 | 1826 | ||
1826 | if ( p->mToolBarHorN ) | 1827 | if ( p->mToolBarHorN ) |
1827 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1828 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1828 | else | 1829 | else |
1829 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1830 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1830 | if ( filterToolBar ) { | 1831 | if ( filterToolBar ) { |
1831 | if ( p->mToolBarHorF ) | 1832 | if ( p->mToolBarHorF ) |
1832 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1833 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1833 | else | 1834 | else |
1834 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1835 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1835 | } | 1836 | } |
1836 | #endif | 1837 | #endif |
1837 | 1838 | if ( mView->viewManager()->journalView() ) | |
1839 | mView->viewManager()->journalView()->checkModified(); | ||
1838 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1840 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1839 | save(); | 1841 | save(); |
1840 | mView->writeSettings(); | 1842 | mView->writeSettings(); |
1841 | } | 1843 | } |
1842 | void MainWindow::slotModifiedChanged( bool changed ) | 1844 | void MainWindow::slotModifiedChanged( bool changed ) |
1843 | { | 1845 | { |
1844 | if ( mBlockAtStartup ) | 1846 | if ( mBlockAtStartup ) |
1845 | return; | 1847 | return; |
1846 | 1848 | ||
1847 | int msec; | 1849 | int msec; |
1848 | // we store the changes after 1 minute, | 1850 | // we store the changes after 1 minute, |
1849 | // and for safety reasons after 10 minutes again | 1851 | // and for safety reasons after 10 minutes again |
1850 | if ( !mSyncManager->blockSave() ) | 1852 | if ( !mSyncManager->blockSave() ) |
1851 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1853 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1852 | else | 1854 | else |
1853 | msec = 1000 * 600; | 1855 | msec = 1000 * 600; |
1854 | mSaveTimer.start( msec, true ); // 1 minute | 1856 | mSaveTimer.start( msec, true ); // 1 minute |
1855 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1857 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1856 | mCalendarModifiedFlag = true; | 1858 | mCalendarModifiedFlag = true; |
1857 | } | 1859 | } |
1858 | void MainWindow::saveStopTimer() | 1860 | void MainWindow::saveStopTimer() |
1859 | { | 1861 | { |
1860 | mSaveTimer.stop(); | 1862 | mSaveTimer.stop(); |
1861 | } | 1863 | } |
1862 | void MainWindow::backupAllFiles() | 1864 | void MainWindow::backupAllFiles() |
1863 | { | 1865 | { |
1864 | QDate reference ( 2000,1,1); | 1866 | QDate reference ( 2000,1,1); |
1865 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1867 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1866 | setCaption(i18n("Creating backup ... please wait ..." )); | 1868 | setCaption(i18n("Creating backup ... please wait ..." )); |
1867 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1869 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1868 | // we need the file path, the backup dir and the number of bups as param | 1870 | // we need the file path, the backup dir and the number of bups as param |
1869 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1871 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1870 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1872 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1871 | bupDir = KGlobalSettings::backupDataDir(); | 1873 | bupDir = KGlobalSettings::backupDataDir(); |
1872 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1874 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1873 | if ( retval == 0 ) { | 1875 | if ( retval == 0 ) { |
1874 | setCaption(i18n("Backup cancelled" )); | 1876 | setCaption(i18n("Backup cancelled" )); |
1875 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1877 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1876 | // retval == 0 : backup skipped for today, try again tomorrow | 1878 | // retval == 0 : backup skipped for today, try again tomorrow |
1877 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1879 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1878 | } else if ( retval == 1 ){ | 1880 | } else if ( retval == 1 ){ |
1879 | qDebug("KO: Backup created."); | 1881 | qDebug("KO: Backup created."); |
1880 | // backup ok | 1882 | // backup ok |
1881 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1883 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1882 | KopiCalendarFile * cal = calendars.first(); | 1884 | KopiCalendarFile * cal = calendars.first(); |
1883 | cal = calendars.next(); | 1885 | cal = calendars.next(); |
1884 | while ( cal ) { | 1886 | while ( cal ) { |
1885 | if ( !cal->mErrorOnLoad ) { | 1887 | if ( !cal->mErrorOnLoad ) { |
1886 | int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1888 | int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1887 | } | 1889 | } |
1888 | cal = calendars.next(); | 1890 | cal = calendars.next(); |
1889 | } | 1891 | } |
1890 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1892 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1891 | setCaption(i18n("Backup succesfully finished" )); | 1893 | setCaption(i18n("Backup succesfully finished" )); |
1892 | } else if ( retval == 2 ){ | 1894 | } else if ( retval == 2 ){ |
1893 | setCaption(i18n("Backup globally disabled" )); | 1895 | setCaption(i18n("Backup globally disabled" )); |
1894 | qDebug("KO: Backup globally cancelled."); | 1896 | qDebug("KO: Backup globally cancelled."); |
1895 | // backup globally cancelled | 1897 | // backup globally cancelled |
1896 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1898 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1897 | } | 1899 | } |
1898 | // retval == 3: do nothing, try again later | 1900 | // retval == 3: do nothing, try again later |
1899 | } | 1901 | } |
1900 | void MainWindow::save() | 1902 | void MainWindow::save() |
1901 | { | 1903 | { |
1904 | if ( mView->viewManager()->journalView() ) | ||
1905 | mView->viewManager()->journalView()->checkModified(); | ||
1902 | if ( !mCalendarModifiedFlag ) { | 1906 | if ( !mCalendarModifiedFlag ) { |
1903 | qDebug("KO: Calendar not modified. Nothing saved."); | 1907 | qDebug("KO: Calendar not modified. Nothing saved."); |
1904 | return; | 1908 | return; |
1905 | } | 1909 | } |
1906 | if ( mSyncManager->blockSave() ) | 1910 | if ( mSyncManager->blockSave() ) |
1907 | return; | 1911 | return; |
1908 | mSyncManager->setBlockSave(true); | 1912 | mSyncManager->setBlockSave(true); |
1909 | if ( mView->checkAllFileVersions() ) { | 1913 | if ( mView->checkAllFileVersions() ) { |
1910 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1914 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1911 | QDate reference ( 2000,1,1); | 1915 | QDate reference ( 2000,1,1); |
1912 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1916 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1913 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1917 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1914 | backupAllFiles(); | 1918 | backupAllFiles(); |
1915 | } | 1919 | } |
1916 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1920 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1917 | } | 1921 | } |
1918 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1922 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1919 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1923 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1920 | qDebug("KO: Start saving data to file!"); | 1924 | qDebug("KO: Start saving data to file!"); |
1921 | mView->saveCalendars(); | 1925 | mView->saveCalendars(); |
1922 | mCalendarModifiedFlag = false; | 1926 | mCalendarModifiedFlag = false; |
1923 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1927 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1924 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1928 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1925 | QString savemes; | 1929 | QString savemes; |
1926 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1930 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1927 | setCaption(savemes); | 1931 | setCaption(savemes); |
1928 | } else | 1932 | } else |
1929 | setCaption(i18n("Saving cancelled!")); | 1933 | setCaption(i18n("Saving cancelled!")); |
1930 | mSyncManager->setBlockSave( false ); | 1934 | mSyncManager->setBlockSave( false ); |
1931 | } | 1935 | } |
1932 | 1936 | ||
1933 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1937 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1934 | { | 1938 | { |
1935 | if ( !e->isAutoRepeat() ) { | 1939 | if ( !e->isAutoRepeat() ) { |
1936 | mFlagKeyPressed = false; | 1940 | mFlagKeyPressed = false; |
1937 | } | 1941 | } |
1938 | } | 1942 | } |
1939 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1943 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1940 | { | 1944 | { |
1941 | qApp->processEvents(); | 1945 | qApp->processEvents(); |
1942 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1946 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1943 | e->ignore(); | 1947 | e->ignore(); |
1944 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1948 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1945 | return; | 1949 | return; |
1946 | } | 1950 | } |
1947 | if (! e->isAutoRepeat() ) | 1951 | if (! e->isAutoRepeat() ) |
1948 | mFlagKeyPressed = true; | 1952 | mFlagKeyPressed = true; |
1949 | KOPrefs *p = KOPrefs::instance(); | 1953 | KOPrefs *p = KOPrefs::instance(); |