summaryrefslogtreecommitdiff
path: root/core/pim
Side-by-side diff
Diffstat (limited to 'core/pim') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp6
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp7
-rw-r--r--core/pim/datebook/datebookweeklst.cpp41
-rw-r--r--core/pim/datebook/datebookweeklst.h1
-rw-r--r--core/pim/osearch/datebooksearch.cpp2
-rw-r--r--core/pim/osearch/mainwindow.cpp10
-rw-r--r--core/pim/osearch/mainwindow.h14
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp8
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h10
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h7
11 files changed, 69 insertions, 41 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 10a9b59..07d7164 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -183,24 +183,26 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
#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() );
+ connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
+ connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
/*
* 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
@@ -393,24 +395,26 @@ void DateBook::viewWeek() {
void DateBook::viewWeekLst() {
view(WEEKLST,currentDate());
}
void DateBook::viewMonth() {
view(MONTH,currentDate());
}
void DateBook::insertEvent( const Event &e )
{
Event dupEvent=e;
+ if(!dupEvent.isValidUid() ) // tkcRom seems to be different
+ dupEvent.assignUid();
dupEvent.setLocation(defaultLocation);
dupEvent.setCategories(defaultCategories);
db->addEvent(dupEvent);
emit newEvent();
}
void DateBook::duplicateEvent( const Event &e )
{
qWarning("Hmmm...");
// Alot of code duplication, as this is almost like editEvent();
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
@@ -443,24 +447,26 @@ void DateBook::duplicateEvent( const Event &e )
if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0)
continue;
}
/*
* The problem:
* DateBookDB does remove repeating events not by uid but by the time
* the recurrence was created
* so we need to update that time as well
*/
Event::RepeatPattern rp = newEv.repeatPattern();
rp.createTime = ::time( NULL );
newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern...
+ if( newEv.uid() == e.uid() || !newEv.isValidUid() )
+ newEv.assignUid();
db->addEvent(newEv);
emit newEvent();
break;
}
}
void DateBook::editEvent( const Event &e )
{
if (syncing) {
QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
return;
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index 770410e..84b4f1b 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -92,32 +92,33 @@ void DateBookWeekHeader::prevWeek()
void DateBookWeekHeader::setDate( int y, int m, int d )
{
setDate(QDate(y,m,d));
}
void DateBookWeekHeader::setDate(const QDate &d) {
int year,week,dayofweek;
date=d;
dayofweek=d.dayOfWeek();
if(bStartOnMonday)
dayofweek--;
else if( dayofweek == 7 )
- /* we already have the right day -7 would lead to the current week..*/
+ // we already have the right day -7 would lead to the current week..
dayofweek = 0;
date=date.addDays(-dayofweek);
calcWeek(date,week,year,bStartOnMonday);
QDate start=date;
QDate stop=start.addDays(6);
labelDate->setText( QString::number(start.day()) + "." +
- start.monthName(start.month()) + "-" +
+ Calendar::nameOfMonth( start.month()) + "-" +
QString::number(stop.day()) + "." +
- start.monthName(stop.month()) +" ("+
+ Calendar::nameOfMonth( stop.month()) +" ("+
tr("w")+":"+QString::number( week ) +")");
+ date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
emit dateChanged(date);
}
void DateBookWeekHeader::setStartOfWeek( bool onMonday )
{
bStartOnMonday = onMonday;
setDate( date );
}
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index aad1f3a..24fb0ba 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,39 +1,24 @@
#include "datebookweeklst.h"
-#include "datebookweekheaderimpl.h"
#include "datebook.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 <qpe/config.h>
#include <qpe/resource.h>
+#include <qpe/calendar.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 );
forwardweek->setBackgroundMode( PaletteButton );
forwardweek->setPixmap( Resource::loadPixmap("forward") );
forwardmonth->setBackgroundMode( PaletteButton );
@@ -64,28 +49,29 @@ void DateBookWeekLstHeader::setDate(const QDate &d) {
if(bStartOnMonday)
dayofweek--;
else if( dayofweek == 7 )
/* we already have the right day -7 would lead to the same week */
dayofweek = 0;
date=date.addDays(-dayofweek);
calcWeek(date,week,year,bStartOnMonday);
QDate start=date;
QDate stop=start.addDays(6);
labelDate->setText( QString::number(start.day()) + "." +
- start.monthName(start.month()) + "-" +
+ Calendar::nameOfMonth( start.month() ) + "-" +
QString::number(stop.day()) + "." +
- start.monthName(stop.month()) +" ("+
+ Calendar::nameOfMonth( stop.month()) +" ("+
tr("w")+":"+QString::number( week ) +")");
+ date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
emit dateChanged(date);
}
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() ),
@@ -116,25 +102,27 @@ void DateBookWeekLstHeader::prevMonth()
DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
QWidget* parent,
const char* name,
WFlags fl )
: DateBookWeekLstDayHdrBase(parent, name, fl) {
date=d;
static const QString wdays=tr("MTWTFSSM", "Week days");
char day=wdays[d.dayOfWeek()-1];
+ //dont use dayOfWeek() to save space !
label->setText( QString(QObject::tr(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()));
@@ -332,26 +320,41 @@ void DateBookWeekLst::setDate(const QDate &d) {
}
void DateBookWeekLst::setDbl(bool on) {
dbl=on;
redraw();
}
void DateBookWeekLst::redraw() {getEvents();}
QDate DateBookWeekLst::date() {
return bdate;
}
+// return the date at the beginning of the week...
+// copied from DateBookWeek
+QDate DateBookWeekLst::weekDate() const
+{
+ QDate d=bdate;
+
+ // Calculate offset to first day of week.
+ int dayoffset=d.dayOfWeek();
+ if(bStartOnMonday) dayoffset--;
+ else if( dayoffset == 7 )
+ dayoffset = 0;
+
+ return d.addDays(-dayoffset);
+}
+
void DateBookWeekLst::getEvents() {
- QDate start = date();
+ QDate start = weekDate(); //date();
QDate stop = start.addDays(6);
QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
if (view) delete view;
if (dbl) {
QDate start2=start.addDays(7);
stop=start2.addDays(6);
QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
} else {
view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
}
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 0bfbcda..f683ce7 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -111,24 +111,25 @@ class DateBookWeekLst : public QWidget
{
Q_OBJECT
public:
DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
QWidget *parent = 0,
const char *name = 0 );
~DateBookWeekLst();
void setDate( int y, int w );
void setDate(const QDate &d );
int week() const { return _week; };
QDate date();
+ QDate weekDate() const;
public slots:
void redraw();
void dateChanged(QDate &date);
protected slots:
void keyPressEvent(QKeyEvent *);
void setDbl(bool on);
signals:
void showDate(int y, int m, int d);
void addEvent(const QDateTime &start, const QDateTime &stop,
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index be2bf25..5da7ae9 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -67,25 +67,25 @@ int DatebookSearch::search()
void DatebookSearch::insertItem( void *rec )
{
OEvent *ev = (OEvent*)rec;
if ( !actionShowPastEvents->isOn() &&
ev->endDateTime() < QDateTime::currentDateTime() &&
!ev->recurrence().doesRecur()
) return;
if ( !actionSearchInDates->isOn() && (
ev->lastHitField() == Qtopia::StartDateTime ||
ev->lastHitField() == Qtopia::EndDateTime )
) return;
- (void)new EventItem( this, ev );
+ new EventItem( this, ev );
_resultCount++;
}
QPopupMenu* DatebookSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionShowPastEvents->addTo( _popupMenu );
actionSearchInDates->addTo( _popupMenu );
}
return _popupMenu;
}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index aa52061..f768d81 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -73,29 +73,29 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
detailsLayout->addWidget( richEdit );
buttonBox = new QHBox( mainFrame, "Button Box" );
_buttonCount = 0;
mainLayout->addWidget( detailsFrame );
mainLayout->addWidget( buttonBox );
detailsFrame->hide();
buttonBox->hide();
- searches.append( new AppLnkSearch( resultsList, tr("applications") ) );
- searches.append( new DocLnkSearch( resultsList, tr("documents") ) );
- searches.append( new TodoSearch( resultsList, tr("todo") ) );
- searches.append( new DatebookSearch( resultsList, tr("datebook") ) );
- searches.append( new AdressSearch( resultsList, tr("adressbook") ) );
+ searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
+ searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
+ searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
+ searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
+ searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
setCentralWidget( mainFrame );
popupTimer = new QTimer();
searchTimer = new QTimer();
connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
signalMapper = new QSignalMapper( this );
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index 1f5c4bb..75054f0 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -1,53 +1,61 @@
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
-// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
+// (c) 2002-2003 Patrick S. Vogt <tille@handhelds.org>
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
+#include <qdialog.h>
+#include <qaction.h>
#include <qlist.h>
+
#include <qmap.h>
+#include <qtimer.h>
+#include <qpopupmenu.h>
class QAction;
class QPEToolBar;
class QHBox;
class QVBoxLayout;
class QTextView;
class QFrame;
class OListView;
class OListViewItem;
class QListViewItem;
class QPopupMenu;
-class QSignalMapper;
class QTimer;
+
+class QSignalMapper;
+class QButton;
+
class SearchGroup;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~MainWindow();
-
+ static QString appName() { return QString::fromLatin1("osearch"); }
public slots:
void setCurrent(QListViewItem*);
void setSearch( const QString& );
void searchAll();
protected slots:
void slotAction(int);
void showPopup();
void stopTimer( QListViewItem* );
void searchStringChanged();
void optionChanged(int);
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
index b79c679..8863192 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -69,24 +69,30 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char*
SpinBoxClip->setMaxValue( 200 );
QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) );
#endif
// Look ahead settings
QHBox *box3 = new QHBox( this );
QLabel* daysLabel = new QLabel( box3, "" );
daysLabel->setText( tr( "Days look ahead: " ) );
SpinDaysClip = new QSpinBox( box3, "SpinDays" );
SpinDaysClip->setMaxValue( 200 );
QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
+// QHBox *box4 = new QHBox( this );
+
+// QLabel* colorLabel = new QLabel( box4, "" );
+// colorLabel->setText( tr( "To activate settings: Restart application !" ) );
+
+
QHBox *box5 = new QHBox( this );
QLabel* colorLabel2 = new QLabel( box5, "" );
colorLabel2->setText( tr( "Set Headline Color: " ) );
headlineColor = new OColorButton( box5, black , "headlineColor" );
QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
QHBox *box6 = new QHBox( this );
// Entry color settings
QLabel* colorLabel3= new QLabel( box6, "" );
colorLabel3->setText( tr( "Set Entry Color: " ) );
entryColor = new OColorButton( box6, black , "entryColor" );
QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
@@ -95,25 +101,25 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char*
QHBox *box7 = new QHBox( this );
QLabel* colorLabel5 = new QLabel( box7, "" );
colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
SpinUrgentClip->setMaxValue( 200 );
QLabel* colorLabel6 = new QLabel( box7, "" );
colorLabel6->setText( tr( " days: " ) );
urgentColor = new OColorButton( box7, red , "urgentColor" );
QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
- layout->addWidget( b_group );
+ //layout->addWidget( box4 );
layout->addWidget( box1 );
// layout->addWidget( box2 );
layout->addWidget( box3 );
layout->addWidget( box5 );
layout->addWidget( box6 );
layout->addWidget( box7 );
readConfig();
}
void AddressBookPluginConfig::readConfig() {
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index dad09db..d47bc0b 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -107,24 +107,28 @@ void AddressBookPluginWidget::getAddress() {
output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
addressLabel->setText( output );
return;
}
// Define the query for birthdays and start search..
QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
int ammount = 0;
if ( m_showBirthdays ){
qWarning("Searching from now (%s) until %s ! ",
QDate::currentDate().toString().latin1(),
lookAheadDate.toString().latin1() );
+ }
+
+ if ( m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
+
OContact querybirthdays;
querybirthdays.setBirthday( lookAheadDate );
m_list = m_contactdb->queryByExample( querybirthdays,
OContactAccess::DateDiff );
if ( m_list.count() > 0 ){
output = "<font color=" + m_headlineColor + ">"
+ QObject::tr( "Next birthdays in <b> %1 </b> days:" )
.arg( m_daysLookAhead )
+ "</font> <br>";
for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index bc412dd..2d303fc 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -14,47 +14,45 @@
* *
***************************************************************************/
#ifndef DATEBOOK_PLUGIN_CONFIG_H
#define DATEBOOK_PLUGIN_CONFIG_H
#include <qcheckbox.h>
#include <qspinbox.h>
#include <opie/todayconfigwidget.h>
+#include "datebookpluginconfigbase.h"
+
class DatebookPluginConfig : public TodayConfigWidget {
Q_OBJECT
+
public:
DatebookPluginConfig( QWidget *parent, const char *name );
~DatebookPluginConfig();
void writeConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
- QCheckBox* CheckBox2;
- QCheckBox* CheckBox1;
- QCheckBox* CheckBox3;
- QSpinBox* SpinBox1;
- QSpinBox* SpinBox2;
-
+ DatebookPluginConfigBase *m_gui;
// how many lines should be showed in the datebook section
int m_max_lines_meet;
// If location is to be showed too, 1 to activate it.
int m_show_location;
// if notes should be shown
int m_show_notes;
// should only later appointments be shown or all for the current day.
int m_only_later;
int m_more_days;
};
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
index e09251c..54d35cf 100644
--- a/core/pim/today/plugins/todolist/todopluginconfig.h
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -8,48 +8,49 @@
/***************************************************************************
* *
* 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_CONFIG_H
#define TODOLIST_PLUGIN_CONFIG_H
-//#include <qwidget.h>
#include <qspinbox.h>
#include <opie/todayconfigwidget.h>
+#include "todopluginconfigbase.h"
+
class TodolistPluginConfig : public TodayConfigWidget {
Q_OBJECT
public:
TodolistPluginConfig( QWidget *parent, const char *name );
~TodolistPluginConfig();
private:
/**
* if changed then save
*/
bool changed();
void readConfig();
void writeConfig();
- QSpinBox* SpinBox2;
- QSpinBox* SpinBoxClip;
+ TodoPluginConfigBase *m_gui;
+
// how many lines should be showed in the todolist section
int m_max_lines_task;
// clip the lines after X chars
int m_maxCharClip;
};