summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/config.in2
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.h3
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp3
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h9
5 files changed, 11 insertions, 9 deletions
diff --git a/core/pim/today/plugins/datebook/config.in b/core/pim/today/plugins/datebook/config.in
index 7a14438..413e0b8 100644
--- a/core/pim/today/plugins/datebook/config.in
+++ b/core/pim/today/plugins/datebook/config.in
@@ -1,4 +1,4 @@
config TODAY_DATEBOOK
boolean "datebook"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 && LIBOPIECORE2
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index 9a820f2..f5b0d0a 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -1,121 +1,122 @@
/*
* datebookevent.cpp
*
* copyright : (c) 2002, 2003, 2004 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "datebookevent.h"
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/calendar.h>
#include <opie2/odevice.h>
-using namespace Opie;
+using namespace Opie::Ui;
+using namespace Opie::Core;
DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
QWidget* parent,
bool show_location,
bool show_notes,
bool timeExtraLine,
int maxCharClip,
const char* name,
WFlags fl) :
OClickableLabel(parent,name,fl), event(ev) {
// setAlignment( AlignTop );
QString msg;
Config config( "qpe" );
config.setGroup( "Time" );
// if 24 h format
ampm = config.readBoolEntry( "AMPM", TRUE );
msg += "<B>" + (ev).description() + "</B>";
if ( (ev).event().hasAlarm() ) {
msg += " <b>" + tr("[with alarm]") +"</b>";
}
// include location or not
if ( show_location ) {
msg += "<BR><i>" + (ev).location() + "</i>";
}
QString timeSpacer = " ";
if ( timeExtraLine ) {
timeSpacer = "<br>";
}
if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
&& ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) {
msg += tr ( "All day" );
} else {
// start time of event
// QDate tempDate = (ev).event().start().date();
msg += timeSpacer;
msg += ampmTime( QTime( (ev).event().start().time() ) )
// end time of event
+ "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) );
}
if ( (ev).date() != QDate::currentDate() ) {
msg += differDate( (ev).date() /* tempDate*/ );
}
// include possible note or not
if ( show_notes ) {
msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
}
setText( msg );
connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
}
DateBookEvent::~DateBookEvent() {
}
/**
* AM/PM timestring conversion.
* @param tm the timestring
* @return formatted to am/pm is system is set to it
*/
QString DateBookEvent::ampmTime( QTime tm ) {
QString s;
if( ampm ) {
int hour = tm.hour();
if ( hour == 0 ) {
hour = 12;
}
if ( hour > 12 ) {
hour -= 12;
}
s.sprintf( "%2d:%02d %s", hour, tm.minute(),
(tm.hour() >= 12) ? "PM" : "AM" );
return s;
} else {
s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
return s;
}
}
QString DateBookEvent::differDate( QDate date ) {
// QDate currentDate = QDate::currentDate();
QString returnText = "<font color = #407DD9><b> ";
// int differDate = currentDate.daysTo( date );
// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
// returnText += "" ;
// // not working right for recurring events
// //} else if ( differDate == 1 ) {
// //returnText += tr( "tomorrow" );
// } else {
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h
index e2ee077..973efe4 100644
--- a/core/pim/today/plugins/datebook/datebookevent.h
+++ b/core/pim/today/plugins/datebook/datebookevent.h
@@ -1,56 +1,55 @@
/*
* datebookplugin.h
*
* copyright : (c) 2002, 2003, 2004 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DATEBOOKEVENT_PLUGIN_H
#define DATEBOOKEVENT_PLUGIN_H
#include <opie2/oclickablelabel.h>
#include <qpe/datebookdb.h>
-using namespace Opie;
-class DateBookEvent: public OClickableLabel {
+class DateBookEvent: public Opie::Ui::OClickableLabel {
Q_OBJECT
public:
DateBookEvent( const EffectiveEvent &ev,
QWidget* parent = 0,
bool show_location = 0,
bool show_notes = 0,
bool timeExtraLine = 0,
int maxCharClip = 0,
const char* name = 0,
WFlags fl = 0 );
~DateBookEvent();
signals:
void editEvent( const Event &e );
private slots:
void editEventSlot( const Event &e );
void editMe();
private:
QString ampmTime( QTime );
QString differDate( QDate date );
const EffectiveEvent event;
bool ampm;
};
#endif
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 567c70f..7ce703e 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -1,117 +1,120 @@
/*
* todopluginwidget.cpp
*
* copyright : (c) 2002, 2003 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "todopluginwidget.h"
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
+using namespace Opie::Ui;
+using namespace Opie;
+
TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
: QWidget( parent, name ) {
todo = 0l;
layoutTodo = 0l;
todoLabel = 0l;
if ( todo ) {
delete todo;
}
todo = new OPimTodoAccess();
todo->load();
if ( layoutTodo ) {
delete layoutTodo;
}
layoutTodo = new QVBoxLayout( this );
layoutTodo->setAutoAdd( true );
if ( todoLabel ) {
delete todoLabel;
}
todoLabel = new OClickableLabel( this );
connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
readConfig();
getTodo();
}
TodolistPluginWidget::~TodolistPluginWidget() {
delete todo;
delete todoLabel;
delete layoutTodo;
}
void TodolistPluginWidget::readConfig() {
Config cfg( "todaytodoplugin" );
cfg.setGroup( "config" );
m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
}
void TodolistPluginWidget:: refresh() {
todo->reload();
getTodo();
}
void TodolistPluginWidget::reinitialize() {
readConfig();
todo->reload();
getTodo();
}
/**
* Get the todos
*/
void TodolistPluginWidget::getTodo() {
QString output;
QString tmpout;
int count = 0;
int ammount = 0;
// get overdue todos first
m_list = todo->sorted( true, 3, 2, 1);
for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
QString desc = (*m_it).summary();
if( desc.isEmpty() ) {
desc = (*m_it).description();
}
tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
ammount++ ;
}
}
// get total number of still open todos
m_list = todo->sorted( true, 1, 4, 1);
for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
count +=1;
// not the overdues, we allready got them, and not if we are
// over the maxlines
if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
QString desc = (*m_it).summary();
if( desc.isEmpty() ) {
desc = (*m_it).description();
}
tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>";
ammount++;
}
}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
index a020cf4..86a9f27 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.h
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -1,55 +1,54 @@
/*
* todopluginwidget.h
*
* copyright : (c) 2002, 2003 by Maximilian Reiß
* email : harlekin@handhelds.org
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TODOLIST_PLUGIN_WIDGET_H
#define TODOLIST_PLUGIN_WIDGET_H
#include <qlayout.h>
#include <opie2/otodoaccess.h>
#include <opie2/oclickablelabel.h>
-using namespace Opie;
class TodolistPluginWidget : public QWidget {
Q_OBJECT
public:
TodolistPluginWidget( QWidget *parent, const char *name );
~TodolistPluginWidget();
void refresh();
void reinitialize();
protected slots:
void startTodolist();
private:
- OClickableLabel *todoLabel;
+ Opie::Ui::OClickableLabel *todoLabel;
QVBoxLayout* layoutTodo;
- OPimTodoAccess *todo;
- OPimTodoAccess::List m_list;
- OPimTodoAccess::List::Iterator m_it;
+ Opie::OPimTodoAccess *todo;
+ Opie::OPimTodoAccess::List m_list;
+ Opie::OPimTodoAccess::List::Iterator m_it;
void readConfig();
void getTodo();
int m_maxLinesTask;
int m_maxCharClip;
};
#endif