author | harlekin <harlekin> | 2002-09-19 08:10:37 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-19 08:10:37 (UTC) |
commit | 390fc683967b74607aa93a176db33b30cd63b9c6 (patch) (side-by-side diff) | |
tree | 1ac9846defcf76f180cc419c40b6a9f67fba7f5f /core/pim/today/plugins/todolist | |
parent | 474222487ba86a76b7d494aefd250222327ca12e (diff) | |
download | opie-390fc683967b74607aa93a176db33b30cd63b9c6.zip opie-390fc683967b74607aa93a176db33b30cd63b9c6.tar.gz opie-390fc683967b74607aa93a176db33b30cd63b9c6.tar.bz2 |
fixed config option
Diffstat (limited to 'core/pim/today/plugins/todolist') (more/less context) (ignore whitespace changes)
4 files changed, 26 insertions, 28 deletions
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index f5f6ed6..7ab27a0 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -23,49 +23,43 @@ TodolistPlugin::TodolistPlugin() { } TodolistPlugin::~TodolistPlugin() { } QString TodolistPlugin::pluginName() const { return "Todolist plugin"; } double TodolistPlugin::versionNumber() const { - return 0.1; + return 0.7; } QString TodolistPlugin::pixmapNameWidget() const { return "TodoList"; } QWidget* TodolistPlugin::widget( QWidget *wid ) { - return new TodolistPluginWidget( wid, "Todolist" ); + return new TodolistPluginWidget( wid, "Todolist" ); } QString TodolistPlugin::pixmapNameConfig() const { return "TodoList"; } ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { return new TodolistPluginConfig( wid , "Todolist" ); } QString TodolistPlugin::appName() const { - return "Todolist"; + return QObject::tr( "Todolist" ); } int TodolistPlugin::minHeight() const { return 10; } int TodolistPlugin::maxHeight() const { return 100; } - - - - int main() { -} - diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp index da81600..2d8f1b6 100644 --- a/core/pim/today/plugins/todolist/todopluginconfig.cpp +++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp @@ -41,29 +41,30 @@ TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) SpinBox2 = new QSpinBox( Frame9, "SpinBox2" ); SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) ); SpinBox2->setMaxValue( 20 ); SpinBox2->setValue( 5 ); layout->addWidget( Frame9 ); readConfig(); } void TodolistPluginConfig::readConfig() { - Config cfg( "todaydatebookplugin" ); + Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); SpinBox2->setValue( m_max_lines_task ); } void TodolistPluginConfig::writeConfig() { - Config cfg( "todaydatebookplugin" ); + Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); + m_max_lines_task = SpinBox2->value(); cfg.writeEntry( "maxlinestask", m_max_lines_task ); cfg.write(); } TodolistPluginConfig::~TodolistPluginConfig() { } diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp index 2a0e5a3..4731b43 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.cpp +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp @@ -18,115 +18,117 @@ #include <qvaluelist.h> #include <qtl.h> #include <qstring.h> #include <qscrollview.h> #include <qobject.h> #include <qlayout.h> #include <qpe/config.h> #include <qpe/timestring.h> #include <qpe/qcopenvelope_qws.h> -TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name) - : QWidget(parent, name ) { +TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) + : QWidget( parent, name ) { todoLabel= 0l; - todo = 0l; + if ( todo ) { delete todo; } todo = new ToDoDB(); readConfig(); m_maxCharClip = 36; getTodo(); } TodolistPluginWidget::~TodolistPluginWidget() { delete todo; } + void TodolistPluginWidget::readConfig() { - Config cfg( "todaytodolistplugin" ); + Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); - m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); + m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); } /** * Get the todos */ void TodolistPluginWidget::getTodo() { QVBoxLayout* layoutTodo = new QVBoxLayout( this ); - if ( todoLabel ) { + if ( todoLabel ) { delete todoLabel; } todoLabel = new OClickableLabel( this ); todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); - connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); + connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); + QString output; QString tmpout; int count = 0; int ammount = 0; // get overdue todos first QValueList<ToDoEvent> overDueList = todo->overDue(); - qBubbleSort(overDueList); + qBubbleSort( overDueList ); for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin(); - it!=overDueList.end(); ++it ) { + it != overDueList.end(); ++it ) { if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) { QString desc = (*it).summary(); if( desc.isEmpty() ) { desc = (*it).description(); } - tmpout += "<font color=#e00000><b>-" + desc.mid(0, m_maxCharClip) + "</b></font><br>"; + tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; ammount++; } } // get total number of still open todos QValueList<ToDoEvent> openTodo = todo->rawToDos(); qBubbleSort( openTodo ); - for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin(); - it!=openTodo.end(); ++it ) { + for ( QValueList<ToDoEvent>::Iterator it = openTodo.begin(); + it != openTodo.end(); ++it ) { if ( !(*it).isCompleted() ){ count +=1; // not the overdues, we allready got them, and not if we are // over the maxlines if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) { QString desc = (*it).summary(); if( desc.isEmpty() ) { desc = (*it).description(); } - tmpout += "<b>-</b>" + desc.mid(0, m_maxCharClip) + "<br>"; + tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; ammount++; } } } if ( count > 0 ) { if( count == 1 ) { output += QObject::tr( "There is <b> 1</b> active task: <br>" ); } else { - output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg(count); + output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); } output += tmpout; } else { output = QObject::tr( "No active tasks" ); - } + } todoLabel->setText( output ); layoutTodo->addWidget( todoLabel ); } /** * start the todolist */ void TodolistPluginWidget::startTodolist() { - QCopEnvelope e("QPE/System", "execute(QString)"); - e << QString("todolist"); + QCopEnvelope e( "QPE/System", "execute(QString)" ); + e << QString( "todolist" ); } diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h index ccc312a..970f430 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.h +++ b/core/pim/today/plugins/todolist/todopluginwidget.h @@ -29,19 +29,20 @@ class TodolistPluginWidget : public QWidget { Q_OBJECT public: TodolistPluginWidget( QWidget *parent, const char *name ); ~TodolistPluginWidget(); protected slots: void startTodolist(); private: OClickableLabel *todoLabel; ToDoDB *todo; + void readConfig(); void getTodo(); int m_maxLinesTask; int m_maxCharClip; }; #endif |