summaryrefslogtreecommitdiff
authordrw <drw>2002-12-20 22:45:16 (UTC)
committer drw <drw>2002-12-20 22:45:16 (UTC)
commit3e67f4998a4957420d7f890268dc5f816e142468 (patch) (side-by-side diff)
tree428a6876c2e42efedb7334c440edc51acad6dacf
parent406e02d26c0925598cbadaead11e3ee7b2c7c51c (diff)
downloadopie-3e67f4998a4957420d7f890268dc5f816e142468.zip
opie-3e67f4998a4957420d7f890268dc5f816e142468.tar.gz
opie-3e67f4998a4957420d7f890268dc5f816e142468.tar.bz2
First part of GUI clean-up. Added icons to 'quick task' entry toolbar and menu choice to show/hide the bar.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp70
-rw-r--r--core/pim/todo/mainwindow.h6
-rw-r--r--core/pim/todo/quickeditimpl.cpp56
-rw-r--r--core/pim/todo/quickeditimpl.h9
4 files changed, 86 insertions, 55 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 0ab6230..f0aa455 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -29,2 +29,3 @@
#include <unistd.h>
+#include <stdio.h>
@@ -45,2 +46,3 @@
#include <qpe/qpemessagebox.h>
+#include <qpe/qpetoolbar.h>
@@ -87,2 +89,7 @@ void MainWindow::initTemplate() {
void MainWindow::initActions() {
+
+ // Data menu
+ m_edit->insertItem(tr("New from template"), m_template,
+ -1, 0 );
+
QAction* a = new QAction( tr("New Task" ), Resource::loadPixmap( "new" ),
@@ -150,6 +157,6 @@ void MainWindow::initActions() {
+ // Options menu
a = new QAction( tr("Find"), Resource::loadIconSet( "mag" ),
QString::null, 0, this, 0 );
- connect(a, SIGNAL( activated() ),
- this, SLOT( slotFind() ) );
+ connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
a->addTo( m_options );
@@ -159,3 +166,3 @@ void MainWindow::initActions() {
- m_completedAction = new QAction( QString::null, tr("Completed tasks"),
+ m_completedAction = new QAction( QString::null, tr("Show completed tasks"),
0, this, 0, TRUE );
@@ -163,6 +170,11 @@ void MainWindow::initActions() {
m_completedAction->setOn( showCompleted() );
- connect(m_completedAction, SIGNAL( toggled(bool) ),
- this, SLOT(slotShowCompleted(bool) ) );
+ connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
- m_showDeadLineAction = new QAction( QString::null, tr("Show Deadline"),
+ a = new QAction( QString::null, tr("Show only over-due tasks"),
+ 0, this, 0, TRUE );
+ a->addTo( m_options );
+ a->setOn( showOverDue() );
+ connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
+
+ m_showDeadLineAction = new QAction( QString::null, tr("Show task deadlines"),
0, this, 0, TRUE );
@@ -170,4 +182,9 @@ void MainWindow::initActions() {
m_showDeadLineAction->setOn( showDeadline() );
- connect(m_showDeadLineAction, SIGNAL(toggled(bool) ),
- this, SLOT( slotShowDeadLine( bool ) ) );
+ connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine( bool ) ) );
+
+ m_showQuickTaskAction = new QAction( QString::null, tr("Show quick task bar"),
+ 0, this, 0, TRUE );
+ m_showQuickTaskAction->addTo( m_options );
+ m_showQuickTaskAction->setOn( showQuickTask() );
+ connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
@@ -179,13 +196,5 @@ void MainWindow::initActions() {
- /* initialize the view menu */
- a = new QAction( QString::null, tr("Show only over due"),
- 0, this, 0, TRUE );
- a->addTo( m_options );
- a->setOn( showOverDue() );
- connect(a, SIGNAL(toggled(bool)),
- this, SLOT(slotShowDue(bool) ) );
-
- /* templates */
- m_edit->insertItem(tr("New from template"), m_template,
- -1, 0 );
+ m_curQuick = new QuickEditImpl( this, m_quicktask );
+ addToolBar( (QPEToolBar *)m_curQuick->widget(), tr( "QuickEdit" ), QMainWindow::Top, TRUE );
+ m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
@@ -199,3 +208,4 @@ void MainWindow::initConfig() {
m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
- m_overdue = config.readBoolEntry("ShowOverDue", TRUE );
+ m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
+ m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
}
@@ -203,7 +213,2 @@ void MainWindow::initUI() {
m_mainBox = new QVBox(this, "main box ");
- m_curQuick = new QuickEditImpl(this, m_mainBox );
- m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
- m_quickEdit.append( m_curQuick );
-
-
@@ -214,3 +219,3 @@ void MainWindow::initUI() {
- m_tool = new QToolBar( this );
+ m_tool = new QPEToolBar( this );
m_tool->setHorizontalStretchable( TRUE );
@@ -373,3 +378,4 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
config.writeEntry( "ShowOverDue", showOverDue() );
- /* svae templates */
+ config.writeEntry( "ShowQuickTask", showQuickTask() );
+ /* save templates */
templateManager()->save();
@@ -517,2 +523,9 @@ void MainWindow::slotShowCompleted( bool show) {
}
+void MainWindow::slotShowQuickTask( bool show ) {
+ m_quicktask = show;
+ if ( m_quicktask )
+ m_curQuick->widget()->show();
+ else
+ m_curQuick->widget()->hide();
+}
bool MainWindow::showOverDue()const {
@@ -593,2 +606,5 @@ bool MainWindow::showDeadline()const {
}
+bool MainWindow::showQuickTask()const {
+ return m_quicktask;
+}
QString MainWindow::currentCategory()const {
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 87a9133..86b9ac2 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -49,2 +49,3 @@ class Ir;
class QVBox;
+class QLineEdit;
@@ -84,2 +85,3 @@ namespace Todo {
bool showOverDue()const;
+ bool showQuickTask()const;
QString currentCategory()const;
@@ -133,2 +135,3 @@ private slots:
*m_showOverDueAction,
+ *m_showQuickTaskAction,
*m_effectiveAction;
@@ -151,2 +154,3 @@ private slots:
bool m_overdue:1;
+ bool m_quicktask:1;
TodoManager m_todoMgr;
@@ -154,3 +158,2 @@ private slots:
QList<ViewBase> m_views;
- QList<QuickEditBase> m_quickEdit;
uint m_counter;
@@ -180,2 +183,3 @@ private slots:
void slotShowCompleted( bool );
+ void slotShowQuickTask( bool );
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 2dd5b61..9b54bdc 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -1,3 +1,6 @@
+#include <qaction.h>
#include <qlineedit.h>
+#include <qpe/resource.h>
+
#include <opie/oclickablelabel.h>
@@ -8,28 +11,34 @@
-QuickEditImpl::QuickEditImpl( Todo::MainWindow* win, QWidget* arent )
- : QHBox(arent), Todo::QuickEdit(win) {
- m_lbl = new OClickableLabel(this );
- m_lbl->setMinimumWidth(12);
- m_lbl->setText("3");
+QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
+ : QPEToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) {
+ setHorizontalStretchable( TRUE );
- m_edit = new QLineEdit(this );
+ // TODO - come up with icons and replace text priority values
+ m_lbl = new OClickableLabel( this );
+ m_lbl->setMinimumWidth(15);
+ m_lbl->setText("3");
+ connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
- m_enter = new OClickableLabel(this);
- m_enter->setText("Enter");
+ m_edit = new QLineEdit( this );
+ setStretchableWidget( m_edit );
- m_more = new OClickableLabel(this);
- m_more->setText("More");
+ QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
+ a->addTo( this );
+ a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
+ a->addTo( this );
- // connect
- connect(m_lbl, SIGNAL(clicked() ),
- this, SLOT(slotPrio()) );
- connect(m_enter, SIGNAL(clicked() ),
- this, SLOT(slotEnter() ) );
- connect(m_more, SIGNAL(clicked() ),
- this, SLOT(slotMore() ) );
+ a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
+ a->addTo( this );
+ m_visible = visible;
+ if ( !m_visible ) {
+ hide();
+ }
+
m_menu = 0l;
reinit();
- setMaximumHeight( m_edit->sizeHint().height() );
}
@@ -44,5 +53,2 @@ QWidget* QuickEditImpl::widget() {
}
-QSize QuickEditImpl::sizeHint()const{
- return m_edit->sizeHint();
-}
void QuickEditImpl::slotEnter() {
@@ -55,4 +61,4 @@ void QuickEditImpl::slotEnter() {
todo.setSummary( m_edit->text() );
- if ( mainWindow()->currentCatId() != 0 )
- todo.setCategories( mainWindow()->currentCatId() );
+ if ( ((Todo::MainWindow *)parent())->currentCatId() != 0 )
+ todo.setCategories( ((Todo::MainWindow *)parent())->currentCatId() );
@@ -83,2 +89,6 @@ void QuickEditImpl::slotPrio() {
void QuickEditImpl::slotMore() {
+ // TODO - implement
+}
+void QuickEditImpl::slotCancel() {
+ reinit();
}
diff --git a/core/pim/todo/quickeditimpl.h b/core/pim/todo/quickeditimpl.h
index d0f6c69..c58275e 100644
--- a/core/pim/todo/quickeditimpl.h
+++ b/core/pim/todo/quickeditimpl.h
@@ -3,3 +3,3 @@
-#include <qhbox.h>
+#include <qpe/qpetoolbar.h>
@@ -10,6 +10,6 @@ class QLabel;
-class QuickEditImpl : public QHBox, public Todo::QuickEdit {
+class QuickEditImpl : public QPEToolBar, public Todo::QuickEdit {
Q_OBJECT
public:
- QuickEditImpl( Todo::MainWindow* win , QWidget* parent);
+ QuickEditImpl( QWidget* parent, bool visible);
~QuickEditImpl();
@@ -17,3 +17,2 @@ public:
QWidget* widget();
- QSize sizeHint()const;
private slots:
@@ -22,2 +21,3 @@ private slots:
void slotMore();
+ void slotCancel();
private:
@@ -31,2 +31,3 @@ private:
OTodo m_todo;
+ bool m_visible;
};