summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
authorzecke <zecke>2002-06-17 15:57:13 (UTC)
committer zecke <zecke>2002-06-17 15:57:13 (UTC)
commit97aca0c9f5f483d01c685d0d0f126ca554d3b199 (patch) (side-by-side diff)
tree839929bc17e8e86e1a8d35e2b14e02f6343a8823 /core/pim/datebook/datebook.cpp
parent02e724757f13f40d85136c3a14e0a3788d28236e (diff)
downloadopie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.zip
opie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.tar.gz
opie-97aca0c9f5f483d01c685d0d0f126ca554d3b199.tar.bz2
tboc <tboc@gmx.de> provided a cute patch to show a red time mark
in the current day view
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 2c2965e..c0d45c9 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -125,13 +125,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
a->addTo( sub_bar );
a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
a->addTo( sub_bar );
a->addTo( view );
-
+
a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
a->addTo( sub_bar );
a->addTo( view );
a->setToggleAction( TRUE );
a->setOn( TRUE );
@@ -170,13 +170,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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();
@@ -184,41 +184,41 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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(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");
+ qDebug("olle\n");
#endif
#endif
-
+
qDebug("done t=%d", t.elapsed() );
}
void DateBook::receive( const QCString &msg, const QByteArray &data )
{
@@ -306,13 +306,13 @@ QString DateBook::checkEvent(const Event &e)
return QString::null;
}
QDate DateBook::currentDate()
{
QDate d = QDate::currentDate();
-
+
if ( dayView && views->visibleWidget() == dayView ) {
d = dayView->date();
} else if ( weekView && views->visibleWidget() == weekView ) {
d = weekView->date();
} else if ( weekLstView && views->visibleWidget() == weekLstView ) {
d = weekLstView->date();
@@ -403,13 +403,13 @@ void DateBook::editEvent( const Event &e )
while (editDlg.exec() ) {
Event newEv = entry->event();
newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
QString error = checkEvent(newEv);
if (!error.isNull()) {
if (QMessageBox::warning(this, "error box",
- error, "Fix it", "Continue",
+ error, "Fix it", "Continue",
0, 0, 1) == 0)
continue;
}
db->editEvent(e, newEv);
emit newEvent();
break;
@@ -485,34 +485,34 @@ void DateBook::initWeek()
int yearNumber, totWeeks;
calcWeek( currentDate(), totWeeks, yearNumber, onMonday );
QDate d = QDate( yearNumber, 12, 31 );
calcWeek( d, totWeeks, yearNumber, onMonday );
-
+
while ( totWeeks == 1 ) {
d = d.addDays( -1 );
calcWeek( d, totWeeks, yearNumber, onMonday );
}
if ( totWeeks != weekView->totalWeeks() )
weekView->setTotalWeeks( totWeeks );
}
void DateBook::initWeekLst() {
if ( !weekLstView ) {
- weekLstView = new DateBookWeekLst( ampm, onMonday, db,
+ weekLstView = new DateBookWeekLst( ampm, onMonday, db,
views, "weeklst view" );
views->addWidget( weekLstView, WEEKLST );
-
+
//weekLstView->setStartViewTime( startTime );
connect( weekLstView, SIGNAL( showDate( int, int, int ) ),
this, SLOT( showDay( int, int, int ) ) );
- connect( weekLstView, SIGNAL( addEvent( const QDateTime &,
- const QDateTime &,
+ connect( weekLstView, SIGNAL( addEvent( const QDateTime &,
+ const QDateTime &,
const QString & ) ),
- this, SLOT( slotNewEntry( const QDateTime &,
- const QDateTime &,
+ this, SLOT( slotNewEntry( const QDateTime &,
+ const QDateTime &,
const QString & ) ) );
connect( this, SIGNAL( newEvent() ),
weekLstView, SLOT( redraw() ) );
connect( weekLstView, SIGNAL( editEvent( const Event & ) ),
this, SLOT( editEvent( const Event & ) ) );
}
@@ -537,13 +537,13 @@ void DateBook::loadSettings()
{
Config config( "qpe" );
config.setGroup("Time");
ampm = config.readBoolEntry( "AMPM", TRUE );
onMonday = config.readBoolEntry( "MONDAY" );
}
-
+
{
Config config("DateBook");
config.setGroup("Main");
startTime = config.readNumEntry("startviewtime", 8);
aPreset = config.readBoolEntry("alarmpreset");
presetTime = config.readNumEntry("presettime");
@@ -563,13 +563,13 @@ void DateBook::saveSettings()
void DateBook::newDefaultView(QAction *a) {
int val=DAY;
if (a->text() == "Day") val=DAY;
if (a->text() == "Week") val=WEEK;
if (a->text() == "WeekLst") val=WEEKLST;
if (a->text() == "Month") val=MONTH;
-
+
Config configDB( "DateBook" );
configDB.setGroup( "Main" );
configDB.writeEntry("defaultview",val);
}
void DateBook::appMessage(const QCString& msg, const QByteArray& data)
@@ -685,13 +685,13 @@ void DateBook::flush()
void DateBook::timerEvent( QTimerEvent *e )
{
if ( alarmCounter < 10 ) {
alarmCounter++;
Sound::soundAlarm();
- }
+ }
else
killTimer( e->timerId() );
}
void DateBook::changeClock( bool newClock )
{
@@ -973,17 +973,19 @@ Event DateBookDBHack::eventByUID(int uid) {
QDate start;
QDate end=start.addDays(-1);
QValueList<Event> myEventList=getNonRepeatingEvents(start,end);
QValueList<Event> myRepeatEvents=getRawRepeats();
QValueList<Event>::ConstIterator it;
-
+
for (it = myEventList.begin(); it != myEventList.end(); it++) {
if ((*it).uid() == uid) return *it;
}
for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) {
if ((*it).uid() == uid) return *it;
}
qDebug("Event not found: uid=%d\n", uid);
+ Event ev;
+ return ev; // return at least
}