-rw-r--r-- | core/pim/datebook/datebook.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 7dd93a6..e10842a 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -55,12 +55,13 @@ | |||
55 | #include <qmessagebox.h> | 55 | #include <qmessagebox.h> |
56 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
57 | #include <qpushbutton.h> | 57 | #include <qpushbutton.h> |
58 | #include <qregexp.h> | 58 | #include <qregexp.h> |
59 | #include <qtextcodec.h> | 59 | #include <qtextcodec.h> |
60 | #include <qtextstream.h> | 60 | #include <qtextstream.h> |
61 | #include <qtimer.h> | ||
61 | #include <qtl.h> | 62 | #include <qtl.h> |
62 | #include <qwidgetstack.h> | 63 | #include <qwidgetstack.h> |
63 | #include <qwindowsystem_qws.h> | 64 | #include <qwindowsystem_qws.h> |
64 | 65 | ||
65 | #include <sys/stat.h> | 66 | #include <sys/stat.h> |
66 | #include <sys/types.h> | 67 | #include <sys/types.h> |
@@ -83,12 +84,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
83 | rowStyle( 0 ), | 84 | rowStyle( 0 ), |
84 | bJumpToCurTime(FALSE), | 85 | bJumpToCurTime(FALSE), |
85 | syncing(FALSE), | 86 | syncing(FALSE), |
86 | inSearch(FALSE), | 87 | inSearch(FALSE), |
87 | alarmCounter(0) | 88 | alarmCounter(0) |
88 | { | 89 | { |
90 | bool needEvilHack= false; // if we need an Evil Hack | ||
89 | QTime t; | 91 | QTime t; |
90 | t.start(); | 92 | t.start(); |
91 | db = new DateBookDBHack; | 93 | db = new DateBookDBHack; |
92 | qDebug("loading db t=%d", t.elapsed() ); | 94 | qDebug("loading db t=%d", t.elapsed() ); |
93 | loadSettings(); | 95 | loadSettings(); |
94 | setCaption( tr("Calendar") ); | 96 | setCaption( tr("Calendar") ); |
@@ -178,13 +180,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
178 | 180 | ||
179 | QActionGroup *ag = new QActionGroup(this); | 181 | QActionGroup *ag = new QActionGroup(this); |
180 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); | 182 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); |
181 | if (current==DAY) a->setOn(true), viewDay(); | 183 | if (current==DAY) a->setOn(true), viewDay(); |
182 | ag->insert(a); | 184 | ag->insert(a); |
183 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); | 185 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); |
184 | if (current==WEEK) a->setOn(true), viewWeek(); | 186 | if (current==WEEK) a->setOn(true), /*viewWeek(),*/ needEvilHack = true; |
185 | ag->insert(a); | 187 | ag->insert(a); |
186 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); | 188 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); |
187 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); | 189 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); |
188 | ag->insert(a); | 190 | ag->insert(a); |
189 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); | 191 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); |
190 | if (current==MONTH) a->setOn(true), viewMonth(); | 192 | if (current==MONTH) a->setOn(true), viewMonth(); |
@@ -216,13 +218,30 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
216 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 218 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
217 | qDebug("olle\n"); | 219 | qDebug("olle\n"); |
218 | #endif | 220 | #endif |
219 | #endif | 221 | #endif |
220 | 222 | ||
221 | qDebug("done t=%d", t.elapsed() ); | 223 | qDebug("done t=%d", t.elapsed() ); |
222 | 224 | ||
225 | /* | ||
226 | * Here is a problem description: | ||
227 | * When Weekview is the default view | ||
228 | * a DateBookWeekView get's created | ||
229 | * redraw() get's called. So what? | ||
230 | * Remember that we're still in the c'tor | ||
231 | * and no final layout has happened? Ok | ||
232 | * now all Events get arranged. Their x | ||
233 | * position get's determined by a QHeader | ||
234 | * position. But the QHeader isn't layouted or | ||
235 | * at the right position. redraw() is a slot | ||
236 | * so we'll call it then via a singleShot | ||
237 | * from view() | ||
238 | */ | ||
239 | if( needEvilHack ){ | ||
240 | QTimer::singleShot( 500, this, SLOT(viewWeek()) ); | ||
241 | } | ||
223 | } | 242 | } |
224 | 243 | ||
225 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 244 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
226 | { | 245 | { |
227 | QDataStream stream( data, IO_ReadOnly ); | 246 | QDataStream stream( data, IO_ReadOnly ); |
228 | if ( msg == "timeChange(QString)" ) { | 247 | if ( msg == "timeChange(QString)" ) { |