summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp18
-rw-r--r--core/pim/datebook/datebookweeklst.h8
2 files changed, 13 insertions, 13 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index e8e12ba..5334a16 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -116,49 +116,49 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
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,"");
+ emit addEvent(start,stop,"",0);
}
DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
QWidget* parent,
const char* name,
WFlags fl) :
OClickableLabel(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 {
if(ev.event().type() == Event::Normal )
sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
else
sprintf(s," ");
}
setText(QString(s) + " " + ev.description());
connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
@@ -179,102 +179,102 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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 &)),
+ const QString &, const QString &)),
this, SIGNAL(addEvent(const QDateTime &,
const QDateTime &,
- const QString &)));
+ const QString &, const QString &)));
layout->addWidget(hdr);
// Events
while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) { // Skip effective events with no duration. (i.e ending at 00:00)
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();}
DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
QValueList<EffectiveEvent> &ev2,
QDate &d, bool onM,
QWidget* parent,
const char* name, WFlags fl)
: QWidget( parent, name, fl )
{
QHBoxLayout *layout = new QHBoxLayout( this );
DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
layout->addWidget(w);
connect (w, SIGNAL(editEvent(const Event &)),
this, SIGNAL(editEvent(const Event &)));
connect (w, SIGNAL(showDate(int,int,int)),
this, SIGNAL(showDate(int,int,int)));
connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &)),
+ const QString &,const QString &)),
this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &)));
+ const QString &, const QString &)));
w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
layout->addWidget(w);
connect (w, SIGNAL(editEvent(const Event &)),
this, SIGNAL(editEvent(const Event &)));
connect (w, SIGNAL(showDate(int,int,int)),
this, SIGNAL(showDate(int,int,int)));
connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &)),
+ const QString &, const QString &)),
this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &)));
+ const QString &, const QString &)));
}
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)));
connect(header, SIGNAL(setDbl(bool)),
this, SLOT(setDbl(bool)));
scroll=new QScrollView(this);
//scroll->setVScrollBarMode(QScrollView::AlwaysOn);
@@ -320,51 +320,51 @@ QDate DateBookWeekLst::date() const {
return d;
}
void DateBookWeekLst::getEvents() {
QDate start = 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,onMonday,scroll);
} else {
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 &)),
+ const QString &, const QString &)),
this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &)));
+ const QString &, 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;
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 24f6c83..ea88f20 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -29,123 +29,123 @@ public slots:
void prevWeek();
void pickDate();
void setDate(int y, int m, int d);
signals:
void dateChanged(int y, int w);
void setDbl(bool on);
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);
+ const QString &str, const QString &location);
private:
QDate date;
};
class DateBookWeekLstEvent: public OClickableLabel
{
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, const 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);
+ const QString &str, const QString &location);
private:
bool onMonday;
protected slots:
void keyPressEvent(QKeyEvent *);
};
class DateBookWeekLstDblView: public QWidget {
Q_OBJECT
public:
DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
QValueList<EffectiveEvent> &ev2,
QDate &d, bool onM,
QWidget* parent = 0, const char* name = 0,
WFlags fl = 0 );
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);
+ const QString &str, const QString &location);
};
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() const;
public slots:
void redraw();
void dateChanged(int y, int w);
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,
- const QString &str);
+ const QString &str, const QString &location);
void editEvent(const Event &e);
private:
DateBookDB *db;
int startTime;
bool ampm;
bool onMonday;
bool dbl;
int year, _week;
DateBookWeekLstHeader *header;
QWidget *view;
QVBoxLayout *layout;
QScrollView *scroll;
void getEvents();
};
#endif