summaryrefslogtreecommitdiff
path: root/core
authorhakan <hakan>2002-03-09 11:39:21 (UTC)
committer hakan <hakan>2002-03-09 11:39:21 (UTC)
commit603e969bb8cef91534a1785e27106ba71eb03ba6 (patch) (side-by-side diff)
tree20642ed29acb08ab0cecc1dffd1d63baa8914ae2 /core
parent3d03d0e3f679578080bbbf7d8b7f9eba1b9560db (diff)
downloadopie-603e969bb8cef91534a1785e27106ba71eb03ba6.zip
opie-603e969bb8cef91534a1785e27106ba71eb03ba6.tar.gz
opie-603e969bb8cef91534a1785e27106ba71eb03ba6.tar.bz2
Added a WeekLst view showing an entire week and appointment descriptions and made default view configurable
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/clickablelabel.cpp31
-rw-r--r--core/pim/datebook/clickablelabel.h20
-rw-r--r--core/pim/datebook/datebook.cpp122
-rw-r--r--core/pim/datebook/datebook.h8
-rw-r--r--core/pim/datebook/datebook.pro38
-rw-r--r--core/pim/datebook/datebookweeklst.cpp314
-rw-r--r--core/pim/datebook/datebookweeklst.h131
-rw-r--r--core/pim/datebook/datebookweeklstdayhdr.ui149
-rw-r--r--core/pim/datebook/datebookweeklstheader.ui238
-rw-r--r--core/pim/datebook/dateentry.ui4
-rw-r--r--core/pim/datebook/dateentryimpl.cpp8
11 files changed, 1028 insertions, 35 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp
new file mode 100644
index 0000000..6912c34
--- a/dev/null
+++ b/core/pim/datebook/clickablelabel.cpp
@@ -0,0 +1,31 @@
+#include "clickablelabel.h"
+
+ClickableLabel::ClickableLabel(QWidget* parent = 0,
+ const char* name = 0,
+ WFlags fl = 0) :
+ QLabel(parent,name,fl)
+{
+ setFrameShape(NoFrame);
+ setFrameShadow(Sunken);
+}
+
+void ClickableLabel::mousePressEvent( QMouseEvent *e ) {
+ setFrameShape(Panel);
+ repaint();
+}
+
+void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) {
+ setFrameShape(NoFrame);
+ repaint();
+ if (rect().contains(e->pos())) {
+ emit clicked();
+ }
+}
+
+void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) {
+ if (rect().contains(e->pos())) {
+ setFrameShape(Panel);
+ } else {
+ setFrameShape(NoFrame);
+ }
+}
diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h
new file mode 100644
index 0000000..b6d33ad
--- a/dev/null
+++ b/core/pim/datebook/clickablelabel.h
@@ -0,0 +1,20 @@
+#ifndef CLICKABLELABEL
+#define CLICKABLELABEL
+
+#include <qlabel.h>
+
+class ClickableLabel: public QLabel
+{
+ Q_OBJECT
+public:
+ ClickableLabel(QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0);
+ protected:
+ void mousePressEvent( QMouseEvent *e );
+ void mouseReleaseEvent( QMouseEvent *e );
+ void mouseMoveEvent( QMouseEvent *e );
+ signals:
+ void clicked();
+};
+
+#endif
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index e8d808f..9880e2d 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -5,194 +5,233 @@
**
** 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 <qtextcodec.h>
#include <qtextstream.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
syncing(FALSE),
inSearch(FALSE)
{
QTime t;
t.start();
db = new DateBookDB;
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 );
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 );
+ 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 );
- views = new QWidgetStack( this );
- setCentralWidget( views );
-
- dayView = 0;
- weekView = 0;
- monthView = 0;
+ QPopupMenu *default_view = new QPopupMenu(this);
+ settings->insertItem( tr( "Default View" ),default_view );
+ default_view->setCheckable(TRUE);
- viewDay();
+
+ 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&)) );
+ 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();
}
}
DateBook::~DateBook()
{
}
void DateBook::slotSettings()
{
@@ -243,116 +282,128 @@ QString DateBook::checkEvent(const Event &e)
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();
+ } else if ( weekLstView && views->visibleWidget() == weekLstView ) {
+ d = weekLstView->date();
} else if ( monthView && views->visibleWidget() == monthView ) {
d = monthView->selectedDate();
}
return d;
}
void DateBook::viewDay()
{
initDay();
dayAction->setOn( TRUE );
QDate d = currentDate();
dayView->setDate( d );
views->raiseWidget( dayView );
dayView->redraw();
}
void DateBook::viewWeek()
{
initWeek();
weekAction->setOn( TRUE );
QDate d = currentDate();
weekView->setDate( d );
views->raiseWidget( weekView );
weekView->redraw();
}
+void DateBook::viewWeekLst() {
+ initWeekLst();
+ weekLstAction->setOn( TRUE );
+ QDate d=currentDate();
+ weekLstView->setDate(d);
+ views->raiseWidget( weekLstView );
+ weekLstView->redraw();
+}
+
void DateBook::viewMonth()
{
initMonth();
monthAction->setOn( TRUE );
QDate d = currentDate();
monthView->setDate( d.year(), d.month(), d.day() );
views->raiseWidget( monthView );
monthView->redraw();
}
void DateBook::editEvent( const Event &e )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"),
tr( "Can not edit data, currently syncing") );
return;
}
// workaround added for text input.
QDialog editDlg( this, 0, TRUE );
DateEntry *entry;
editDlg.setCaption( tr("Edit Event") );
QVBoxLayout *vb = new QVBoxLayout( &editDlg );
QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
sv->setResizePolicy( QScrollView::AutoOneFit );
// KLUDGE!!!
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
entry->timezone->setEnabled( FALSE );
sv->addChild( entry );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
editDlg.showMaximized();
#endif
while (editDlg.exec() ) {
Event newEv = entry->event();
QString error = checkEvent(newEv);
if (!error.isNull()) {
if (QMessageBox::warning(this, "error box",
- error, "Fix it", "Continue", 0, 0, 1) == 0)
+ error, "Fix it", "Continue",
+ 0, 0, 1) == 0)
continue;
}
db->editEvent(e, newEv);
emit newEvent();
break;
}
}
void DateBook::removeEvent( const Event &e )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"),
tr( "Can not edit data, currently syncing") );
return;
}
QString strName = e.description();
if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
return;
db->removeEvent( e );
if ( views->visibleWidget() == dayView && dayView )
dayView->redraw();
@@ -380,111 +431,145 @@ void DateBook::initDay()
views->addWidget( dayView, DAY );
dayView->setStartViewTime( startTime );
connect( this, SIGNAL( newEvent() ),
dayView, SLOT( redraw() ) );
connect( dayView, SIGNAL( newEvent() ),
this, SLOT( fileNew() ) );
connect( dayView, SIGNAL( removeEvent( const Event & ) ),
this, SLOT( removeEvent( const Event & ) ) );
connect( dayView, SIGNAL( editEvent( const Event & ) ),
this, SLOT( editEvent( const Event & ) ) );
connect( dayView, SIGNAL( beamEvent( const Event & ) ),
this, SLOT( beamEvent( const Event & ) ) );
connect( dayView, SIGNAL(sigNewEvent(const QString &)),
this, SLOT(slotNewEventFromKey(const QString &)) );
}
}
void DateBook::initWeek()
{
if ( !weekView ) {
weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
weekView->setStartViewTime( startTime );
views->addWidget( weekView, WEEK );
connect( weekView, SIGNAL( showDate( int, int, int ) ),
- this, SLOT( showDay( int, int, int ) ) );
+ this, SLOT( showDay( int, int, int ) ) );
connect( this, SIGNAL( newEvent() ),
weekView, SLOT( redraw() ) );
}
//But also get it right: the year that we display can be different
//from the year of the current date. So, first find the year
//number of the current week.
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,
+ 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 &,
+ const QString & ) ),
+ 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 & ) ) );
+ }
+}
+
void DateBook::initMonth()
{
if ( !monthView ) {
monthView = new DateBookMonth( views, "month view", FALSE, db );
views->addWidget( monthView, MONTH );
connect( monthView, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( showDay( int, int, int ) ) );
connect( this, SIGNAL( newEvent() ),
monthView, SLOT( redraw() ) );
qApp->processEvents();
}
}
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");
}
}
void DateBook::saveSettings()
{
Config config( "qpe" );
Config configDB( "DateBook" );
configDB.setGroup( "Main" );
configDB.writeEntry("startviewtime",startTime);
configDB.writeEntry("alarmpreset",aPreset);
configDB.writeEntry("presettime",presetTime);
}
+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)
{
bool needShow = FALSE;
if ( msg == "alarm(QDateTime,int)" ) {
QDataStream ds(data,IO_ReadOnly);
QDateTime when; int warn;
ds >> when >> warn;
// check to make it's okay to continue,
// this is the case that the time was set ahead, and
// we are forced given a stale alarm...
QDateTime current = QDateTime::currentDateTime();
if ( current.time().hour() != when.time().hour()
&& current.time().minute() != when.time().minute() )
return;
QValueList<EffectiveEvent> list = db->getEffectiveEvents(when.addSecs(warn*60));
if ( list.count() > 0 ) {
QString msg;
bool bSound = FALSE;
int stopTimer = 0;
bool found = FALSE;
for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
it!=list.end(); ++it ) {
@@ -515,48 +600,50 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data)
QScrollView *view = new QScrollView( &dlg, "scrollView");
view->setResizePolicy( QScrollView::AutoOneFit );
vb->addWidget( view );
QLabel *lblMsg = new QLabel( msg, &dlg );
view->addChild( lblMsg );
QPushButton *cmdOk = new QPushButton( tr("OK"), &dlg );
connect( cmdOk, SIGNAL(clicked()), &dlg, SLOT(accept()) );
vb->addWidget( cmdOk );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
dlg.showMaximized();
#endif
needShow = dlg.exec();
if ( bSound )
killTimer( stopTimer );
}
}
} else if ( msg == "nextView()" ) {
QWidget* cur = views->visibleWidget();
if ( cur ) {
if ( cur == dayView )
viewWeek();
else if ( cur == weekView )
+ viewWeekLst();
+ else if ( cur == weekLstView )
viewMonth();
else if ( cur == monthView )
viewDay();
needShow = TRUE;
}
}
if ( needShow ) {
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
showMaximized();
#else
show();
#endif
raise();
QPEApplication::setKeepRunning();
setActiveWindow();
}
}
void DateBook::reload()
{
db->reload();
if ( dayAction->isOn() )
viewDay();
else if ( weekAction->isOn() )
@@ -569,48 +656,49 @@ void DateBook::reload()
void DateBook::flush()
{
syncing = TRUE;
db->save();
}
void DateBook::timerEvent( QTimerEvent *e )
{
static int stop = 0;
if ( stop < 10 ) {
Sound::soundAlarm();
stop++;
} else {
stop = 0;
killTimer( e->timerId() );
}
}
void DateBook::changeClock( bool newClock )
{
ampm = newClock;
// repaint the affected objects...
if (dayView) dayView->redraw();
if (weekView) weekView->redraw();
+ if (weekLstView) weekLstView->redraw();
}
void DateBook::changeWeek( bool m )
{
/* no need to redraw, each widget catches. Do need to
store though for widgets we haven't made yet */
onMonday = m;
}
void DateBook::slotToday()
{
// we need to view today
QDate dt = QDate::currentDate();
showDay( dt.year(), dt.month(), dt.day() );
}
void DateBook::closeEvent( QCloseEvent *e )
{
if(syncing) {
/* no need to save, did that at flush */
e->accept();
return;
}
@@ -639,49 +727,51 @@ void DateBook::slotNewEventFromKey( const QString &str )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"),
tr( "Can not edit data, currently syncing") );
return;
}
// We get to here from a key pressed in the Day View
// So we can assume some things. We want the string
// passed in to be part of the description.
QDateTime start, end;
if ( views->visibleWidget() == dayView ) {
dayView->selectedDates( start, end );
} else if ( views->visibleWidget() == monthView ) {
QDate d = monthView->selectedDate();
start = end = d;
start.setTime( QTime( 10, 0 ) );
end.setTime( QTime( 12, 0 ) );
} else if ( views->visibleWidget() == weekView ) {
QDate d = weekView->date();
start = end = d;
start.setTime( QTime( 10, 0 ) );
end.setTime( QTime( 12, 0 ) );
}
-
+ slotNewEntry(start, end, str);
+}
+void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) {
// argh! This really needs to be encapsulated in a class
// or function.
QDialog newDlg( this, 0, TRUE );
newDlg.setCaption( DateEntryBase::tr("New Event") );
DateEntry *e;
QVBoxLayout *vb = new QVBoxLayout( &newDlg );
QScrollView *sv = new QScrollView( &newDlg );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
Event ev;
ev.setDescription( str );
// When the new gui comes in, change this...
ev.setLocation( tr("(Unknown)") );
ev.setStart( start );
ev.setEnd( end );
e = new DateEntry( onMonday, ev, ampm, &newDlg );
e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
sv->addChild( e );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
newDlg.showMaximized();
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index 44627bb..fcdbfec 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -7,105 +7,111 @@
** 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.
**
**********************************************************************/
#ifndef DATEBOOK_H
#define DATEBOOK_H
#include <qpe/datebookdb.h>
#include <qmainwindow.h>
class QAction;
class QWidgetStack;
class DateBookDay;
class DateBookWeek;
+class DateBookWeekLst;
class DateBookMonth;
class Event;
class QDate;
class Ir;
class DateBook : public QMainWindow
{
Q_OBJECT
public:
DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~DateBook();
signals:
void newEvent();
void signalNotFound();
void signalWrapAround();
protected:
QDate currentDate();
void timerEvent( QTimerEvent *e );
void closeEvent( QCloseEvent *e );
public slots:
void flush();
void reload();
private slots:
void fileNew();
+ void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str);
void slotSettings();
+ void newDefaultView(QAction *a);
void slotToday(); // view today
void changeClock( bool newClock );
void changeWeek( bool newDay );
void appMessage(const QCString& msg, const QByteArray& data);
// handle key events in the day view...
void slotNewEventFromKey( const QString &str );
void slotFind();
void slotDoFind( const QString &, const QDate &, bool, bool, int );
void viewDay();
void viewWeek();
+ void viewWeekLst();
void viewMonth();
void showDay( int y, int m, int d );
void editEvent( const Event &e );
void removeEvent( const Event &e );
void receive( const QCString &msg, const QByteArray &data );
void setDocument( const QString & );
void beamEvent( const Event &e );
void beamDone( Ir *ir );
private:
void addEvent( const Event &e );
void initDay();
void initWeek();
+ void initWeekLst();
void initMonth();
void loadSettings();
void saveSettings();
private:
DateBookDB *db;
QWidgetStack *views;
DateBookDay *dayView;
DateBookWeek *weekView;
DateBookMonth *monthView;
- QAction *dayAction, *weekAction, *monthAction;
+ DateBookWeekLst *weekLstView;
+ QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
bool aPreset; // have everything set to alarm?
int presetTime; // the standard time for the alarm
int startTime;
bool ampm;
bool onMonday;
bool syncing;
bool inSearch;
QString checkEvent(const Event &);
};
#endif
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index fae5d2b..bbe07af 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,36 +1,42 @@
TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = datebookday.h \
- datebook.h \
- dateentryimpl.h \
- datebookdayheaderimpl.h \
- datebooksettings.h \
- datebookweek.h \
- datebookweekheaderimpl.h \
- repeatentry.h
+ datebook.h \
+ dateentryimpl.h \
+ datebookdayheaderimpl.h \
+ datebooksettings.h \
+ datebookweek.h \
+ datebookweeklst.h \
+ datebookweekheaderimpl.h \
+ repeatentry.h \
+ clickablelabel.h
SOURCES = main.cpp \
- datebookday.cpp \
- datebook.cpp \
- dateentryimpl.cpp \
- datebookdayheaderimpl.cpp \
- datebooksettings.cpp \
- datebookweek.cpp \
- datebookweekheaderimpl.cpp \
- repeatentry.cpp
+ datebookday.cpp \
+ datebook.cpp \
+ dateentryimpl.cpp \
+ datebookdayheaderimpl.cpp \
+ datebooksettings.cpp \
+ datebookweek.cpp \
+ datebookweeklst.cpp \
+ datebookweekheaderimpl.cpp \
+ repeatentry.cpp \
+ clickablelabel.cpp
INTERFACES = dateentry.ui \
datebookdayheader.ui \
datebooksettingsbase.ui \
datebookweekheader.ui \
- repeatentrybase.ui
+ datebookweeklstheader.ui \
+ datebookweeklstdayhdr.ui \
+ repeatentrybase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
TARGET = datebook
TRANSLATIONS = ../i18n/de/datebook.ts
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
new file mode 100644
index 0000000..05e36be
--- a/dev/null
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -0,0 +1,314 @@
+#include "datebookweeklst.h"
+
+#include "datebookweekheaderimpl.h"
+
+#include <qpe/calendar.h>
+#include <qpe/datebookdb.h>
+#include <qpe/event.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/timestring.h>
+#include <qpe/datebookmonth.h>
+
+#include <qdatetime.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qpopupmenu.h>
+#include <qtimer.h>
+#include <qstyle.h>
+#include <qtoolbutton.h>
+#include <qvbox.h>
+#include <qsizepolicy.h>
+#include <qabstractlayout.h>
+#include <qtl.h>
+
+bool calcWeek(const QDate &d, int &week, int &year,
+ bool startOnMonday = false);
+
+DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
+ const char* name, WFlags fl)
+ : DateBookWeekLstHeaderBase(parent, name, fl)
+{
+ setBackgroundMode( PaletteButton );
+ labelDate->setBackgroundMode( PaletteButton );
+ labelWeek->setBackgroundMode( PaletteButton );
+ forward->setBackgroundMode( PaletteButton );
+ back->setBackgroundMode( PaletteButton );
+ DateBookWeekLstHeaderBaseLayout->setSpacing(0);
+ DateBookWeekLstHeaderBaseLayout->setMargin(0);
+ //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
+ setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
+
+ connect(back, SIGNAL(clicked()), this, SLOT(prevWeek()));
+ connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek()));
+ connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate()));
+ onMonday=onM;
+}
+DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
+void DateBookWeekLstHeader::setDate(QDate d) {
+ date=d;
+
+ int year,week;
+ calcWeek(d,week,year,onMonday);
+ labelWeek->setText("W: " + QString::number(week));
+
+ QDate start=date;
+ QDate stop=start.addDays(6);
+ labelDate->setText( QString::number(start.day()) + " " +
+ start.monthName(start.month()) + " - " +
+ QString::number(stop.day()) + " " +
+ start.monthName(stop.month()) );
+ emit dateChanged(year,week);
+}
+void DateBookWeekLstHeader::pickDate() {
+ static QPopupMenu *m1 = 0;
+ static DateBookMonth *picker = 0;
+ if ( !m1 ) {
+ m1 = new QPopupMenu( this );
+ picker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( picker );
+ connect( picker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( setDate( int, int, int ) ) );
+ //connect( m1, SIGNAL( aboutToHide() ),
+ //this, SLOT( gotHide() ) );
+ }
+ picker->setDate( date.year(), date.month(), date.day() );
+ m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height())));
+ picker->setFocus();
+}
+void DateBookWeekLstHeader::setDate(int y, int m, int d) {
+ QDate new_date(y,m,d);
+ setDate(new_date);
+}
+
+void DateBookWeekLstHeader::nextWeek() {
+ setDate(date.addDays(7));
+}
+void DateBookWeekLstHeader::prevWeek() {
+ setDate(date.addDays(-7));
+}
+
+DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM,
+ QWidget* parent = 0,
+ const char* name = 0,
+ WFlags fl = 0 )
+ : DateBookWeekLstDayHdrBase(parent, name, fl) {
+
+ date=d;
+
+ static const char *wdays="MTWTFSS";
+ char day=wdays[d.dayOfWeek()-1];
+
+ label->setText( QString(QChar(day)) + " " +
+ QString::number(d.day()) );
+ add->setText("+");
+
+ if (d == QDate::currentDate()) {
+ QPalette pal=label->palette();
+ pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
+ label->setPalette(pal);
+
+ /*
+ QFont f=label->font();
+ f.setItalic(true);
+ label->setFont(f);
+ label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
+ */
+ } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
+ QPalette pal=label->palette();
+ pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
+ label->setPalette(pal);
+ }
+
+
+ connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
+ connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
+}
+
+void DateBookWeekLstDayHdr::showDay() {
+ emit showDate(date.year(), date.month(), date.day());
+}
+void DateBookWeekLstDayHdr::newEvent() {
+ QDateTime start, stop;
+ start=stop=date;
+ start.setTime(QTime(10,0));
+ stop.setTime(QTime(12,0));
+
+ emit addEvent(start,stop,"");
+}
+DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
+ QWidget* parent = 0,
+ const char* name = 0,
+ WFlags fl = 0) :
+ ClickableLabel(parent,name,fl),
+ event(ev)
+{
+ char s[10];
+ if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
+ if ( ev.endDate() == ev.date() ) { // last day
+ strcpy(s, "__|__");
+ } else {
+ strcpy(s, " |---");
+ }
+ } else {
+ sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ }
+ setText(QString(s) + " " + ev.description());
+ connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
+}
+void DateBookWeekLstEvent::editMe() {
+ emit editEvent(event.event());
+}
+
+
+DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
+ QDate &d, bool onM,
+ QWidget* parent,
+ const char* name, WFlags fl)
+ : QWidget( parent, name, fl )
+{
+ onMonday=onM;
+ setPalette(white);
+ setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
+
+ QVBoxLayout *layout = new QVBoxLayout( this );
+
+ qBubbleSort(ev);
+ QValueListIterator<EffectiveEvent> it;
+ it=ev.begin();
+
+ int dayOrder[7];
+ if (onMonday)
+ for (int d=0; d<7; d++) dayOrder[d]=d+1;
+ else {
+ for (int d=0; d<7; d++) dayOrder[d]=d;
+ dayOrder[0]=7;
+ }
+
+ for (int i=0; i<7; i++) {
+ // Header
+ DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
+ onMonday,this);
+ connect(hdr, SIGNAL(showDate(int,int,int)),
+ this, SIGNAL(showDate(int,int,int)));
+ connect(hdr, SIGNAL(addEvent(const QDateTime &,
+ const QDateTime &,
+ const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &,
+ const QDateTime &,
+ const QString &)));
+ layout->addWidget(hdr);
+
+ // Events
+ while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
+ DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
+ layout->addWidget(l);
+ connect (l, SIGNAL(editEvent(const Event &)),
+ this, SIGNAL(editEvent(const Event &)));
+ it++;
+ }
+
+ layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ }
+}
+DateBookWeekLstView::~DateBookWeekLstView(){}
+void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
+
+DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
+ QWidget *parent,
+ const char *name )
+ : QWidget( parent, name ),
+ db( newDB ),
+ startTime( 0 ),
+ ampm( ap ),
+ onMonday(onM)
+{
+ setFocusPolicy(StrongFocus);
+ layout = new QVBoxLayout( this );
+ layout->setMargin(0);
+
+ header=new DateBookWeekLstHeader(onM, this);
+ layout->addWidget( header );
+ connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int)));
+
+ scroll=new QScrollView(this);
+ //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
+ //scroll->setHScrollBarMode(QScrollView::AlwaysOff);
+ scroll->setResizePolicy(QScrollView::AutoOneFit);
+ layout->addWidget(scroll);
+
+ view=NULL;
+}
+
+
+void DateBookWeekLst::setDate( QDate &d ) {
+ int w,y;
+ calcWeek(d,w,y,onMonday);
+ year=y;
+ _week=w;
+ header->setDate(date());
+}
+void DateBookWeekLst::redraw() {getEvents();}
+
+QDate DateBookWeekLst::date() const {
+ QDate d;
+ d.setYMD(year,1,1);
+
+ int dow= d.dayOfWeek();
+ if (!onMonday)
+ if (dow==7) dow=1;
+ else dow++;
+
+ d=d.addDays( (_week-1)*7 - dow + 1 );
+ return d;
+}
+
+void DateBookWeekLst::getEvents() {
+ QDate start = date();
+ QDate stop = start.addDays(6);
+ QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
+
+ if (view) delete view;
+ view=new DateBookWeekLstView(el,start,onMonday,scroll);
+
+ connect (view, SIGNAL(editEvent(const Event &)),
+ this, SIGNAL(editEvent(const Event &)));
+ connect (view, SIGNAL(showDate(int,int,int)),
+ this, SIGNAL(showDate(int,int,int)));
+ connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
+ const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
+ const QString &)));
+
+ scroll->addChild(view);
+ view->show();
+ scroll->updateScrollBars();
+}
+
+void DateBookWeekLst::dateChanged(int y, int w) {
+ year=y;
+ _week=w;
+ getEvents();
+}
+
+void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
+{
+ switch(e->key()) {
+ case Key_Up:
+ scroll->scrollBy(0, -20);
+ break;
+ case Key_Down:
+ scroll->scrollBy(0, 20);
+ break;
+ case Key_Left:
+ header->prevWeek();
+ break;
+ case Key_Right:
+ header->nextWeek();
+ break;
+ default:
+ e->ignore();
+ }
+}
+
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
new file mode 100644
index 0000000..d2a07cc
--- a/dev/null
+++ b/core/pim/datebook/datebookweeklst.h
@@ -0,0 +1,131 @@
+#ifndef DATEBOOKWEEKLST
+#define DATEBOOKWEEKLST
+
+#include <qwidget.h>
+#include <qdatetime.h>
+#include <qpe/event.h>
+#include <qlabel.h>
+#include <qscrollview.h>
+
+#include "datebookweeklstheader.h"
+#include "datebookweeklstdayhdr.h"
+
+#include "clickablelabel.h"
+
+class QDateTime;
+class DateBookDB;
+
+class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase
+{
+ Q_OBJECT
+public:
+ DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0 );
+ ~DateBookWeekLstHeader();
+ void setDate(QDate d);
+
+public slots:
+ void nextWeek();
+ void prevWeek();
+ void pickDate();
+ void setDate(int y, int m, int d);
+signals:
+ void dateChanged(int y, int w);
+private:
+ QDate date;
+ bool onMonday;
+};
+
+class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
+{
+ Q_OBJECT
+public:
+ DateBookWeekLstDayHdr(const QDate &d, bool onM,
+ QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0 );
+public slots:
+ void showDay();
+ void newEvent();
+signals:
+ void showDate(int y, int m, int d);
+ void addEvent(const QDateTime &start, const QDateTime &stop,
+ const QString &str);
+private:
+ QDate date;
+};
+
+class DateBookWeekLstEvent: public ClickableLabel
+{
+ Q_OBJECT
+public:
+ DateBookWeekLstEvent(const EffectiveEvent &ev,
+ QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0);
+signals:
+ void editEvent(const Event &e);
+private slots:
+ void editMe();
+private:
+ const EffectiveEvent event;
+};
+
+class DateBookWeekLstView: public QWidget
+{
+ Q_OBJECT
+public:
+ DateBookWeekLstView(QValueList<EffectiveEvent> &ev, QDate &d, bool onM,
+ QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0 );
+ ~DateBookWeekLstView();
+signals:
+ void editEvent(const Event &e);
+ void showDate(int y, int m, int d);
+ void addEvent(const QDateTime &start, const QDateTime &stop,
+ const QString &str);
+private:
+ bool onMonday;
+protected slots:
+ void keyPressEvent(QKeyEvent *);
+};
+
+class DateBookWeekLst : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
+ QWidget *parent = 0,
+ const char *name = 0 );
+ void setDate( int y, int w );
+ void setDate( QDate &d );
+ int week() const { return _week; };
+ QDate date() const;
+
+public slots:
+ void redraw();
+ void dateChanged(int y, int w);
+protected slots:
+ void keyPressEvent(QKeyEvent *);
+
+signals:
+ void showDate(int y, int m, int d);
+ void addEvent(const QDateTime &start, const QDateTime &stop,
+ const QString &str);
+ void editEvent(const Event &e);
+
+private:
+ DateBookDB *db;
+ int startTime;
+ bool ampm;
+ bool onMonday;
+ int year, _week;
+ DateBookWeekLstHeader *header;
+ DateBookWeekLstView *view;
+ QVBoxLayout *layout;
+ QScrollView *scroll;
+
+ void getEvents();
+};
+
+#endif
+
diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui
new file mode 100644
index 0000000..3b88495
--- a/dev/null
+++ b/core/pim/datebook/datebookweeklstdayhdr.ui
@@ -0,0 +1,149 @@
+<!DOCTYPE UI><UI>
+<class>DateBookWeekLstDayHdrBase</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateBookWeekLstDayHdrBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>106</y>
+ <width>621</width>
+ <height>5</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form1</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>Line</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Line1</cstring>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget>
+ <class>ClickableLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>label</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ </widget>
+ <widget>
+ <class>Line</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Line1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>minimumSize</name>
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget>
+ <class>ClickableLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>add</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>ClickableLabel</class>
+ <header location="local">clickablelabel.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
+ </image>
+</images>
+</UI>
diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui
new file mode 100644
index 0000000..666e896
--- a/dev/null
+++ b/core/pim/datebook/datebookweeklstheader.ui
@@ -0,0 +1,238 @@
+<!DOCTYPE UI><UI>
+<class>DateBookWeekLstHeaderBase</class>
+<widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>DateBookWeekLstHeaderBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>51</y>
+ <width>535</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Form2</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>back</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image0</pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>labelWeek</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>W: 00,00</string>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>labelDate</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>00 Jan-00 Jan</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forward</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap>image1</pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+</widget>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="582">789c6dcfcd4e843010c0f13b4fd1d01b31bb6cb325211b1f41e3d1c4789876a60bcbd7aeae07637c773b6d5985d870e0f7ef50605b88e7a707516cb3f72b5c5b2b6c036fa2c08f61f87c79bdffcaf2dd5ef0558b5d7e97e51b61c5e33412df4b7f2fcbb09896a94ab557817063cd744cad74a915734aac35308740d018d9332d5ab0c8ec1229f2c2448d156a661b489ee1ab4e4cf2a08a790e24020abb0dd355442eec8e914e45526215790c749e8e89891069125de466b1fe14295705ccaa5863e2d05cc01894925b2a7e8217dd8a631eb169fd509af10fd1a9ebfbdf32008d9d0c07cd274f70ee162773ba2cdfee935c977ffe6b2edf87ec07796f81cd</data>
+ </image>
+ <image>
+ <name>image1</name>
+ <data format="XPM.GZ" length="627">789c7dcfc94ec3301006e07b9ec28a6f114a13cbb1a8108f00e28884387819676993340b07847877329ea8697a60ec83bfdf232f8784bdbfbdb0e4104db39e6bcb6ca54796b8afb6fdfef87cfe89e25cb2650ac1f2f8218a5366d96bdf01aef9b2e65928a4458a0c07b25c29890352e63293e19c53a0968f52230159e8c22981744495133552097554a1f982b4ce6aeb9013d215165c81ec894e109b4070ca85378f2b35f18c04050214b20d04d010762ba457003eecd6442f88f34a45f4817ea147762b35d1acf4c47457d784737d9f18ebee1363614bf852c6f812b6c460f90abb6e93ba694ed7c49fdbaeee2f76b83da71ba772e0db5d9ccf4b07dfdd5e858edd9b2948fff9d796fc3e457f660e8d47</data>
+ </image>
+</images>
+</UI>
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index 0c363a4..eac4e23 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -73,49 +73,49 @@
<name>text</name>
<string>Location</string>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Category</string>
</property>
<property>
<name>buddy</name>
<cstring>comboPriority</cstring>
</property>
</widget>
<widget row="0" column="1" rowspan="1" colspan="3" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
- <string>(None)</string>
+ <string></string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Meeting</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Lunch</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Dinner</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Travel</string>
@@ -140,49 +140,49 @@
<name>currentItem</name>
<number>0</number>
</property>
<property stdset="1">
<name>duplicatesEnabled</name>
<bool>false</bool>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Description:</string>
</property>
</widget>
<widget row="1" column="1" rowspan="1" colspan="3" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
- <string>(Unknown)</string>
+ <string></string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Office</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>Home</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>comboLocation</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 1122f79..b2e3e3a 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -20,65 +20,68 @@
#include "dateentryimpl.h"
#include "repeatentry.h"
#include <qpe/qpeapplication.h>
#include <qpe/categoryselect.h>
#include <qpe/datebookmonth.h>
#include <qpe/global.h>
#include <qpe/timeconversion.h>
#include <qpe/timestring.h>
#include <qpe/tzselect.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpopupmenu.h>
#include <qscrollview.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <stdlib.h>
+#include <stdiostream.h>
+
/*
* Constructs a DateEntry which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
const QDateTime &end, bool whichClock, QWidget* parent,
const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
startWeekOnMonday( startOnMonday )
{
init();
setDates(start,end);
+ setFocusProxy(comboDescription);
}
static void addOrPick( QComboBox* combo, const QString& t )
{
for (int i=0; i<combo->count(); i++) {
if ( combo->text(i) == t ) {
combo->setCurrentItem(i);
return;
}
}
combo->setEditText(t);
}
DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
QWidget* parent, const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
startWeekOnMonday( startOnMonday )
{
init();
setDates(event.start(),event.end());
comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
if(!event.description().isEmpty())
addOrPick( comboDescription, event.description() );
@@ -155,48 +158,49 @@ void DateEntry::init()
this, SLOT( startDateChanged( int, int, int ) ) );
//Let start button change both start and end dates
connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( endDateChanged( int, int, int ) ) );
connect( qApp, SIGNAL( clockChanged( bool ) ),
this, SLOT( slotChangeClock( bool ) ) );
connect( qApp, SIGNAL(weekChanged(bool)),
this, SLOT(slotChangeStartOfWeek(bool)) );
QPopupMenu *m2 = new QPopupMenu( this );
endPicker = new DateBookMonth( m2, 0, TRUE );
m2->insertItem( endPicker );
buttonEnd->setPopup( m2 );
connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( endDateChanged( int, int, int ) ) );
}
/*
* Destroys the object and frees any allocated resources
*/
DateEntry::~DateEntry()
{
// no need to delete child widgets, Qt does it all for us
+ //cout << "Del: " << comboStart->currentText() << endl;
}
/*
* public slot
*/
void DateEntry::endDateChanged( int y, int m, int d )
{
endDate.setYMD( y, m, d );
if ( endDate < startDate ) {
endDate = startDate;
}
buttonEnd->setText( TimeString::shortDate( endDate ) );
endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
}
static QTime parseTime( const QString& s, bool ampm )
{
QTime tmpTime;
QStringList l = QStringList::split( ':', s );
int hour = l[0].toInt();
if ( ampm ) {
int i=0;
@@ -249,48 +253,49 @@ void DateEntry::startDateChanged( int y, int m, int d )
startDate.setYMD( y, m, d );
if ( rp.type == Event::Weekly &&
startDate.dayOfWeek() != prev.dayOfWeek() ) {
// if we change the start of a weekly repeating event
// set the repeating day appropriately
char mask = 1 << (prev.dayOfWeek()-1);
rp.days &= (~mask);
rp.days |= 1 << (startDate.dayOfWeek()-1);
}
buttonStart->setText( TimeString::shortDate( startDate ) );
// our pickers must be reset...
startPicker->setDate( y, m, d );
endPicker->setDate( y, m, d );
}
/*
* public slot
*/
void DateEntry::startTimeChanged( int index )
{
startTime = parseTime(comboStart->text(index),ampm);
changeEndCombo( index );
+ //cout << "Start: " << comboStart->currentText() << endl;
}
/*
* public slot
*/
void DateEntry::typeChanged( const QString &s )
{
bool b = s != "All Day";
buttonStart->setEnabled( b );
comboStart->setEnabled( b );
comboEnd->setEnabled( b );
}
/*
* public slot
*/
void DateEntry::changeEndCombo( int change )
{
if ( change + 2 < comboEnd->count() )
change += 2;
comboEnd->setCurrentItem( change );
endTimeChanged( comboEnd->currentText() );
}
void DateEntry::slotRepeat()
{
@@ -361,48 +366,51 @@ Event DateEntry::event()
// convert to UTC based on selected TZ (calling tzset internally)
start_utc = TimeConversion::toUTC( start );
end_utc = TimeConversion::toUTC( end );
// done playing around... put it all back
unsetenv( "TZ" );
if ( !realTZ.isNull() )
if ( setenv( "TZ", realTZ, true ) != 0 )
qWarning( "There was a problem setting the timezone." );
// convert UTC to local time (calling tzset internally)
ev.setStart( TimeConversion::fromUTC( start_utc ) );
ev.setEnd( TimeConversion::fromUTC( end_utc ) );
// we only have one type of sound at the moment... LOUD!!!
if ( comboSound->currentItem() != 0 )
st = Event::Loud;
else
st = Event::Silent;
ev.setAlarm( checkAlarm->isChecked(), spinAlarm->value(), st );
if ( rp.type != Event::NoRepeat )
ev.setRepeat( TRUE, rp );
ev.setNotes( editNote->text() );
+
+ //cout << "Start: " << comboStart->currentText() << endl;
+
return ev;
}
void DateEntry::setRepeatLabel()
{
switch( rp.type ) {
case Event::Daily:
cmdRepeat->setText( tr("Daily...") );
break;
case Event::Weekly:
cmdRepeat->setText( tr("Weekly...") );
break;
case Event::MonthlyDay:
case Event::MonthlyDate:
cmdRepeat->setText( tr("Monthly...") );
break;
case Event::Yearly:
cmdRepeat->setText( tr("Yearly...") );
break;
default:
cmdRepeat->setText( tr("No Repeat...") );
}
}