author | zecke <zecke> | 2002-06-25 18:18:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-25 18:18:59 (UTC) |
commit | bb392a72fd6071e76ca0c103637d6bb9eed59d3a (patch) (side-by-side diff) | |
tree | 8ed133ad55a7809873b5136ca97063be5fc85d8d /core | |
parent | 6812da2105ea8cc3e78b4fb54601e3fd12413ccc (diff) | |
download | opie-bb392a72fd6071e76ca0c103637d6bb9eed59d3a.zip opie-bb392a72fd6071e76ca0c103637d6bb9eed59d3a.tar.gz opie-bb392a72fd6071e76ca0c103637d6bb9eed59d3a.tar.bz2 |
Fixing QPE bugs isn't good for my health.... But I guess
judging of the amount already fixed bugs that there isn't
much to come
-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 @@ -37,76 +37,78 @@ #include <qpe/finddialog.h> #include <qpe/ir.h> #include <qpe/qpemenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/timestring.h> #include <qpe/qpetoolbar.h> #include <qpe/tzselect.h> #include <qpe/xmlreader.h> #include <qaction.h> #include <qcopchannel_qws.h> #include <qdatetime.h> #include <qdialog.h> #include <qfile.h> #include <qlabel.h> #include <qlayout.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qregexp.h> #include <qtextcodec.h> #include <qtextstream.h> +#include <qtimer.h> #include <qtl.h> #include <qwidgetstack.h> #include <qwindowsystem_qws.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #define DAY 1 #define WEEK 2 #define WEEKLST 4 #define MONTH 3 DateBook::DateBook( QWidget *parent, const char *, WFlags f ) : QMainWindow( parent, "datebook", f ), aPreset( FALSE ), presetTime( -1 ), startTime( 8 ), // an acceptable default rowStyle( 0 ), bJumpToCurTime(FALSE), syncing(FALSE), inSearch(FALSE), alarmCounter(0) { + bool needEvilHack= false; // if we need an Evil Hack QTime t; t.start(); db = new DateBookDBHack; qDebug("loading db t=%d", t.elapsed() ); loadSettings(); setCaption( tr("Calendar") ); setIcon( Resource::loadPixmap( "datebook_icon" ) ); setToolBarsMovable( FALSE ); views = new QWidgetStack( this ); setCentralWidget( views ); dayView = 0; weekView = 0; weekLstView = 0; monthView = 0; QPEToolBar *bar = new QPEToolBar( this ); bar->setHorizontalStretchable( TRUE ); QPEMenuBar *mb = new QPEMenuBar( bar ); mb->setMargin( 0 ); @@ -160,87 +162,104 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) a->setToggleAction( TRUE ); monthAction = a; a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); a->addTo( sub_bar ); a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); a->addTo( settings ); QPopupMenu *default_view = new QPopupMenu(this); settings->insertItem( tr( "Default View" ),default_view ); default_view->setCheckable(TRUE); Config config("DateBook"); config.setGroup("Main"); int current=config.readNumEntry("defaultview", DAY); QActionGroup *ag = new QActionGroup(this); a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); if (current==DAY) a->setOn(true), viewDay(); ag->insert(a); a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); - if (current==WEEK) a->setOn(true), viewWeek(); + if (current==WEEK) a->setOn(true), /*viewWeek(),*/ needEvilHack = true; ag->insert(a); a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); if (current==WEEKLST) a->setOn(true), viewWeekLst(); ag->insert(a); a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); if (current==MONTH) a->setOn(true), viewMonth(); ag->insert(a); ag->addTo(default_view); connect(ag, SIGNAL( selected ( QAction * ) ), this, SLOT( newDefaultView(QAction *) ) ); connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); #endif // listen on QPE/System #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); channel = new QCopChannel( "QPE/Datebook", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); qDebug("olle\n"); #endif #endif qDebug("done t=%d", t.elapsed() ); - + + /* + * Here is a problem description: + * When Weekview is the default view + * a DateBookWeekView get's created + * redraw() get's called. So what? + * Remember that we're still in the c'tor + * and no final layout has happened? Ok + * now all Events get arranged. Their x + * position get's determined by a QHeader + * position. But the QHeader isn't layouted or + * at the right position. redraw() is a slot + * so we'll call it then via a singleShot + * from view() + */ + if( needEvilHack ){ + QTimer::singleShot( 500, this, SLOT(viewWeek()) ); + } } void DateBook::receive( const QCString &msg, const QByteArray &data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "timeChange(QString)" ) { // update active view! if ( dayAction->isOn() ) viewDay(); else if ( weekAction->isOn() ) viewWeek(); else if ( monthAction->isOn() ) viewMonth(); } else if (msg == "editEvent(int)") { int uid; stream >> uid; Event e=db->eventByUID(uid); editEvent(e); } } DateBook::~DateBook() { |