summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--libkdepim/kdatepicker.cpp12
-rw-r--r--libkdepim/kdatepicker.h2
3 files changed, 15 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 3d8edfc..62c8447 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,200 +1,202 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.0.8 ************
Fixed a problem in dependency info in the ipk files for the Zaurus.
Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
+Added a "go today" button to the datepicker.
+
********** VERSION 2.0.7 ************
Added global application font settings
(for all KDE-Pim/Pi apps) to the general settings.
Fixed a problem in OM/Pi when trying to login to some IMAP servers
(like the IMAP server of Apple: mail.mac.com )
Added recurring todos to KO/Pi.
********** VERSION 2.0.6 ************
Some bugfixes in the pi-sync mode.
Added German translation for pi-sync mode.
KO/Pi:
Made the todolist using alternate background.
Other minor fixes in KO/Pi.
********** VERSION 2.0.5 ************
Bugfixes in KO/Pi.
********** VERSION 2.0.4 ************
KO/Pi:
Fixed problem loading translations for summary/location edit boxes in event/todo editor.
Added a general "select week number" to the toolbar.
Fixed some small problem of the new features introduced in version 2.0.3.
Made it possible to specify one specific category as category color,
if more than one categories are selected.
Fixed a bug in saving colors for categories with non-ascii characters.
(Like, e.g. German Umlauts).
Propably you have to set your colors again for those categories.
********** VERSION 2.0.3 ************
KO/Pi:
Added feature for changing alarm settings for many items at once:
Open list view (or search dialog), select the desired items and choose in
the popup menu: Set alarm for selected...
Added to the event/todo viewer the option to send an email to
all attendees or all selected (with RSVP) attendees.
Made the week-month mode changing in month view faster.
Made month view better useable with keyboard.
Now TAB key jumps to next cell with an event/todo.
Scroll in cell with coursor keys, scroll in time (next week) with
Shift/Control + coursorkeys.
Fixed bug that the todo view flat mode was reset after first view update.
If a todo is displayed closed in the todo view,
it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
Added info about the numbers of years to the caption (title) information about a birthday event.
Made completion date in todo editor editable.
Added possibility to save/load templates for journals.
(Which is just a simple "save text to file" or "insert text from file".
********** VERSION 2.0.2 ************
KO/Pi:
Fixed the layout problem of the day label buttons
of the agenda view introduced in version 2.0.1.
Added WhatsThis support for the todo view and the list view.
Added a quite useful feature to the montview.
Just click on the week numbers on the left.
And in the top right corner of month view/agenda view
there is now a "week number quick selector".
(Click on the black triangle).
Made the quite difficult timezone change in KO/Pi easy.
OM/Pi:
Fixed too small icons on desktop.
Fixed non visible icons in mainwindow on Z with fastload enabled.
Added signature file setting to smtp account config.
And the signature can be edited and saved in the edit mail dialog.
That does mean:
Simply edit the signature for the selected smtp account in the
edit new mail dialog and press the "save signature" button there.
Then the signature is saved to the file specified in the smtp account settings.
If there is no file specified, it is saved automatically to the file
kdepim/apps/kopiemail/<accountname>.sig.
********** VERSION 2.0.1 ************
Oooops ... I forgot to test on the Zaurus 5500 ...
Fixed many problems of new (english) strings (and german translations)
introduced in the latest versions, where the text was not fitting on the
240x320 display of the Zaurus 5500.
KO/Pi:
Added a popup menu ( press pen and hold to get popup ) to the agenda view
with many useful items (add event/todo, show next week, two weeks, month, journal).
Added items to the todolist popup menu for:
Display all opened, all closed or all todos flat.
The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
Made the reparenting of todos on the desktop possible via Drag&Drop.
Fixed several bugs in setting the completed datetime for todos.
Added info about completed datetime of todos to the todo viewer.
Now displaying a completed todo (with completed datetime set) in the agenda view
at the time of the completion. Such that now it is possible to see in the agenda view
when what todo was completed.
Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
Now the behaviour is:
Setting a parent to complete sets all (sub)childs to complete.
Setting a parent to uncomplete does not change the childs.
Setting a child to uncomplete sets all parent to uncomplete.
Setting a child to complete does not change the parents.
Smart updating and double buffering of the daymatrix.
Showing holidays in the day matrix.
Many other small performance updates.
Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
Now the translation file usertranslation.txt is supposed to be in utf8 format.
If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu.
********** VERSION 2.0.0 ************
Stable release 2.0.0!
KO/Pi:
Fixed problem in edit dialog recreation at startup.
Made "toggle view*" menu items enabled context sensitive.
Changed agenda size menu to items 1-10.
Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
Usebility enhancements in the KO/Pi menus.
Birthday import now adds year to summary.
What's Next view shows age in years for birthday.
OM/Pi:
Added three info lines to display subject, from and to of selected mails.
KA/Pi:
Fixed jump bar behaviour on Zaurus.
Now KA/Pi search field supports searching for a range of starting characters.
E.g. to search for all contact beginning with b to n, type
b-n
in the search field.
********** VERSION 1.9.20 ************
KO/Pi:
Added for the "dislplay one day" agenda mode
info in the caption and in the day lables:
Now it is displayed, if the selected day is from "day before yesterday"
to "day after tomorrow".
Made it possible to delete a Todo, which has sub-todos.
Fixed two small problems in the todo view.
Added missing German translation for filter edit and print dialog.
Made search dialog closeable by cancel key.
Made it possible to select in the date picker the (ligt grey )
dates of the prev./next month with the mouse.
OM/Pi:
"Delete mail" icon in main window now deletes all selected mails.
Fixed the problem, that the state flag of imap mails was ignored.
Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
to indecate that they are already seen.
Fixed the problem that the body of some mails was not displayed in the
mail viewer when fetching them from the imap server directly to read them.
Made it (configurable) possible to show the "To:" field in the list view.
Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
local storage folder (specified in account settings) of the account of the mail.
Removed some memory leaks in OM/Pi.
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index c13734f..77793c4 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -1,364 +1,374 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kdatepicker.h"
#include <kglobal.h>
#include <kapplication.h>
#include <klocale.h>
#include <kiconloader.h>
#include <qframe.h>
#include <qpainter.h>
#include <qdialog.h>
#include <qtoolbutton.h>
#include <qfont.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qvalidator.h>
#include <kdebug.h>
#include <knotifyclient.h>
#include <kglobalsettings.h>
#include "kdatetbl.h"
#include "kdateedit.h"
//#include "kdatepicker.moc"
KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name)
: QFrame(parent,name),
yearForward(new QToolButton(this)),
yearBackward(new QToolButton(this)),
monthForward(new QToolButton(this)),
monthBackward(new QToolButton(this)),
selectMonth(new QToolButton(this)),
selectYear(new QToolButton(this)),
+ todayBut(new QToolButton(this)),
//line(new QLineEdit(this)),
val(new KDateValidator(this))
//table(new KDateTable(this)),
//fontsize(1)
{
QFont fo = KGlobalSettings::generalFont();
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 4;
fo.setPointSize(fo.pointSize()+add );
setFont( fo );
table = new KDateTable(this);
setFontSize(font().pointSize());
//line->setValidator(val);
lineDate = new KDateEdit( this, "dateediipicker", true );
yearForward->setPixmap(SmallIcon("2rightarrowB"));
yearBackward->setPixmap(SmallIcon("2leftarrowB"));
monthForward->setPixmap(SmallIcon("1rightarrowB"));
monthBackward->setPixmap(SmallIcon("1leftarrowB"));
+ todayBut->setPixmap(SmallIcon("today"));
setDate(dt); // set button texts
connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked()));
connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked()));
connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked()));
+ connect(todayBut, SIGNAL(clicked()), SLOT(goToday()));
//connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate)));
connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
table->setFocus();
}
KDatePicker::~KDatePicker()
{
}
void
KDatePicker::resizeEvent(QResizeEvent*)
{
QWidget *buttons[] = {
yearBackward,
monthBackward,
selectMonth,
selectYear,
monthForward,
yearForward };
const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
QSize sizes[NoOfButtons];
int buttonHeight=0;
int count;
int w;
int x=0;
// ----- calculate button row height:
for(count=0; count<NoOfButtons; ++count) {
int xS = buttons[count]->sizeHint().width();
int yS = buttons[count]->sizeHint().height();
if ( QApplication::desktop()->width() < 320 )
sizes[count]=QSize ( xS+4, yS );
else
sizes[count]=QSize ( xS+10, yS );
buttonHeight=QMAX(buttonHeight, sizes[count].height());
}
buttonHeight += 10;
// ----- calculate size of the month button:
w=0;
for(count=0; count<NoOfButtons; ++count) {
if(buttons[count]!=selectMonth)
{
w+=sizes[count].width();
} else {
x=count;
}
}
sizes[x].setWidth(width()-w); // stretch the month button
// ----- place the buttons:
x=0;
for(count=0; count<NoOfButtons; ++count)
{
w=sizes[count].width();
buttons[count]->setGeometry(x, 0, w, buttonHeight);
x+=w;
}
// ----- place the line edit for direct input:
sizes[0]=lineDate->sizeHint();
//line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
- lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
+ int todaywid = todayBut->sizeHint().width();
+todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height());
+ lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height());
// ----- adjust the table:
table->setGeometry(0, buttonHeight, width(),
height()-buttonHeight-sizes[0].height());
}
void
KDatePicker::dateChangedSlot(QDate date)
{
lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true));
//line->setText(KGlobal::locale()->formatDate(date, true));
emit(dateChanged(date));
}
void
KDatePicker::tableClickedSlot()
{
emit(dateSelected(table->getDate()));
emit(tableClicked());
}
const QDate&
KDatePicker::getDate() const
{
return table->getDate();
}
const QDate &
KDatePicker::date() const
{
return table->getDate();
}
+void KDatePicker::goToday()
+{
+ slotSetDate( QDate::currentDate() );
+
+}
void KDatePicker::slotSetDate( QDate date )
{
if(date.isValid()) {
QString temp;
// -----
table->setDate(date);
selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
temp.setNum(date.year());
selectYear->setText(temp);
//line->setText(KGlobal::locale()->formatDate(date, true));
lineDate->setDate( date );
}
}
bool
KDatePicker::setDate(const QDate& date)
{
table->setFocus();
if(date.isValid()) {
QString temp;
// -----
table->setDate(date);
selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
temp.setNum(date.year());
selectYear->setText(temp);
//line->setText(KGlobal::locale()->formatDate(date, true));
lineDate->setDate( date );
return true;
} else {
return false;
}
}
void
KDatePicker::monthForwardClicked()
{
QDate temp=table->getDate();
int day=temp.day();
// -----
if(temp.month()==12) {
temp.setYMD(temp.year()+1, 1, 1);
} else {
temp.setYMD(temp.year(), temp.month()+1, 1);
}
if(temp.daysInMonth()<day) {
temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
} else {
temp.setYMD(temp.year(), temp.month(), day);
}
// assert(temp.isValid());
setDate(temp);
}
void
KDatePicker::monthBackwardClicked()
{
QDate temp=table->getDate();
int day=temp.day();
// -----
if(temp.month()==1)
{
temp.setYMD(temp.year()-1, 12, 1);
} else {
temp.setYMD(temp.year(), temp.month()-1, 1);
}
if(temp.daysInMonth()<day)
{
temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
} else {
temp.setYMD(temp.year(), temp.month(), day);
}
// assert(temp.isValid());
setDate(temp);
}
void
KDatePicker::yearForwardClicked()
{
QDate temp=table->getDate();
int day=temp.day();
// -----
temp.setYMD(temp.year()+1, temp.month(), 1);
if(temp.daysInMonth()<day)
{
temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
} else {
temp.setYMD(temp.year(), temp.month(), day);
}
// assert(temp.isValid());
setDate(temp);
}
void
KDatePicker::yearBackwardClicked()
{
QDate temp=table->getDate();
int day=temp.day();
// -----
temp.setYMD(temp.year()-1, temp.month(), 1);
if(temp.daysInMonth()<day)
{
temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
} else {
temp.setYMD(temp.year(), temp.month(), day);
}
// assert(temp.isValid());
setDate(temp);
}
void
KDatePicker::selectMonthClicked()
{
int month;
KPopupFrame* popup = new KPopupFrame(this);
KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
picker->setFocus();
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height()))))
{
QDate date;
int day;
// -----
month=picker->getResult();
date=table->getDate();
day=date.day();
// ----- construct a valid date in this month:
date.setYMD(date.year(), month, 1);
date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
// ----- set this month
setDate(date);
} else {
KNotifyClient::beep();
}
delete popup;
}
void
KDatePicker::selectYearClicked()
{
int year;
KPopupFrame* popup = new KPopupFrame(this);
KDateInternalYearSelector* picker = new KDateInternalYearSelector(fontsize, popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
picker->setFocus();
if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height()))))
{
QDate date;
int day;
// -----
year=picker->getYear();
date=table->getDate();
day=date.day();
// ----- construct a valid date in this month:
date.setYMD(year, date.month(), 1);
date.setYMD(year, date.month(), QMIN(day, date.daysInMonth()));
// ----- set this month
setDate(date);
} else {
KNotifyClient::beep();
}
delete popup;
}
void
KDatePicker::setEnabled(bool enable)
{
QWidget *widgets[]= {
yearForward, yearBackward, monthForward, monthBackward,
selectMonth, selectYear,
lineDate, table };
const int Size=sizeof(widgets)/sizeof(widgets[0]);
int count;
// -----
for(count=0; count<Size; ++count)
{
widgets[count]->setEnabled(enable);
}
}
void
KDatePicker::lineEnterPressed()
{
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h
index 6625357..3db9a89 100644
--- a/libkdepim/kdatepicker.h
+++ b/libkdepim/kdatepicker.h
@@ -1,181 +1,183 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef MICROKDE_KDATEPICKER_H
#define MICROKDE_KDATEPICKER_H
#include <qdatetime.h>
#include <qframe.h>
#include <qevent.h>
class QLineEdit;
class QToolButton;
class KDateValidator;
class KDateTable;
class KDateEdit;
/**
* Provides a widget for calendar date input.
*
* Different from the
* previous versions, it now emits two types of signals, either
* @ref dateSelected() or @ref dateEntered() (see documentation for both
* signals).
*
* A line edit has been added in the newer versions to allow the user
* to select a date directly by entering numbers like 19990101
* or 990101.
*
* @image kdatepicker.png KDatePicker
*
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*
* @short A date selection widget.
**/
class KDatePicker: public QFrame
{
Q_OBJECT
public:
/** The usual constructor. The given date will be displayed
* initially.
**/
KDatePicker(QWidget *parent=0,
QDate=QDate::currentDate(),
const char *name=0);
/**
* The destructor.
**/
virtual ~KDatePicker();
/** The size hint for date pickers. The size hint recommends the
* minimum size of the widget so that all elements may be placed
* without clipping. This sometimes looks ugly, so when using the
* size hint, try adding 28 to each of the reported numbers of
* pixels.
**/
QSize sizeHint() const;
/**
* Sets the date.
*
* @returns @p false and does not change anything
* if the date given is invalid.
**/
bool setDate(const QDate&);
/**
* Returns the selected date.
* @deprecated
**/
const QDate& getDate() const;
/**
* @returns the selected date.
*/
const QDate &date() const;
/**
* Enables or disables the widget.
**/
void setEnabled(bool);
/**
* Sets the font size of the widgets elements.
**/
void setFontSize(int);
/**
* Returns the font size of the widget elements.
*/
int fontSize() const
{ return fontsize; }
protected:
/// the resize event
void resizeEvent(QResizeEvent*);
+ QToolButton *todayBut;
/// the year forward button
QToolButton *yearForward;
/// the year backward button
QToolButton *yearBackward;
/// the month forward button
QToolButton *monthForward;
/// the month backward button
QToolButton *monthBackward;
/// the button for selecting the month directly
QToolButton *selectMonth;
/// the button for selecting the year directly
QToolButton *selectYear;
/// the line edit to enter the date directly
//QLineEdit *line;
KDateEdit *lineDate;
/// the validator for the line edit:
KDateValidator *val;
/// the date table
KDateTable *table;
/// the size calculated during resize events
// QSize sizehint;
/// the widest month string in pixels:
QSize maxMonthRect;
protected slots:
void dateChangedSlot(QDate);
void tableClickedSlot();
void monthForwardClicked();
void monthBackwardClicked();
void yearForwardClicked();
void yearBackwardClicked();
void selectMonthClicked();
void selectYearClicked();
void lineEnterPressed();
void slotSetDate(QDate);
+ void goToday();
signals:
/** This signal is emitted each time the selected date is changed.
* Usually, this does not mean that the date has been entered,
* since the date also changes, for example, when another month is
* selected.
* @see dateSelected
*/
void dateChanged(QDate);
/** This signal is emitted each time a day has been selected by
* clicking on the table (hitting a day in the current month). It
* has the same meaning as dateSelected() in older versions of
* KDatePicker.
*/
void dateSelected(QDate);
/** This signal is emitted when enter is pressed and a VALID date
* has been entered before into the line edit. Connect to both
* dateEntered() and dateSelected() to receive all events where the
* user really enters a date.
*/
void dateEntered(QDate);
/** This signal is emitted when the day has been selected by
* clicking on it in the table.
*/
void tableClicked();
private:
/// the font size for the widget
int fontsize;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KDatePickerPrivate;
KDatePickerPrivate *d;
void keyPressEvent ( QKeyEvent * ) ;
};
#endif // KDATEPICKER_H