summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Side-by-side diff
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 @@
     +  .  -:.       = 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
  -_. . .   )=.  = 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 <unistd.h>
#include <opie2/opimrecurrence.h>
#include <opie2/opimnotifymanager.h>
#include <opie2/otodoaccessvcal.h>
#include <opie2/oapplicationfactory.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/ir.h>
#include <qpe/resource.h>
#include <qpe/qpemessagebox.h>
#include <qpe/alarmserver.h>
#include <qpe/qpeapplication.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qaction.h>
#include <qtimer.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include "quickeditimpl.h"
#include "todotemplatemanager.h"
#include "templateeditor.h"
#include "tableview.h"
#include "textviewshow.h"
#include "todoeditor.h"
#include "mainwindow.h"
+using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
+ using namespace Opie;
using namespace Todo;
MainWindow::MainWindow( QWidget* parent,
const char* name, WFlags )
: Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
{
if (!name)
setName("todo window");
m_syncing = false;
m_showing = false;
m_counter = 0;
m_tempManager = new TemplateManager();
m_tempManager->load();
initUI();
initConfig();
initViews();
initActions();
initEditor();
initShow();
initTemplate();
populateTemplates();
raiseCurrentView();
QTimer::singleShot(0, this, SLOT(populateCategories() ) );
}
void MainWindow::initTemplate() {
m_curTempEd = new TemplateEditor( this, templateManager() );
}
void MainWindow::initActions() {
// Data menu
m_edit->insertItem(QWidget::tr("New from template"), m_template,
-1, 0 );
QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
connect(a, SIGNAL( activated() ),
this, SLOT( slotNew() ) );
a->setWhatsThis( QWidget::tr( "Click here to create a new task." ) );
a->addTo(m_tool );
a->addTo(m_edit );
a = new QAction( QWidget::tr("Edit Task"), Resource::loadIconSet( "edit" ),
QString::null, 0, this, 0 );
connect(a, SIGNAL(activated() ),
this, SLOT( slotEdit() ) );
@@ -175,97 +177,97 @@ void MainWindow::initActions() {
m_completedAction = new QAction( QString::null, QWidget::tr("Show completed tasks"),
0, this, 0, TRUE );
m_completedAction->addTo( m_options );
m_completedAction->setOn( showCompleted() );
connect(m_completedAction, SIGNAL( toggled(bool) ), this, SLOT(slotShowCompleted(bool) ) );
a = new QAction( QString::null, QWidget::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, QWidget::tr("Show task deadlines"),
0, this, 0, TRUE );
m_showDeadLineAction->addTo( m_options );
m_showDeadLineAction->setOn( showDeadline() );
connect(m_showDeadLineAction, SIGNAL(toggled(bool) ), this, SLOT( slotShowDeadLine(bool) ) );
m_showQuickTaskAction = new QAction( QString::null, QWidget::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) ) );
m_options->insertSeparator();
m_bar->insertItem( QWidget::tr("Data") ,m_edit );
m_bar->insertItem( QWidget::tr("Category"), m_catMenu );
m_bar->insertItem( QWidget::tr("Options"), m_options );
m_curQuick = new QuickEditImpl( this, m_quicktask );
addToolBar( (QToolBar *)m_curQuick->widget(), QWidget::tr( "QuickEdit" ), QMainWindow::Top, TRUE );
m_curQuick->signal()->connect( this, SLOT(slotQuickEntered() ) );
}
/* m_curCat from Config */
void MainWindow::initConfig() {
Config config( "todo" );
config.setGroup( "View" );
m_completed = config.readBoolEntry( "ShowComplete", TRUE );
m_curCat = config.readEntry( "Category", QString::null );
m_deadline = config.readBoolEntry( "ShowDeadLine", TRUE);
m_overdue = config.readBoolEntry("ShowOverDue", FALSE );
m_quicktask = config.readBoolEntry("ShowQuickTask", TRUE);
}
void MainWindow::initUI() {
- m_stack = new OWidgetStack(this, "main stack");
+ m_stack = new Opie::Ui::OWidgetStack(this, "main stack");
setCentralWidget( m_stack );
setToolBarsMovable( FALSE );
QToolBar *menubarholder = new QToolBar( this );
menubarholder->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( menubarholder );
m_tool = new QToolBar( this );
/** QPopupMenu */
m_edit = new QPopupMenu( this );
m_options = new QPopupMenu( this );
m_catMenu = new QPopupMenu( this );
m_template = new QPopupMenu( this );
m_catMenu->setCheckable( TRUE );
m_template->setCheckable( TRUE );
connect(m_catMenu, SIGNAL(activated(int) ),
this, SLOT(setCategory(int) ) );
connect(m_template, SIGNAL(activated(int) ),
this, SLOT(slotNewFromTemplate(int) ) );
}
void MainWindow::initViews() {
TableView* tableView = new TableView( this, m_stack );
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." ) );
m_stack->addWidget( tableView, m_counter++ );
m_views.append( tableView );
m_curView = tableView;
connectBase( tableView );
/* add QString type + QString configname to
* the View menu
* and subdirs for multiple views
*/
}
void MainWindow::initEditor() {
m_curEdit = new Editor();
}
void MainWindow::initShow() {
m_curShow = new TextViewShow(this, this);
m_stack->addWidget( m_curShow->widget() , m_counter++ );
}
MainWindow::~MainWindow() {
delete templateManager();
}