author | harlekin <harlekin> | 2002-03-22 09:04:05 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-22 09:04:05 (UTC) |
commit | d710cacb0ee021274ed5507a76a3cc0ca9a65a4e (patch) (side-by-side diff) | |
tree | 68ab43f438062e62acf167ebfc086197af656130 | |
parent | 23663a914f1b831134d907dfa9f367381718bdc7 (diff) | |
download | opie-d710cacb0ee021274ed5507a76a3cc0ca9a65a4e.zip opie-d710cacb0ee021274ed5507a76a3cc0ca9a65a4e.tar.gz opie-d710cacb0ee021274ed5507a76a3cc0ca9a65a4e.tar.bz2 |
bugfixes
-rw-r--r-- | core/pim/today/today.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 58ba4f4..aef0a9b 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -62,26 +62,26 @@ int NEW_START=1; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); -#endif -#endif +#endif +#endif setOwnerField(); todo = new ToDoDB; getTodo(); draw(); autoStart(); } /* * Qcop receive method. */ void Today::channelReceived(const QCString &msg, const QByteArray & data) { @@ -137,81 +137,82 @@ void Today::autoStart() { } /* * Repaint method. Reread all fields. */ void Today::draw() { init(); getDates(); getMail(); // if the todolist.xml file was not modified in between, do not parse it. if (checkIfModified()) { + if (todo) delete todo; todo = new ToDoDB; getTodo(); } - + // how often refresh QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); } -/* +/* * Check if the todolist.xml was modified (if there are new entries. * Returns true if it was modified. */ bool Today::checkIfModified() { - + QDir dir; - QString homedir = dir.homeDirPath (); + QString homedir = dir.homeDirPath (); QString time; - + Config cfg("today"); cfg.setGroup("Files"); time = cfg.readEntry("todolisttimestamp", ""); QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); QDateTime fileTime = file.lastModified(); if (time.compare(fileTime.toString()) == 0) { return false; } else { cfg.writeEntry("todolisttimestamp", fileTime.toString() ); - cfg.write(); + cfg.write(); return true; } } /* * Init stuff needed for today. Reads the config file. */ void Today::init() { QDate date = QDate::currentDate(); QString time = (tr( date.toString()) ); - + TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); - + // read config Config cfg("today"); - cfg.setGroup("BaseConfig"); - + cfg.setGroup("BaseConfig"); + // -- config file section -- // how many lines should be showed in the task section MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); // after how many chars should the be cut off on tasks and notes MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); // how many lines should be showed in the datebook section MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); // If location is to be showed too, 1 to activate it. SHOW_LOCATION = cfg.readNumEntry("showlocation",1); - // if notes should be shown + // if notes should be shown SHOW_NOTES = cfg.readNumEntry("shownotes",0); // should only later appointments be shown or all for the current day. ONLY_LATER = cfg.readNumEntry("onlylater",1); db = new DateBookDB; } /* * The method for the configuration dialog. */ void Today::startConfig() { @@ -259,25 +260,25 @@ void Today::startConfig() { cfg.write(); NEW_START=1; draw(); autoStart(); } /* * Get all events that are in the datebook xml file for today */ void Today::getDates() { QDate date = QDate::currentDate(); - + if (AllDateBookEvents) delete AllDateBookEvents; AllDateBookEvents = new QWidget( ); QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); qBubbleSort(list); // printf("Get dates\n"); Config config( "qpe" ); // if 24 h format //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |