-rw-r--r-- | core/pim/datebook/datebook.cpp | 4 | ||||
-rw-r--r-- | core/pim/datebook/opie-datebook.control | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 76260e2..c0a744a 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -1,343 +1,343 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** $Id$ ** **********************************************************************/ #define QTOPIA_INTERNAL_FD #include "datebook.h" #include "datebookday.h" #include "datebooksettings.h" #include "datebookweek.h" #include "datebookweeklst.h" #include "dateentryimpl.h" #include <qpe/datebookmonth.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/qpedebug.h> #include <qpe/event.h> #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 ); QPEToolBar *sub_bar = new QPEToolBar(this); QPopupMenu *view = new QPopupMenu( this ); QPopupMenu *settings = new QPopupMenu( this ); mb->insertItem( tr( "View" ), view ); mb->insertItem( tr( "Settings" ), settings ); QActionGroup *g = new QActionGroup( this ); g->setExclusive( TRUE ); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); a->addTo( sub_bar ); - a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); + a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/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 ); dayAction = a; a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); a->addTo( sub_bar ); a->addTo( view ); a->setToggleAction( TRUE ); weekAction = a; - a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); + a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); a->addTo( sub_bar ); a->addTo( view ); a->setToggleAction( TRUE ); weekLstAction = a; a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); a->addTo( sub_bar ); a->addTo( view ); 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(),*/ 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() { } void DateBook::slotSettings() { DateBookSettings frmSettings( ampm, this ); frmSettings.setStartTime( startTime ); frmSettings.setAlarmPreset( aPreset, presetTime ); frmSettings.setJumpToCurTime( bJumpToCurTime ); frmSettings.setRowStyle( rowStyle ); #if defined (Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); #endif if ( frmSettings.exec() ) { aPreset = frmSettings.alarmPreset(); presetTime = frmSettings.presetTime(); startTime = frmSettings.startTime(); bJumpToCurTime = frmSettings.jumpToCurTime(); rowStyle = frmSettings.rowStyle(); if ( dayView ) dayView->setStartViewTime( startTime ); dayView->setJumpToCurTime( bJumpToCurTime ); dayView->setRowStyle( rowStyle ); 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; for(int i = 0; i < 12; i++) { QDateTime next; if (!nextOccurance(previous, current_date.addDays(1), next)) { break; // no more repeats } if(next < previous.end()) { checkFailed = TRUE; break; } current_date = next.date(); } if(checkFailed) return tr("Event duration is potentially longer\n" "than interval between repeats."); 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(); diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control index 9bef119..6cd96ff 100644 --- a/core/pim/datebook/opie-datebook.control +++ b/core/pim/datebook/opie-datebook.control @@ -1,9 +1,9 @@ -Files: bin/datebook apps/Applications/datebook.desktop +Files: bin/datebook apps/Applications/datebook.desktop pics/datebook Priority: optional Section: opie/applications Maintainer: Warwick Allison <warwick@trolltech.com> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) Description: A datebook/appointment manager A datebook/appointment manager for the Opie environment. |