summaryrefslogtreecommitdiff
path: root/core/pim/datebook2/mainwindow.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook2/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook2/mainwindow.cpp178
1 files changed, 167 insertions, 11 deletions
diff --git a/core/pim/datebook2/mainwindow.cpp b/core/pim/datebook2/mainwindow.cpp
index 2f214b8..44de6b0 100644
--- a/core/pim/datebook2/mainwindow.cpp
+++ b/core/pim/datebook2/mainwindow.cpp
@@ -1,13 +1,21 @@
1
2#include <qcopchannel_qws.h>
1#include <qwidgetstack.h> 3#include <qwidgetstack.h>
2#include <qlabel.h> 4#include <qlabel.h>
3#include <qaction.h> 5#include <qaction.h>
6#include <qpopupmenu.h>
7#include <qtimer.h>
4 8
9#include <qpe/qpeapplication.h>
5#include <qpe/ir.h> 10#include <qpe/ir.h>
6#include <qpe/qpemenubar.h> 11#include <qpe/qpemenubar.h>
12#include <qpe/qpetoolbar.h>
7#include <qpe/qpemessagebox.h> 13#include <qpe/qpemessagebox.h>
8#include <qpe/resource.h> 14#include <qpe/resource.h>
9 15
10 16#include "show.h"
17#include "templatemanager.h"
18#include "bookmanager.h"
11#include "mainwindow.h" 19#include "mainwindow.h"
12 20
13 21
@@ -15,46 +23,120 @@ using namespace Datebook;
15 23
16MainWindow::MainWindow() 24MainWindow::MainWindow()
17 : OPimMainWindow( "Datebook", 0, 0 ) { 25 : OPimMainWindow( "Datebook", 0, 0 ) {
26 setIcon( Resource::loadPixmap( "datebook_icon" ) );
18 initUI(); 27 initUI();
19 initConfig();
20 initView();
21 initManagers(); 28 initManagers();
29 initView();
30 initConfig();
22 31
23 raiseCurrentView(); 32 raiseCurrentView();
24 QTimer::singleShot(0, this, SLOT(populate() ) ); 33 QTimer::singleShot(0, this, SLOT(populate() ) );
34
35 QCopChannel* chan = new QCopChannel( "QPE/System", this );
36 connect( chan, SIGNAL( received(const QCString&, const QByteArray& ) ),
37 this, SLOT( slotReceive( const QCString&, const QByteArray& ) ) );
38
39 chan = new QCopChannel( "QPE/Datebook", this );
40 connect( chan, SIGNAL( received(const QCString&, const QByteArray& ) ),
41 this, SLOT( slotReceive( const QCString&, const QByteArray& ) ) );
25} 42}
26MainWindow::~MainWindow() { 43MainWindow::~MainWindow() {
27
28} 44}
29void MainWindow::doSetDocument( const QString& str ) { 45void MainWindow::doSetDocument( const QString& str ) {
30 46
31} 47}
32void MainWindow::flush() { 48void MainWindow::flush() {
33 49 manager()->save();
34} 50}
35void MainWindow::reload() { 51void MainWindow::reload() {
36 52 manager()->reload();
37} 53}
38int MainWindow::create() { 54int MainWindow::create() {
39 55 return 0;
40} 56}
41bool MainWindow::remove( int uid ) { 57bool MainWindow::remove( int uid ) {
42 58 manager()->remove( uid );
59 return true;
43} 60}
44void MainWindow::beam( int uid ) { 61void MainWindow::beam( int uid ) {
45 62
46} 63}
47void MainWindow::show( int uid ) { 64void MainWindow::show( int uid ) {
48 65
66 eventShow()->show( manager()->event( uid ) );
49} 67}
50void MainWindow::add( const OPimRecord& ) { 68void MainWindow::add( const OPimRecord& ad) {
51 69 manager()->add( ad );
70}
71void MainWindow::edit() {
72 edit ( currentView()->currentItem() );
52} 73}
53void MainWindow::edit( int uid ) { 74void MainWindow::edit( int uid ) {
54 75
55} 76}
77/*
78 * init tool bars layout and so on
79 */
56void MainWindow::initUI() { 80void MainWindow::initUI() {
81 setToolBarsMovable( false );
82
83 m_stack = new QWidgetStack( this );
84 setCentralWidget( m_stack );
85
86 m_toolBar = new QPEToolBar( this );
87 m_toolBar->setHorizontalStretchable( TRUE );
88
89 QPEMenuBar* mb = new QPEMenuBar( m_toolBar );
57 90
91 m_popView = new QPopupMenu( this );
92 m_popSetting = new QPopupMenu( this );
93
94 mb->insertItem( tr("View"), m_popView );
95 mb->insertItem( tr("Settings" ), m_popSetting );
96
97 m_popTemplate = new QPopupMenu( this );
98 m_popView->insertItem(tr("New from template"), m_popTemplate, -1, 0);
99
100 QAction* a = new QAction( tr("New Event"), Resource::loadPixmap("new"),
101 QString::null, 0, this, 0 );
102 a->addTo( m_toolBar );
103 a->addTo( m_popView );
104 connect(a, SIGNAL( activated() ), this, SLOT( create() ) );
105
106 a = new QAction( tr("Edit Event"), Resource::loadPixmap("edit"),
107 QString::null, 0, this, 0 );
108 a->addTo( m_popView );
109 connect(a, SIGNAL( activated() ), this, SLOT( edit() ) );
110
111 a = new QAction( tr("Today" ), Resource::loadPixmap( "datebook/to_day"),
112 QString::null, 0, this, 0 );
113 a->addTo( m_toolBar );
114 connect(a, SIGNAL( activated() ), this, SLOT( slotGoToNow() ) );
115
116 a = new QAction( tr("Find"), Resource::loadPixmap( "mag" ),
117 QString::null, 0, this, 0 );
118 a->addTo( m_toolBar );
119 connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
120
121 a = new QAction( tr("Configure"), QString::null, 0, 0 );
122 a->addTo( m_popSetting );
123 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) );
124
125 a = new QAction( tr("Configure Locations"), QString::null, 0, 0 );
126 a->addTo( m_popSetting );
127 connect(a, SIGNAL( activated() ), this, SLOT( slotConfigureLocs() ) );
128
129 a = new QAction( tr("Configure Descriptions"), QString::null, 0, 0 );
130 a->addTo( m_popSetting );
131 connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureDesc() ) );
132
133 connect( qApp, SIGNAL(clockChanged(bool) ),
134 this, SLOT(slotClockChanged(bool) ) );
135 connect( qApp, SIGNAL(weekChanged(bool) ),
136 this, SLOT(slotWeekChanged(bool) ) );
137
138 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ),
139 this, SLOT(slotAppMessage( const QCString&, const QByteArray& ) ) );
58} 140}
59void MainWindow::initConfig() { 141void MainWindow::initConfig() {
60 142
@@ -63,8 +145,82 @@ void MainWindow::initView() {
63 145
64} 146}
65void MainWindow::initManagers() { 147void MainWindow::initManagers() {
66 148 m_manager = new BookManager;
149 m_locMan = new LocationManager( tr("Locations") );
150 m_descMan = new DescriptionManager( tr("Descriptions") );
67} 151}
68void MainWindow::raiseCurrentView() { 152void MainWindow::raiseCurrentView() {
69 153
70} 154}
155/*
156 * populate the view
157 */
158void MainWindow::populate() {
159 if (!manager()->isLoaded() )
160 manager()->load();
161}
162void MainWindow::slotGoToNow() {
163
164}
165View* MainWindow::currentView() {
166
167}
168void MainWindow::slotFind() {
169
170}
171void MainWindow::slotConfigure() {
172
173}
174void MainWindow::slotClockChanged( bool ) {
175
176}
177void MainWindow::slotWeekChanged(bool ) {
178
179}
180void MainWindow::slotAppMessage( const QCString&, const QByteArray& ) {
181
182}
183void MainWindow::slotReceive( const QCString&, const QByteArray& ) {
184
185}
186BookManager* MainWindow::manager() {
187 return m_manager;
188}
189TemplateManager* MainWindow::templateManager() {
190 return m_tempMan;
191}
192LocationManager* MainWindow::locationManager() {
193 return m_locMan;
194}
195DescriptionManager* MainWindow::descriptionManager() {
196 return m_descMan;
197}
198Show* MainWindow::eventShow() {
199 return m_show;
200}
201void MainWindow::slotAction( QAction* act ) {
202
203}
204void MainWindow::slotConfigureLocs() {
205
206}
207void MainWindow::slotConfigureDesc() {
208
209}
210void MainWindow::hideShow() {
211
212}
213void MainWindow::viewPopup(int ) {
214
215}
216void MainWindow::viewAdd(const QDate& ) {
217
218}
219void MainWindow::viewAdd( const QDateTime&, const QDateTime& ) {
220
221}
222bool MainWindow::viewAP()const{
223}
224bool MainWindow::viewStartMonday()const {
225
226}