summaryrefslogtreecommitdiff
path: root/core/pim/todo/todotable.h
Side-by-side diff
Diffstat (limited to 'core/pim/todo/todotable.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/todotable.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h
index 2746ce7..288ff90 100644
--- a/core/pim/todo/todotable.h
+++ b/core/pim/todo/todotable.h
@@ -53,156 +53,178 @@ private:
};
class ComboItem : public QTableItem
{
public:
ComboItem( QTable *t, EditType et );
QWidget *createEditor() const;
void setContentFromEditor( QWidget *w );
void setText( const QString &s );
int alignment() const { return Qt::AlignCenter; }
QString text() const;
private:
QGuardedPtr<QComboBox> cb;
};
class TodoTextItem : public QTableItem
{
public:
TodoTextItem( QTable *t, const QString & str )
:QTableItem( t, QTableItem::Never, str ) {}
QString key () const { return Qtopia::buildSortKey( text() ); }
};
enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE };
class TodoTable : public QTable
{
Q_OBJECT
public:
TodoTable( QWidget *parent = 0, const char * name = 0 );
void addEntry( const ToDoEvent &todo );
void clearFindRow() { currFindRow = -2; }
ToDoEvent currentEntry() const;
void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false );
QStringList categories();
void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); }
bool showCompleted() const { return showComp; }
+ /* added 20.01.2k2 by se */
+ void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();}
+ bool showDeadline() const { return showDeadl;}
+
void setShowCategory( const QString &c ) { showCat = c; updateVisible(); }
const QString &showCategory() const { return showCat; }
int showCategoryId() const;
bool save( const QString &fn );
void load( const QString &fn );
void clear();
void removeCurrentEntry();
void setPaintingEnabled( bool e );
virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ );
// int rowHeight( int ) const;
// int rowPos( int row ) const;
// virtual int rowAt( int pos ) const;
signals:
void signalEdit();
void signalDoneChanged( bool b );
void signalPriorityChanged( int i );
void signalShowMenu( const QPoint & );
void signalNotFound();
void signalWrapAround();
protected:
void keyPressEvent( QKeyEvent *e );
private:
void updateVisible();
void viewportPaintEvent( QPaintEvent * );
void internalAddEntries( QList<ToDoEvent> &list);
inline void insertIntoTable( ToDoEvent *todo, int row );
void updateJournal( const ToDoEvent &todo, journal_action action, int row = -1);
void mergeJournal();
void journalFreeReplaceEntry( const ToDoEvent &todo, int row );
void journalFreeRemoveEntry( int row );
inline void realignTable( int row );
void loadFile( const QString &strFile, bool fromJournal = false );
private slots:
void slotClicked( int row, int col, int button, const QPoint &pos );
void slotPressed( int row, int col, int button, const QPoint &pos );
void slotCheckPriority(int row, int col );
void slotCurrentChanged(int row, int col );
void slotDoFind( const QString &findString, bool caseSensetive,
bool backwards, int category );
void slotShowMenu();
void rowHeightChanged( int row );
private:
friend class TodoWindow;
QMap<CheckItem*, ToDoEvent *> todoList;
QStringList categoryList;
bool showComp;
QString showCat;
QTimer *menuTimer;
bool enablePainting;
Categories mCat;
int currFindRow;
+
+ /* added 20.01.2k2 by se */
+ bool showDeadl;
};
inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row )
{
QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A')
+ todo->priority() )
+ Qtopia::buildSortKey( todo->description() );
CheckItem *chk = new CheckItem( this, sortKey );
chk->setChecked( todo->isCompleted() );
ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent );
cmb->setText( QString::number( todo->priority() ) );
QTableItem *ti = new TodoTextItem( this, todo->description().left(40).simplifyWhiteSpace() );
ti->setReplaceable( false );
+ /* added 20.01.2k2 by se */
+ QTableItem *dl = NULL;
+ if (todo->hasDate()){
+ QDate *today = new QDate (QDate::currentDate());
+ if (today){
+ dl = new TodoTextItem (this, tr ("%1").
+ arg(today->daysTo(todo->date())));
+ delete (today);
+ }
+ }else{
+ dl = new TodoTextItem (this,"n.d.");
+ }
+ setItem( row, 3, dl);
+
setItem( row, 0, chk );
setItem( row, 1, cmb );
setItem( row, 2, ti );
+
todoList.insert( chk, todo );
}
inline void TodoTable::realignTable( int row )
{
QTableItem *ti1,
*ti2,
*ti3;
int totalRows = numRows();
for ( int curr = row; curr < totalRows - 1; curr++ ) {
// this is bad, we must take the item out and then
// set it. In the end, it behaves no worse (time wise)
// then the old way of saving the entries to file, clearing
// the table re-reading in the file and resetting the table
ti1 = item( curr + 1, 0 );
ti2 = item( curr + 1, 1 );
ti3 = item( curr + 1, 2 );
takeItem( ti1 );
takeItem( ti2 );
takeItem( ti3 );
setItem( curr, 0, ti1 );
setItem( curr, 1, ti2 );
setItem( curr, 2, ti3 );
}
setNumRows( totalRows - 1 );
}
#endif