summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index c2f422d..f0642c4 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -13,98 +13,100 @@
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include <unistd.h> 29#include <unistd.h>
30 30
31#include <opie2/opimrecurrence.h> 31#include <opie2/opimrecurrence.h>
32#include <opie2/opimnotifymanager.h> 32#include <opie2/opimnotifymanager.h>
33#include <opie2/otodoaccessvcal.h> 33#include <opie2/otodoaccessvcal.h>
34#include <opie2/oapplicationfactory.h> 34#include <opie2/oapplicationfactory.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/ir.h> 38#include <qpe/ir.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpemessagebox.h> 40#include <qpe/qpemessagebox.h>
41#include <qpe/alarmserver.h> 41#include <qpe/alarmserver.h>
42#include <qpe/qpeapplication.h> 42#include <qpe/qpeapplication.h>
43 43
44#include <qmenubar.h> 44#include <qmenubar.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qtimer.h> 48#include <qtimer.h>
49#include <qlayout.h> 49#include <qlayout.h>
50#include <qwhatsthis.h> 50#include <qwhatsthis.h>
51 51
52#include "quickeditimpl.h" 52#include "quickeditimpl.h"
53#include "todotemplatemanager.h" 53#include "todotemplatemanager.h"
54#include "templateeditor.h" 54#include "templateeditor.h"
55#include "tableview.h" 55#include "tableview.h"
56 56
57#include "textviewshow.h" 57#include "textviewshow.h"
58#include "todoeditor.h" 58#include "todoeditor.h"
59#include "mainwindow.h" 59#include "mainwindow.h"
60 60
61using namespace Opie::Core;
61OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) 62OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
62 63
64 using namespace Opie;
63using namespace Todo; 65using namespace Todo;
64 66
65MainWindow::MainWindow( QWidget* parent, 67MainWindow::MainWindow( QWidget* parent,
66 const char* name, WFlags ) 68 const char* name, WFlags )
67 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 69 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
68{ 70{
69 if (!name) 71 if (!name)
70 setName("todo window"); 72 setName("todo window");
71 73
72 m_syncing = false; 74 m_syncing = false;
73 m_showing = false; 75 m_showing = false;
74 m_counter = 0; 76 m_counter = 0;
75 m_tempManager = new TemplateManager(); 77 m_tempManager = new TemplateManager();
76 m_tempManager->load(); 78 m_tempManager->load();
77 79
78 initUI(); 80 initUI();
79 initConfig(); 81 initConfig();
80 initViews(); 82 initViews();
81 initActions(); 83 initActions();
82 initEditor(); 84 initEditor();
83 initShow(); 85 initShow();
84 initTemplate(); 86 initTemplate();
85 87
86 populateTemplates(); 88 populateTemplates();
87 raiseCurrentView(); 89 raiseCurrentView();
88 QTimer::singleShot(0, this, SLOT(populateCategories() ) ); 90 QTimer::singleShot(0, this, SLOT(populateCategories() ) );
89} 91}
90void MainWindow::initTemplate() { 92void MainWindow::initTemplate() {
91 m_curTempEd = new TemplateEditor( this, templateManager() ); 93 m_curTempEd = new TemplateEditor( this, templateManager() );
92} 94}
93void MainWindow::initActions() { 95void MainWindow::initActions() {
94 96
95 // Data menu 97 // Data menu
96 m_edit->insertItem(QWidget::tr("New from template"), m_template, 98 m_edit->insertItem(QWidget::tr("New from template"), m_template,
97 -1, 0 ); 99 -1, 0 );
98 100
99 QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), 101 QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
100 QString::null, 0, this, 0 ); 102 QString::null, 0, this, 0 );
101 connect(a, SIGNAL( activated() ), 103 connect(a, SIGNAL( activated() ),
102 this, SLOT( slotNew() ) ); 104 this, SLOT( slotNew() ) );
103 a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) ); 105 a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) );
104 a->addTo(m_tool ); 106 a->addTo(m_tool );
105 a->addTo(m_edit ); 107 a->addTo(m_edit );
106 108
107 a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ), 109 a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ),
108 QString::null, 0, this, 0 ); 110 QString::null, 0, this, 0 );
109 connect(a, SIGNAL(activated() ), 111 connect(a, SIGNAL(activated() ),
110 this, SLOT( slotEdit() ) ); 112 this, SLOT( slotEdit() ) );
@@ -175,97 +177,97 @@ void MainWindow::initActions() {
175 177
176 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"), 178 m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
177 0, this, 0, TRUE ); 179 0, this, 0, TRUE );
178 m_completedAction->addTo( m_options ); 180 m_completedAction->addTo( m_options );
179 m_completedAction->setOn( showCompleted() ); 181 m_completedAction->setOn( showCompleted() );
180 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) ); 182 connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
181 183
182 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"), 184 a = new QAction( QString::null, QWidget::tr("Show only over-due tasks"),
183 0, this, 0, TRUE ); 185 0, this, 0, TRUE );
184 a->addTo( m_options ); 186 a->addTo( m_options );
185 a->setOn( showOverDue() ); 187 a->setOn( showOverDue() );
186 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) ); 188 connect(a, SIGNAL(toggled(bool)), this, SLOT(slotShowDue(bool) ) );
187 189
188 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"), 190 m_showDeadLineAction = new QAction( QString::null, QWidget::tr("Show task deadlines"),
189 0, this, 0, TRUE ); 191 0, this, 0, TRUE );
190 m_showDeadLineAction->addTo( m_options ); 192 m_showDeadLineAction->addTo( m_options );
191 m_showDeadLineAction->setOn( showDeadline() ); 193 m_showDeadLineAction->setOn( showDeadline() );
192 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) ); 194 connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) );
193 195
194 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"), 196 m_showQuickTaskAction = new QAction( QString::null, QWidget::tr("Show quick task bar"),
195 0, this, 0, TRUE ); 197 0, this, 0, TRUE );
196 m_showQuickTaskAction->addTo( m_options ); 198 m_showQuickTaskAction->addTo( m_options );
197 m_showQuickTaskAction->setOn( showQuickTask() ); 199 m_showQuickTaskAction->setOn( showQuickTask() );
198 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) ); 200 connect(m_showQuickTaskAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowQuickTask(bool) ) );
199 201
200 m_options->insertSeparator(); 202 m_options->insertSeparator();
201 203
202 m_bar->insertItem( QWidget::tr("Data") ,m_edit ); 204 m_bar->insertItem( QWidget::tr("Data") ,m_edit );
203 m_bar->insertItem( QWidget::tr("Category"), m_catMenu ); 205 m_bar->insertItem( QWidget::tr("Category"), m_catMenu );
204 m_bar->insertItem( QWidget::tr("Options"), m_options ); 206 m_bar->insertItem( QWidget::tr("Options"), m_options );
205 207
206 m_curQuick = new QuickEditImpl( this, m_quicktask ); 208 m_curQuick = new QuickEditImpl( this, m_quicktask );
207 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE ); 209 addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE );
208 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) ); 210 m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
209 211
210} 212}
211/* m_curCat from Config */ 213/* m_curCat from Config */
212void MainWindow::initConfig() { 214void MainWindow::initConfig() {
213 Config config( "todo" ); 215 Config config( "todo" );
214 config.setGroup( "View" ); 216 config.setGroup( "View" );
215 m_completed = config.readBoolEntry( "ShowComplete", TRUE ); 217 m_completed = config.readBoolEntry( "ShowComplete", TRUE );
216 m_curCat = config.readEntry( "Category", QString::null ); 218 m_curCat = config.readEntry( "Category", QString::null );
217 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE); 219 m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
218 m_overdue = config.readBoolEntry("ShowOverDue", FALSE ); 220 m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
219 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE); 221 m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
220} 222}
221void MainWindow::initUI() { 223void MainWindow::initUI() {
222 224
223 m_stack = new OWidgetStack(this, "main stack"); 225 m_stack = new Opie::Ui::OWidgetStack(this, "main stack");
224 226
225 setCentralWidget( m_stack ); 227 setCentralWidget( m_stack );
226 228
227 setToolBarsMovable( FALSE ); 229 setToolBarsMovable( FALSE );
228 230
229 QToolBar *menubarholder = new QToolBar( this ); 231 QToolBar *menubarholder = new QToolBar( this );
230 menubarholder->setHorizontalStretchable( TRUE ); 232 menubarholder->setHorizontalStretchable( TRUE );
231 m_bar = new QMenuBar( menubarholder ); 233 m_bar = new QMenuBar( menubarholder );
232 234
233 m_tool = new QToolBar( this ); 235 m_tool = new QToolBar( this );
234 236
235 /** QPopupMenu */ 237 /** QPopupMenu */
236 m_edit = new QPopupMenu( this ); 238 m_edit = new QPopupMenu( this );
237 m_options = new QPopupMenu( this ); 239 m_options = new QPopupMenu( this );
238 m_catMenu = new QPopupMenu( this ); 240 m_catMenu = new QPopupMenu( this );
239 m_template = new QPopupMenu( this ); 241 m_template = new QPopupMenu( this );
240 242
241 m_catMenu->setCheckable( TRUE ); 243 m_catMenu->setCheckable( TRUE );
242 m_template->setCheckable( TRUE ); 244 m_template->setCheckable( TRUE );
243 245
244 connect(m_catMenu, SIGNAL(activated(int) ), 246 connect(m_catMenu, SIGNAL(activated(int) ),
245 this, SLOT(setCategory(int) ) ); 247 this, SLOT(setCategory(int) ) );
246 connect(m_template, SIGNAL(activated(int) ), 248 connect(m_template, SIGNAL(activated(int) ),
247 this, SLOT(slotNewFromTemplate(int) ) ); 249 this, SLOT(slotNewFromTemplate(int) ) );
248} 250}
249void MainWindow::initViews() { 251void MainWindow::initViews() {
250 252
251 TableView* tableView = new TableView( this, m_stack ); 253 TableView* tableView = new TableView( this, m_stack );
252 QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) ); 254 QWhatsThis::add( tableView, QWidget::tr( "This is a listing of all current tasks.\n\nThe list displays the following information:\n1. Completed - A green checkmark indicates task is completed. Click here to complete a task.\n2. Priority - a graphical representation of task priority. Double-click here to modify.\n3. Description - description of task. Click here to select the task.\n4. Deadline - shows when task is due. This column can be shown or hidden by selecting Options->'Show task deadlines' from the menu above." ) );
253 m_stack->addWidget( tableView, m_counter++ ); 255 m_stack->addWidget( tableView, m_counter++ );
254 m_views.append( tableView ); 256 m_views.append( tableView );
255 m_curView = tableView; 257 m_curView = tableView;
256 connectBase( tableView ); 258 connectBase( tableView );
257 /* add QString type + QString configname to 259 /* add QString type + QString configname to
258 * the View menu 260 * the View menu
259 * and subdirs for multiple views 261 * and subdirs for multiple views
260 */ 262 */
261} 263}
262void MainWindow::initEditor() { 264void MainWindow::initEditor() {
263 m_curEdit = new Editor(); 265 m_curEdit = new Editor();
264} 266}
265void MainWindow::initShow() { 267void MainWindow::initShow() {
266 m_curShow = new TextViewShow(this, this); 268 m_curShow = new TextViewShow(this, this);
267 m_stack->addWidget( m_curShow->widget() , m_counter++ ); 269 m_stack->addWidget( m_curShow->widget() , m_counter++ );
268} 270}
269MainWindow::~MainWindow() { 271MainWindow::~MainWindow() {
270 delete templateManager(); 272 delete templateManager();
271} 273}