summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
authorhakan <hakan>2002-03-26 19:05:31 (UTC)
committer hakan <hakan>2002-03-26 19:05:31 (UTC)
commit78211642003f70797a5faa1767a5ab2f5f83606f (patch) (side-by-side diff)
tree703df6b1f8a98dbd00066ab3c21419b7f97e41b4 /core/pim/datebook/datebook.cpp
parentdbbbe1c0600422e4bd2d6a6aba271476f457ed97 (diff)
downloadopie-78211642003f70797a5faa1767a5ab2f5f83606f.zip
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.gz
opie-78211642003f70797a5faa1767a5ab2f5f83606f.tar.bz2
Added shortcut buttons to set the start time
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 92dbdc8..2deb96f 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -162,115 +162,126 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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();
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&)) );
#endif
#endif
qDebug("done t=%d", t.elapsed() );
}
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)") {
+ /* Not yet working...
+ int uid;
+ stream >> uid;
+ Event e=db->getEvent(uid);
+ editEvent(e);
+ */
+ }
}
DateBook::~DateBook()
{
}
void DateBook::slotSettings()
{
DateBookSettings frmSettings( ampm, this );
frmSettings.setStartTime( startTime );
frmSettings.setAlarmPreset( aPreset, presetTime );
#if defined (Q_WS_QWS) || defined(_WS_QWS_)
frmSettings.showMaximized();
#endif
if ( frmSettings.exec() ) {
aPreset = frmSettings.alarmPreset();
presetTime = frmSettings.presetTime();
startTime = frmSettings.startTime();
if ( dayView )
dayView->setStartViewTime( startTime );
if ( weekView )
weekView->setStartViewTime( startTime );
saveSettings();
// make the change obvious
if ( views->visibleWidget() ) {
if ( views->visibleWidget() == dayView )
dayView->redraw();
else if ( views->visibleWidget() == weekView )
weekView->redraw();
}
}
}
void DateBook::fileNew()
{
slotNewEventFromKey("");
}
QString DateBook::checkEvent(const Event &e)
{
/* check if overlaps with itself */
bool checkFailed = FALSE;
/* check the next 12 repeats. should catch most problems */
QDate current_date = e.start().date();
Event previous = e;