summaryrefslogtreecommitdiff
authorzecke <zecke>2003-02-22 22:59:37 (UTC)
committer zecke <zecke>2003-02-22 22:59:37 (UTC)
commit47fc358e914aecd13c4cb3d9cb4b3f2ca1a93b6c (patch) (unidiff)
tree034af2ca8bb5ee3e0b751739f9f9a9fbcc241530
parent00c146960fa7fd05dc56fac2a24b3d7968a4a772 (diff)
downloadopie-47fc358e914aecd13c4cb3d9cb4b3f2ca1a93b6c.zip
opie-47fc358e914aecd13c4cb3d9cb4b3f2ca1a93b6c.tar.gz
opie-47fc358e914aecd13c4cb3d9cb4b3f2ca1a93b6c.tar.bz2
import the new layout/design of datebook
sorry this was not put into a branch and once its done it'll replace datebook and be put into that subdir. but currently I want both versions available so I can test... So by design it'll feature Showing BirthDays Showing Due and OVerDue Todos Better AllDay handling Pinning Events to TimeZones Exceptions to Recurrence
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook2/.cvsignore18
-rw-r--r--core/pim/datebook2/DESIGN29
-rw-r--r--core/pim/datebook2/bookmanager.h40
-rw-r--r--core/pim/datebook2/datebook2.pro13
-rw-r--r--core/pim/datebook2/descriptionmanager.h11
-rw-r--r--core/pim/datebook2/editor.h36
-rw-r--r--core/pim/datebook2/locationmanager.h14
-rw-r--r--core/pim/datebook2/main.cpp15
-rw-r--r--core/pim/datebook2/mainwindow.cpp70
-rw-r--r--core/pim/datebook2/mainwindow.h41
-rw-r--r--core/pim/datebook2/managertemplate.h36
-rw-r--r--core/pim/datebook2/show.h44
-rw-r--r--core/pim/datebook2/stringmanager.h46
-rw-r--r--core/pim/datebook2/templatemanager.h36
-rw-r--r--core/pim/datebook2/view.h122
15 files changed, 571 insertions, 0 deletions
diff --git a/core/pim/datebook2/.cvsignore b/core/pim/datebook2/.cvsignore
new file mode 100644
index 0000000..fdde933
--- a/dev/null
+++ b/core/pim/datebook2/.cvsignore
@@ -0,0 +1,18 @@
1Makefile*
2datebookdayheader.cpp
3datebookdayheader.h
4datebooksettingsbase.cpp
5datebooksettingsbase.h
6datebookweekheader.cpp
7datebookweekheader.h
8datebookweeklstdayhdr.cpp
9datebookweeklstdayhdr.h
10datebookweeklstheader.cpp
11datebookweeklstheader.h
12dateentry.cpp
13dateentry.h
14moc_*
15noteentry.cpp
16noteentry.h
17repeatentrybase.cpp
18repeatentrybase.h
diff --git a/core/pim/datebook2/DESIGN b/core/pim/datebook2/DESIGN
new file mode 100644
index 0000000..7442e81
--- a/dev/null
+++ b/core/pim/datebook2/DESIGN
@@ -0,0 +1,29 @@
1A small abstract about the design
2
3First of all we've a namespace called Datebook
4
5class MainWindow is our QMainWindow and PimMainWindow
6 it's the center of all datebook operations.
7 It loads all Views, Configs, Shows, Manager
8 and dispatches between them
9
10the Interface declarations use protected methods instead
11of signals because templates and signals does not match
12that nicely.
13I add friend declarations to the mainwindow so that we've a
14tight interface of interactions and know that it works.
15friend can not be inherited so all got enough abstraction. The
16dependency on the MainWindow is acceptable.
17
18Then we've a small DB Manager class which is responsible
19for controlling the ODateBookAccess class and to resolve
20other records ( due todo items, Birthdays.. )
21
22Show - Show can show richtext of OEvent
23View - The basic view
24MainWindow - The mainwindow with all the actions
25Editor - The editor interface to edit and create OEvents
26AlarmManager - A widget to take care of alarm activation
27ManagerTemplate,StringManager - Responsible for managing strings
28 for the Location and Description ComboBox
29TemplateManager - the OEvent TemplateManager \ No newline at end of file
diff --git a/core/pim/datebook2/bookmanager.h b/core/pim/datebook2/bookmanager.h
new file mode 100644
index 0000000..44ad8ed
--- a/dev/null
+++ b/core/pim/datebook2/bookmanager.h
@@ -0,0 +1,40 @@
1#ifndef OPIE_DATE_BOOK_MANAGER_H
2#define OPIE_DATE_BOOK_MANAGER_H
3
4#include <qlist.h>
5
6#include <opie/opimrecord.h>
7#include <opie/odatebookaccess.h>
8
9namespace Datebook {
10 /**
11 * book manager is responsible for managing the
12 * access
13 * All access to the underlying API will be done
14 * through this class
15 */
16 class BookManager {
17 public:
18 BookManager();
19 ~BookManager();
20
21 bool isLoaded()const;
22 bool load();
23 bool save();
24
25 OEvent event( int uid );
26 OEffectiveEvent::ValueList list( const QDate& from,
27 const QDate& to );
28 ODateBookAccess::List allRecords()const;
29
30 void add( const OEvent& );
31 void update( const OEvent& );
32 void remove( int uid );
33 void remove( const QArray<int>& );
34
35 QPtrList<OPimRecord> records( const QDate& from,
36 const QDate& to );
37 };
38}
39
40#endif
diff --git a/core/pim/datebook2/datebook2.pro b/core/pim/datebook2/datebook2.pro
new file mode 100644
index 0000000..9d6ef4c
--- a/dev/null
+++ b/core/pim/datebook2/datebook2.pro
@@ -0,0 +1,13 @@
1 TEMPLATE= app
2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS= mainwindow.h
5 SOURCES= main.cpp \
6 mainwindow.cpp
7
8INCLUDEPATH += $(OPIEDIR)/include
9 DEPENDPATH+= $(OPIEDIR)/include
10LIBS += -lqpe -lopie
11 TARGET = datebook2
12
13include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/datebook2/descriptionmanager.h b/core/pim/datebook2/descriptionmanager.h
new file mode 100644
index 0000000..5ab5769
--- a/dev/null
+++ b/core/pim/datebook2/descriptionmanager.h
@@ -0,0 +1,11 @@
1#ifndef OPIE_DATEBOOK_DESCRIPTION_MANAGER_H
2#define OPIE_DATEBOOK_DESCRIPTION_MANAGER_H
3
4#include "stringmanager.h"
5
6namespace Datebook {
7 typedef StringManager DescriptionManager;
8 typedef StringManagerDialog DescriptionManagerDialog;
9}
10
11#endif
diff --git a/core/pim/datebook2/editor.h b/core/pim/datebook2/editor.h
new file mode 100644
index 0000000..53e8718
--- a/dev/null
+++ b/core/pim/datebook2/editor.h
@@ -0,0 +1,36 @@
1#ifndef OPIE_DATEBOOK_EDITOR_H
2#define OPIE_DATEBOOK_EDITOR_H
3
4#include <qdialog.h>
5
6#include <opie/oevent.h>
7
8#include "descriptionmanager.h"
9#include "locationmanager.h"
10
11namespace Datebook {
12 class MainWindow;
13 /**
14 * This is the editor interface
15 */
16 class Editor {
17 public:
18 Editor( MainWindow*, QWidget* parent );
19 virtual Editor();
20
21 bool newEvent( const QDate& );
22 bool newEvent( const QDateTime& start, const QDateTime& end );
23 bool edit( const OEvent& );
24
25 OEvent event()const;
26
27 protected:
28 DescriptionManager descriptions()const;
29 LocationManager locations()const;
30 void setDescriptions( const DescriptionManager& );
31 void setLocations( const LocationManager& );
32
33 };
34}
35
36#endif
diff --git a/core/pim/datebook2/locationmanager.h b/core/pim/datebook2/locationmanager.h
new file mode 100644
index 0000000..102480f
--- a/dev/null
+++ b/core/pim/datebook2/locationmanager.h
@@ -0,0 +1,14 @@
1#ifndef OPIE_LOCATION_MANAGER_H
2#define OPIE_LOCATION_MANAGER_H
3
4#include "stringmanager.h"
5
6namespace Datebook {
7 /**
8 * life can be so simple
9 */
10 typedef StringManager LocationManager;
11 typedef StringManagerDialog LocationManagerDialog;
12}
13
14#endif
diff --git a/core/pim/datebook2/main.cpp b/core/pim/datebook2/main.cpp
new file mode 100644
index 0000000..14bdc60
--- a/dev/null
+++ b/core/pim/datebook2/main.cpp
@@ -0,0 +1,15 @@
1#include "mainwindow.h"
2
3#include <qpe/qpeapplication.h>
4
5
6int main( int argc, char* argv[] ) {
7 QPEApplication app( argc, argv );
8
9 Datebook::MainWindow mw;
10 mw.setCaption( QObject::tr("Opie Datebook") );
11
12 app.showMainWidget( &mw );
13
14 return app.exec();
15}
diff --git a/core/pim/datebook2/mainwindow.cpp b/core/pim/datebook2/mainwindow.cpp
new file mode 100644
index 0000000..2f214b8
--- a/dev/null
+++ b/core/pim/datebook2/mainwindow.cpp
@@ -0,0 +1,70 @@
1#include <qwidgetstack.h>
2#include <qlabel.h>
3#include <qaction.h>
4
5#include <qpe/ir.h>
6#include <qpe/qpemenubar.h>
7#include <qpe/qpemessagebox.h>
8#include <qpe/resource.h>
9
10
11#include "mainwindow.h"
12
13
14using namespace Datebook;
15
16MainWindow::MainWindow()
17 : OPimMainWindow( "Datebook", 0, 0 ) {
18 initUI();
19 initConfig();
20 initView();
21 initManagers();
22
23 raiseCurrentView();
24 QTimer::singleShot(0, this, SLOT(populate() ) );
25}
26MainWindow::~MainWindow() {
27
28}
29void MainWindow::doSetDocument( const QString& str ) {
30
31}
32void MainWindow::flush() {
33
34}
35void MainWindow::reload() {
36
37}
38int MainWindow::create() {
39
40}
41bool MainWindow::remove( int uid ) {
42
43}
44void MainWindow::beam( int uid ) {
45
46}
47void MainWindow::show( int uid ) {
48
49}
50void MainWindow::add( const OPimRecord& ) {
51
52}
53void MainWindow::edit( int uid ) {
54
55}
56void MainWindow::initUI() {
57
58}
59void MainWindow::initConfig() {
60
61}
62void MainWindow::initView() {
63
64}
65void MainWindow::initManagers() {
66
67}
68void MainWindow::raiseCurrentView() {
69
70}
diff --git a/core/pim/datebook2/mainwindow.h b/core/pim/datebook2/mainwindow.h
new file mode 100644
index 0000000..5ea0c89
--- a/dev/null
+++ b/core/pim/datebook2/mainwindow.h
@@ -0,0 +1,41 @@
1#ifndef DATE_BOOK_MAIN_WINDOW_H
2#define DATE_BOOK_MAIN_WINDOW_H
3
4#include <qlist.h>
5
6#include <opie/opimmainwindow.h>
7
8namespace Datebook {
9
10 class MainWindow : public OPimMainWindow {
11 Q_OBJECT
12 public:
13 MainWindow();
14 ~MainWindow();
15
16 private slots:
17 void initUI(); // init the UI
18 void initConfig(); // apply the config
19 void initView(); // init the Views..
20 void initManagers(); // init the Managers including templates, location and description
21 void raiseCurrentView(); // raise the current View
22
23 protected slots:
24 void populate();
25 void doSetDocument( const QString& str );
26 void flush();
27 void reload();
28 int create();
29 bool remove( int uid );
30 void beam( int uid );
31 void show( int uid );
32 void edit( int uid );
33 void add( const OPimRecord& );
34
35 private:
36 QList<View> m_view; // the Views.. not autoDelete
37
38 };
39}
40
41#endif
diff --git a/core/pim/datebook2/managertemplate.h b/core/pim/datebook2/managertemplate.h
new file mode 100644
index 0000000..668fda7
--- a/dev/null
+++ b/core/pim/datebook2/managertemplate.h
@@ -0,0 +1,36 @@
1#ifndef OPIE_DATE_BOOK_MANAGER_TEMPLATE_H
2#define OPIE_DATE_BOOK_MANAGER_TEMPLATE_H
3
4#include <qdialog.h>
5#include <qstring.h>
6
7namespace Datebook {
8 /**
9 * ManagerTemplate is a template which manages
10 * all kind of managers :)
11 */
12 template<class T>
13 class ManagerTemplate {
14 public:
15 ManagerTemplate();
16 ~ManagerTemplate();
17
18 virtual void add( const QString&, const T& t );
19 void remove( const QString& );
20 bool load();
21 bool save();
22
23 QStringList names();
24 T value(const QString&)const;
25
26 protected:
27 QMap<QString, T> m_map;
28
29 private:
30 virtual bool doSave() = 0;
31 virtual bool doLoad() = 0;
32
33 };
34}
35
36#endif
diff --git a/core/pim/datebook2/show.h b/core/pim/datebook2/show.h
new file mode 100644
index 0000000..37d22fe
--- a/dev/null
+++ b/core/pim/datebook2/show.h
@@ -0,0 +1,44 @@
1#ifndef OPIE_DATEBOOK_SHOW_H
2#define OPIE_DATEBOOK_SHOW_H
3
4#include <qstring.h>
5
6#include <opie/oevent.h>
7
8namespace Datebook {
9 class MainWindow;
10
11 /**
12 * here is the show
13 * The show interface will
14 * show the richtext information
15 * of the OEvent
16 */
17 class Show {
18 public:
19 /**
20 * mainwindow as parent
21 */
22 Show(MainWindow* );
23 virtual ~Show();
24
25 /**
26 * show the OEvent
27 */
28 void show(const OEvent& str);
29
30 /**
31 * the Widget
32 */
33 virtual QWidget* widget() = 0;
34 protected:
35 /**
36 * the show is over
37 * ask the mainwindow to hide
38 */
39 void hideMe();
40
41 };
42}
43
44#endif
diff --git a/core/pim/datebook2/stringmanager.h b/core/pim/datebook2/stringmanager.h
new file mode 100644
index 0000000..a11bd2a
--- a/dev/null
+++ b/core/pim/datebook2/stringmanager.h
@@ -0,0 +1,46 @@
1#ifndef OPIE_STRING_DATEBOOK_MANAGER_H
2#define OPIE_STRING_DATEBOOK_MANAGER_H
3
4#include <qstring.h>
5
6#include "managertemplate.h"
7
8namespace Datebook {
9 /**
10 * StringManager is a generic manager
11 * whick keeps track of strings
12 * It'll be used with the Location
13 * and the Description Manager
14 */
15 class StringManager : public ManagerTemplate<QString> {
16 public:
17 /**
18 * baseName is used for storing
19 */
20 StringManager(const QString& baseName);
21 ~StringManager();
22
23 /**
24 * override the add implementation
25 * cause we do not have a value :)
26 */
27 void add( const QString& );
28 private:
29 void doLoad();
30 void doSave();
31 };
32
33 /**
34 * A Generic Editor for StringManager
35 */
36 class StringManagerDialog : public QDialog {
37 Q_OBJECT
38 public:
39 StringManagerDialog( const StringManager& );
40 ~StringManager();
41
42 StringManager manager()const;
43 };
44}
45
46#endif
diff --git a/core/pim/datebook2/templatemanager.h b/core/pim/datebook2/templatemanager.h
new file mode 100644
index 0000000..f885677
--- a/dev/null
+++ b/core/pim/datebook2/templatemanager.h
@@ -0,0 +1,36 @@
1#ifndef OPIE_DATEBOOK_TEMPLATE_MANAGER_ZECKE_H_RANDOM_CAUSE_BJARNE
2#define OPIE_DATEBOOK_TEMPLATE_MANAGER_ZECKE_H_RANDOM_CAUSE_BJARNE
3
4#include <qobject.h>
5
6#include <opie/oevent.h>
7
8#include "managertemplate.h"
9
10namespace Datebook {
11 /**
12 * The OEvent Template Manager
13 */
14 class TemplateManager : public ManagerTemplate<OEvent> {
15 public:
16 TemplateManager();
17 ~TemplateManager();
18
19 private:
20 virtual bool doSave();
21 virtual bool doLoad();
22 };
23 /**
24 * a QDialog for editing it
25 */
26 class TemplateDialog : public QDialog {
27 Q_OBJECT
28 public:
29 TemplateDialog(const TemplateManager& man);
30 ~TemplateDialog();
31
32 virtual TemplateManager manager()const;
33 };
34}
35
36#endif
diff --git a/core/pim/datebook2/view.h b/core/pim/datebook2/view.h
new file mode 100644
index 0000000..a7bc1d8
--- a/dev/null
+++ b/core/pim/datebook2/view.h
@@ -0,0 +1,122 @@
1#ifndef OPIE_DATE_BOOK_VIEW_H
2#define OPIE_DATE_BOOK_VIEW_H
3
4#include <qpixmap.h>
5#include <qwidget.h>
6
7#include <opie/oevent.h>
8#include <opie/odatebookaccess.h>
9
10class Config;
11namespace Datebook {
12 class MainWindow;
13 class View {
14 public:
15 View( MainWindow* window, QWidget* parent );
16 virtual ~View() = 0;
17
18 static QDate dateFromWeek( int week, int year, bool startOnMonda );
19 static bool calcWeek( const QDate& d, int &week, int &year, bool startOnMonday = false );
20
21 virtual QPixmap pixmap()const = 0;
22 virtual QString description()const = 0;
23
24 /**
25 * loadConfig
26 * saveConfig
27 */
28 void loadConfig( Config* );
29 void saveConfig( Config* );
30
31 /**
32 * the current range
33 */
34 void currentRange( const QDateTime& src, const QDateTime& from);
35
36 /**
37 * the clock format changed
38 */
39 virtual void clockChanged() = 0;
40
41 /**
42 * the day change means that either
43 * monday or sunday is the week start
44 */
45 virtual void dayChanged() = 0;
46
47 /**
48 * show date in your view!!
49 */
50 virtual void showDay( const QDate& date ) = 0;
51
52 /**
53 * return the widget
54 */
55 virtual QWidget* widget();
56
57 /**
58 * the view needs an update!
59 */
60 virtual void reschedule() = 0
61 protected:
62 void popup( int );
63 QString toShortText(const OEffectiveEvent& eff)const;
64 QString toText(const OEffectiveEvent& eff)const;
65 virtual void doLoadConfig( Config* ) = 0;
66 virtual void doSaveConfig( Config* ) = 0;
67
68 /**
69 * create a new event starting
70 * on start
71 */
72 void add( const QDate& start );
73
74 /**
75 * create a new event in a given range
76 */
77 void add( const QDateTime& start, const QDateTime& end );
78
79 /**
80 * will make the MainWindow to open the editor
81 */
82 void edit( int uid );
83
84 /**
85 * remove item with uid
86 */
87 void remove( int uid );
88
89 /**
90 * give access to all events
91 */
92 ODateBookAccess::List allEvents()const;
93
94 /**
95 * return events
96 */
97 OEffectiveEvent::ValueList events( const QDate& start, const QDate& end );
98
99 /**
100 * return an Event
101 */
102 OEvent event( int uid )const;
103
104 /**
105 * Is the clock AP/PM or 24h?
106 */
107 bool isAP()const;
108
109 /**
110 * if the week starts on monday?
111 */
112 bool weekStartOnMonday()const;
113
114 /**
115 * return related records for days
116 */
117 QPtrList<OPimRecord> records( const QDate& on );
118 QPtrList<OPimRecord> records( const QDate& start, const QDate& to );
119 };
120}
121
122#endif