Diffstat (limited to 'core/pim/datebook2/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook2/mainwindow.cpp | 178 |
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 | ||
16 | MainWindow::MainWindow() | 24 | MainWindow::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 | } |
26 | MainWindow::~MainWindow() { | 43 | MainWindow::~MainWindow() { |
27 | |||
28 | } | 44 | } |
29 | void MainWindow::doSetDocument( const QString& str ) { | 45 | void MainWindow::doSetDocument( const QString& str ) { |
30 | 46 | ||
31 | } | 47 | } |
32 | void MainWindow::flush() { | 48 | void MainWindow::flush() { |
33 | 49 | manager()->save(); | |
34 | } | 50 | } |
35 | void MainWindow::reload() { | 51 | void MainWindow::reload() { |
36 | 52 | manager()->reload(); | |
37 | } | 53 | } |
38 | int MainWindow::create() { | 54 | int MainWindow::create() { |
39 | 55 | return 0; | |
40 | } | 56 | } |
41 | bool MainWindow::remove( int uid ) { | 57 | bool MainWindow::remove( int uid ) { |
42 | 58 | manager()->remove( uid ); | |
59 | return true; | ||
43 | } | 60 | } |
44 | void MainWindow::beam( int uid ) { | 61 | void MainWindow::beam( int uid ) { |
45 | 62 | ||
46 | } | 63 | } |
47 | void MainWindow::show( int uid ) { | 64 | void MainWindow::show( int uid ) { |
48 | 65 | ||
66 | eventShow()->show( manager()->event( uid ) ); | ||
49 | } | 67 | } |
50 | void MainWindow::add( const OPimRecord& ) { | 68 | void MainWindow::add( const OPimRecord& ad) { |
51 | 69 | manager()->add( ad ); | |
70 | } | ||
71 | void MainWindow::edit() { | ||
72 | edit ( currentView()->currentItem() ); | ||
52 | } | 73 | } |
53 | void MainWindow::edit( int uid ) { | 74 | void MainWindow::edit( int uid ) { |
54 | 75 | ||
55 | } | 76 | } |
77 | /* | ||
78 | * init tool bars layout and so on | ||
79 | */ | ||
56 | void MainWindow::initUI() { | 80 | void 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 | } |
59 | void MainWindow::initConfig() { | 141 | void MainWindow::initConfig() { |
60 | 142 | ||
@@ -63,8 +145,82 @@ void MainWindow::initView() { | |||
63 | 145 | ||
64 | } | 146 | } |
65 | void MainWindow::initManagers() { | 147 | void MainWindow::initManagers() { |
66 | 148 | m_manager = new BookManager; | |
149 | m_locMan = new LocationManager( tr("Locations") ); | ||
150 | m_descMan = new DescriptionManager( tr("Descriptions") ); | ||
67 | } | 151 | } |
68 | void MainWindow::raiseCurrentView() { | 152 | void MainWindow::raiseCurrentView() { |
69 | 153 | ||
70 | } | 154 | } |
155 | /* | ||
156 | * populate the view | ||
157 | */ | ||
158 | void MainWindow::populate() { | ||
159 | if (!manager()->isLoaded() ) | ||
160 | manager()->load(); | ||
161 | } | ||
162 | void MainWindow::slotGoToNow() { | ||
163 | |||
164 | } | ||
165 | View* MainWindow::currentView() { | ||
166 | |||
167 | } | ||
168 | void MainWindow::slotFind() { | ||
169 | |||
170 | } | ||
171 | void MainWindow::slotConfigure() { | ||
172 | |||
173 | } | ||
174 | void MainWindow::slotClockChanged( bool ) { | ||
175 | |||
176 | } | ||
177 | void MainWindow::slotWeekChanged(bool ) { | ||
178 | |||
179 | } | ||
180 | void MainWindow::slotAppMessage( const QCString&, const QByteArray& ) { | ||
181 | |||
182 | } | ||
183 | void MainWindow::slotReceive( const QCString&, const QByteArray& ) { | ||
184 | |||
185 | } | ||
186 | BookManager* MainWindow::manager() { | ||
187 | return m_manager; | ||
188 | } | ||
189 | TemplateManager* MainWindow::templateManager() { | ||
190 | return m_tempMan; | ||
191 | } | ||
192 | LocationManager* MainWindow::locationManager() { | ||
193 | return m_locMan; | ||
194 | } | ||
195 | DescriptionManager* MainWindow::descriptionManager() { | ||
196 | return m_descMan; | ||
197 | } | ||
198 | Show* MainWindow::eventShow() { | ||
199 | return m_show; | ||
200 | } | ||
201 | void MainWindow::slotAction( QAction* act ) { | ||
202 | |||
203 | } | ||
204 | void MainWindow::slotConfigureLocs() { | ||
205 | |||
206 | } | ||
207 | void MainWindow::slotConfigureDesc() { | ||
208 | |||
209 | } | ||
210 | void MainWindow::hideShow() { | ||
211 | |||
212 | } | ||
213 | void MainWindow::viewPopup(int ) { | ||
214 | |||
215 | } | ||
216 | void MainWindow::viewAdd(const QDate& ) { | ||
217 | |||
218 | } | ||
219 | void MainWindow::viewAdd( const QDateTime&, const QDateTime& ) { | ||
220 | |||
221 | } | ||
222 | bool MainWindow::viewAP()const{ | ||
223 | } | ||
224 | bool MainWindow::viewStartMonday()const { | ||
225 | |||
226 | } | ||