summaryrefslogtreecommitdiff
authorhrw <hrw>2005-10-20 14:55:34 (UTC)
committer hrw <hrw>2005-10-20 14:55:34 (UTC)
commit57abd83eb7b79b95301de36dc178174d9b28b6c2 (patch) (unidiff)
treeb869bb94ec37a278bfed66877a1320d807399f94
parent0f25331618ea6cac8a59f2c2298a9e1684748b97 (diff)
downloadopie-57abd83eb7b79b95301de36dc178174d9b28b6c2.zip
opie-57abd83eb7b79b95301de36dc178174d9b28b6c2.tar.gz
opie-57abd83eb7b79b95301de36dc178174d9b28b6c2.tar.bz2
added Opie-Notes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--core/pim/notes/editwindow.cpp57
-rw-r--r--core/pim/notes/editwindow.h22
-rw-r--r--core/pim/notes/main.cpp12
-rw-r--r--core/pim/notes/mainwindow.cpp255
-rw-r--r--core/pim/notes/mainwindow.h52
-rw-r--r--core/pim/notes/opie-notes.pro11
7 files changed, 410 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 24ae63c..36d7df9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,134 +1,135 @@
1 2005-??-??Opie 1.2.2 1 2005-??-??Opie 1.2.2
2 2
3 3
4 New Features 4 New Features
5 ------------ 5 ------------
6 * Appearance: Added configuration options to set smallIconSize, bigIconSize, useBigPixmaps (hrw) 6 * Appearance: Added configuration options to set smallIconSize, bigIconSize, useBigPixmaps (hrw)
7 * Opie-Notes: Notes application based on NoteZ (hrw)
7 8
8 Fixed Bugs 9 Fixed Bugs
9 ---------- 10 ----------
10 * #1695 - Date selector use too small fontsize on VGA screen (hrw) 11 * #1695 - Date selector use too small fontsize on VGA screen (hrw)
11 * #1686 - opie-console lack UI setting for switching scrollbar (hrw) 12 * #1686 - opie-console lack UI setting for switching scrollbar (hrw)
12 * #1647 - Opie-console doesn't respect scroll-bar on left side (hrw) 13 * #1647 - Opie-console doesn't respect scroll-bar on left side (hrw)
13 * #1624 - Button settngs changes are applied only after restart (hrw) 14 * #1624 - Button settngs changes are applied only after restart (hrw)
14 * #1492 - Backup and Restore does not show list of backups to restore on start (hrw) 15 * #1492 - Backup and Restore does not show list of backups to restore on start (hrw)
15 * n.a. - remove hardcoded font size from wellenreiter (hrw) 16 * n.a. - remove hardcoded font size from wellenreiter (hrw)
16 * n.a. - added patch to build QT/E 2.3.10 with gc 4.x.x (hrw) 17 * n.a. - added patch to build QT/E 2.3.10 with gc 4.x.x (hrw)
17 18
18 2005-09-11Opie 1.2.1 19 2005-09-11Opie 1.2.1
19 20
20 21
21 New Features 22 New Features
22 ------------ 23 ------------
23 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) 24 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
24 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) 25 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
25 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) 26 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
26 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) 27 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
27 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) 28 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
28 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) 29 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
29 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw) 30 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw)
30 * ZSafe: Made UI conform to Opie standards (drw) 31 * ZSafe: Made UI conform to Opie standards (drw)
31 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw) 32 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw)
32 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl) 33 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl)
33 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl) 34 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl)
34 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl) 35 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl)
35 * Opie-smb: Added Opie front end for Samba (ljp) 36 * Opie-smb: Added Opie front end for Samba (ljp)
36 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie) 37 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie)
37 * Opieplayer: rudimentary podcast support (ljp) 38 * Opieplayer: rudimentary podcast support (ljp)
38 39
39 Fixed Bugs 40 Fixed Bugs
40 ---------- 41 ----------
41 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) 42 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
42 - We actually suspend the complete Opie now in that case. 43 - We actually suspend the complete Opie now in that case.
43 * #1384 - Battery status updated improperly when charging (skyhusker) 44 * #1384 - Battery status updated improperly when charging (skyhusker)
44 * #1476 - Wrong order of application entries in the O-menu (skyhusker) 45 * #1476 - Wrong order of application entries in the O-menu (skyhusker)
45 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) 46 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
46 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) 47 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
47 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw) 48 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw)
48 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) 49 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
49 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) 50 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
50 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) 51 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
51 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) 52 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
52 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) 53 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
53 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) 54 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
54 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) 55 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker)
55 * #1667 - Opie-IRC does not show messages from !channel (skyhusker) 56 * #1667 - Opie-IRC does not show messages from !channel (skyhusker)
56 * #1679 - Security PIN plugin is QVGA sized (hrw) 57 * #1679 - Security PIN plugin is QVGA sized (hrw)
57 * #1682 - Properly resize tab control in OTabWidget (drw) 58 * #1682 - Properly resize tab control in OTabWidget (drw)
58 * n.a. - always show volume and wireless applet popups inside visible screen (deller) 59 * n.a. - always show volume and wireless applet popups inside visible screen (deller)
59 * n.a. - scale O-Menu-Applets appropriately (mickeyl) 60 * n.a. - scale O-Menu-Applets appropriately (mickeyl)
60 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) 61 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
61 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl) 62 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl)
62 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl) 63 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl)
63 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) 64 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
64 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) 65 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
65 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) 66 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
66 * n.a. - remove hardcoded font size from netsystemtime (hrw) 67 * n.a. - remove hardcoded font size from netsystemtime (hrw)
67 * n.a. - remove hardcoded font size from checkbook graphs (hrw) 68 * n.a. - remove hardcoded font size from checkbook graphs (hrw)
68 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw) 69 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw)
69 70
70 71
71 Internal 72 Internal
72 -------- 73 --------
73 * Make BluezApplet use OTaskbarApplet (mickeyl) 74 * Make BluezApplet use OTaskbarApplet (mickeyl)
74 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) 75 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl)
75 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) 76 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl)
76 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) 77 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl)
77 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) 78 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl)
78 * libopienet: Miscellaneous API cleanups (mickeyl) 79 * libopienet: Miscellaneous API cleanups (mickeyl)
79 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) 80 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl)
80 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl) 81 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl)
81 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl) 82 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl)
82 * libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl) 83 * libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl)
83 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl) 84 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl)
84 * Fix / Optimize number of scanned directories (ljp) 85 * Fix / Optimize number of scanned directories (ljp)
85 * Use five point mouse calibration to make calibrated mouse drivers work on newer Zaurii (rp,mickeyl) 86 * Use five point mouse calibration to make calibrated mouse drivers work on newer Zaurii (rp,mickeyl)
86 87
87 2005-03-25Opie 1.2.0 88 2005-03-25Opie 1.2.0
88 89
89 Fixed Bugs 90 Fixed Bugs
90 ---------- 91 ----------
91 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) 92 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw)
92 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) 93 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin)
93 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) 94 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke)
94 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) 95 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw)
95 * n.a.- make qpeglobal.h include qglobal.h (zecke) 96 * n.a.- make qpeglobal.h include qglobal.h (zecke)
96 97
97 2005-03-20Opie 1.2.0-rc1 98 2005-03-20Opie 1.2.0-rc1
98 99
99 100
100 New Features 101 New Features
101 ------------ 102 ------------
102 * Launcher: Support a static background pixmap (mickeyl) 103 * Launcher: Support a static background pixmap (mickeyl)
103 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) 104 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
104 * PackageManager supports the 'lists_dir' ipkg configuration option (drw) 105 * PackageManager supports the 'lists_dir' ipkg configuration option (drw)
105 * Added hi-res inline images for large resolution devices (drw) 106 * Added hi-res inline images for large resolution devices (drw)
106 * Improved launcher icons for consistency (ar) 107 * Improved launcher icons for consistency (ar)
107 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) 108 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin)
108 109
109 Fixed Bugs 110 Fixed Bugs
110 ---------- 111 ----------
111 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) 112 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
112 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) 113 * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw)
113 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) 114 * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp)
114 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) 115 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
115 * #1482 - Fix double '/' in paths (zecke) 116 * #1482 - Fix double '/' in paths (zecke)
116 * #1536 - Autosave of custom locations in opie backup (ar) 117 * #1536 - Autosave of custom locations in opie backup (ar)
117 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) 118 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
118 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) 119 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
119 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) 120 * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw)
120 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) 121 * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke)
121 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) 122 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
122 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) 123 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
123 * #1558 - Fixed opie-login breaking opie startup (mickeyl) 124 * #1558 - Fixed opie-login breaking opie startup (mickeyl)
124 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) 125 * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning)
125 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) 126 * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar)
126 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) 127 * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers)
127 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) 128 * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints)
128 * #1604 - Checkbook crashed on startup (drw) 129 * #1604 - Checkbook crashed on startup (drw)
129 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) 130 * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers)
130 * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) 131 * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers)
131 * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) 132 * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw)
132 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) 133 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
133 * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) 134 * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw)
134 * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) 135 * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw)
diff --git a/core/pim/notes/editwindow.cpp b/core/pim/notes/editwindow.cpp
new file mode 100644
index 0000000..1b2d4a6
--- a/dev/null
+++ b/core/pim/notes/editwindow.cpp
@@ -0,0 +1,57 @@
1#include "editwindow.h"
2
3editWindowWidget::editWindowWidget( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl )
4{
5 setCaption( tr( "Information:" ) );
6 QGridLayout *gridLayout = new QGridLayout(this, 1, 1, 5, 5);
7 editArea = new QMultiLineEdit(this, "editArea");
8 gridLayout->addWidget(editArea, 0, 0);
9 editArea->setWordWrap(QMultiLineEdit::WidgetWidth);
10
11 showMaximized();
12}
13
14void editWindowWidget::loadFile(QString fileName)
15{
16 QFileInfo fileinfo(fileName);
17 setCaption(fileinfo.fileName());
18
19 QFile file(fileName);
20
21 if (file.exists())
22 {
23 if (!file.open(IO_ReadOnly))
24 {
25 QMessageBox::warning(0, tr("File i/o error"), fileName.sprintf(tr("Could not read file '%s'"), fileName));
26 }
27 else
28 {
29 QTextStream inStream(&file);
30 inStream.setEncoding(QTextStream::UnicodeUTF8);
31 editArea->setText(inStream.read());
32 file.close();
33 }
34 }
35}
36
37void editWindowWidget::saveFile(QString fileName)
38{
39 QFile file(fileName);
40
41 if(!file.open(IO_WriteOnly))
42 {
43 QMessageBox::warning(0, tr("File i/o error"), fileName.sprintf(tr("Could not write file '%s'"), fileName));
44 }
45 else
46 {
47 QTextStream outStream(&file);
48 outStream.setEncoding(QTextStream::UnicodeUTF8);
49 outStream << editArea->text();
50 file.close();
51 this->accept();
52 }
53}
54
55editWindowWidget::~editWindowWidget()
56{
57}
diff --git a/core/pim/notes/editwindow.h b/core/pim/notes/editwindow.h
new file mode 100644
index 0000000..57c5241
--- a/dev/null
+++ b/core/pim/notes/editwindow.h
@@ -0,0 +1,22 @@
1#include <qdialog.h>
2#include <qlayout.h>
3#include <qmultilineedit.h>
4#include <qmessagebox.h>
5#include <qtextstream.h>
6#include <qfile.h>
7#include <qfileinfo.h>
8
9class editWindowWidget : public QDialog
10{
11 Q_OBJECT
12
13 public:
14 editWindowWidget::editWindowWidget(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
15 ~editWindowWidget();
16 void loadFile(QString fileName);
17 void saveFile(QString fileName);
18
19 private:
20 QMultiLineEdit *editArea;
21
22};
diff --git a/core/pim/notes/main.cpp b/core/pim/notes/main.cpp
new file mode 100644
index 0000000..c69fa93
--- a/dev/null
+++ b/core/pim/notes/main.cpp
@@ -0,0 +1,12 @@
1#include "mainwindow.h"
2
3int main(int argc, char* argv[])
4{
5 QPEApplication a(argc, argv);
6
7 mainWindowWidget mainWindow;
8
9 a.showMainWidget(&mainWindow);
10
11 return a.exec();
12}
diff --git a/core/pim/notes/mainwindow.cpp b/core/pim/notes/mainwindow.cpp
new file mode 100644
index 0000000..d10578a
--- a/dev/null
+++ b/core/pim/notes/mainwindow.cpp
@@ -0,0 +1,255 @@
1/*
2 * OPIE Notes
3 *
4 * based on NoteZ 1.1.0 by Henning Holtschneider <hh@holtschneider.com>
5 *
6 * moved to OPIE Pim framework by Marcin Juszkiewicz <openembedded@hrw.one.pl>
7 *
8 * History:
9 * - 2005.10.12 - started work
10 * - 2005.10.19 - version 0.2:
11 * - first working version
12 * - info sent to NoteZ author and to OPIE devel
13 *
14 * - 2005.10.20 - version 0.3:
15 * - load/save in UTF-8
16 * - load all files from Documents/text/plain
17 * - create .txt files not .ntz - timestamp used as name
18 * - one variable (documentsDirName) keep location of notes
19 * - code (re)indented and converted to spaces
20 * - variables translated to English (were in German)
21 * - started work on beaming
22 *
23 * ToDo:
24 * - beaming
25 * - moving to SQLite database
26 * - category support
27 * - searching
28 *
29 */
30
31#include "mainwindow.h"
32#include "editwindow.h"
33#include <qpe/ir.h>
34
35mainWindowWidget::mainWindowWidget( QWidget *parent, const char *name, WFlags)
36 : Opie::OPimMainWindow( "Notes", "Notes", tr( "Note" ), "notes",
37 parent, name, WType_TopLevel | WStyle_ContextHelp )
38{
39 setCaption( tr("Notes"));
40 notesList = new QListBox(this, "notesList");
41 setCentralWidget(notesList);
42
43 documentsDirName = QPEApplication::documentDir() + "/text/plain/";
44 this->selected = -1;
45 refreshList();
46
47 QObject::connect(notesList, SIGNAL(returnPressed(QListBoxItem*)), this, SLOT(slotItemEdit()));
48 QObject::connect(notesList, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(slotItemEdit()));
49}
50
51void mainWindowWidget::deleteFile()
52{
53 if( notesList->count() > 0 )
54 {
55 switch (QMessageBox::warning(0, tr("Delete note"), tr("Really delete\n'") + notesList->currentText() + "'?",
56 QMessageBox::Yes, QMessageBox::No))
57 {
58 case QMessageBox::Yes:
59 this->selected = notesList->currentItem();
60 QFile::remove(documentsDirName + fileList[notesList->currentItem()]);
61 refreshList();
62 break;
63
64 case QMessageBox::No:
65 // don't delete
66 break;
67 }
68 }
69}
70
71void mainWindowWidget::editFile(QString filename, int create)
72{
73 editWindowWidget *editWindow = new editWindowWidget(0, "editWindow", true);
74
75 editWindow->loadFile(filename);
76
77 if(QPEApplication::execDialog(editWindow) == QDialog::Accepted)
78 {
79 editWindow->saveFile(filename);
80 if( create )
81 {
82 // the new selection will be always at the end and count is already
83 // 1 bigger than selected
84 this->selected = notesList->count();
85 }
86 }
87
88 refreshList();
89}
90
91int mainWindowWidget::create()
92{
93 QString name;
94 int now = time(0);
95
96 this->editFile(name.sprintf(documentsDirName + "%d.txt", now), true );
97
98 return 0; //FIXME
99}
100
101void mainWindowWidget::slotItemEdit()
102{
103 openFile();
104}
105
106void mainWindowWidget::slotItemDelete()
107{
108 deleteFile();
109}
110
111void mainWindowWidget::slotItemNew()
112{
113 create();
114}
115
116void mainWindowWidget::slotItemDuplicate()
117{
118 QString fileName = documentsDirName + fileList[notesList->currentItem()];
119 int now = time(0);
120
121 QFile fileOld(fileName);
122
123 if (fileOld.exists())
124 {
125 if (!fileOld.open(IO_ReadOnly))
126 {
127 QMessageBox::warning(0, tr("File i/o error"), fileName.sprintf(tr("Could not read file '%s'"), fileName));
128 }
129 else
130 {
131 QFile fileNew(documentsDirName + fileName.sprintf("%d.txt", now));
132
133 if (!fileNew.exists())
134 {
135 if(fileNew.open(IO_WriteOnly))
136 {
137 QTextStream inStream(&fileOld);
138 inStream.setEncoding(QTextStream::UnicodeUTF8);
139
140 QTextStream outStream(&fileNew);
141 outStream.setEncoding(QTextStream::UnicodeUTF8);
142 outStream << inStream.read();
143
144 fileOld.close();
145 fileNew.close();
146 refreshList();
147 }
148 }
149 }
150 }
151}
152
153void mainWindowWidget::openFile()
154{
155 int number = notesList->currentItem();
156
157 if( notesList->count() > 0 )
158 {
159 this->selected = number;
160 this->editFile(documentsDirName + fileList[number], false);
161 }
162}
163
164void mainWindowWidget::refreshList()
165{
166 unsigned int item;
167 QString title;
168
169 notesList->clear();
170
171 fileList.setPath(documentsDirName);
172 fileList.setFilter(QDir::Files);
173 fileList.setSorting(QDir::Name);
174
175 for (item = 0; item < fileList.count(); item++)
176 {
177 QFile file(documentsDirName + fileList[item]);
178
179 if (!file.open(IO_ReadOnly))
180 {
181 QMessageBox::warning(0, tr("File i/o error"), title.sprintf(tr("Could not read file '%s'"), fileList[item]));
182 }
183 else
184 {
185 QTextStream inStream(&file);
186 inStream.setEncoding(QTextStream::UnicodeUTF8);
187
188 if (!inStream.atEnd())
189 {
190 title = inStream.readLine();
191 }
192 else
193 {
194 title = tr("<empty file>");
195 }
196
197 if (title.length() < 1)
198 {
199 title = tr("<no caption>");
200 }
201
202 file.close();
203
204 notesList->insertItem(title);
205 }
206 }
207
208 if( notesList->count() > 0 )
209 {
210 if( this->selected == -1 )
211 {
212 notesList->setCurrentItem( 0 );
213 }
214 else
215 {
216 if( notesList->count() > this->selected )
217 {
218 notesList->setCurrentItem( this->selected );
219 }
220 else
221 {
222 notesList->setCurrentItem( notesList->count() - 1 );
223 }
224
225 }
226 }
227 else
228 {
229 this->selected = -1;
230 }
231
232}
233
234void mainWindowWidget::slotItemBeam()
235{
236 Ir obex;
237
238 obex.send(documentsDirName + fileList[notesList->currentItem()], "test", "text/plain");
239}
240
241void mainWindowWidget::slotItemFind() { toBeDone();}
242void mainWindowWidget::slotConfigure() { toBeDone();}
243void mainWindowWidget::flush() { toBeDone();}
244void mainWindowWidget::reload() { toBeDone();}
245bool mainWindowWidget::remove( int /*uid*/ ) { toBeDone(); return false; }
246void mainWindowWidget::beam( int /*uid*/ ) { toBeDone();}
247void mainWindowWidget::show( int /*uid*/ ) { toBeDone();}
248void mainWindowWidget::edit( int /*uid*/ ) { toBeDone();}
249void mainWindowWidget::add( const Opie::OPimRecord& ) { toBeDone();}
250
251void mainWindowWidget::toBeDone(void)
252{
253 QMessageBox::information( this, "Notes", tr("Not yet implemented"));
254}
255
diff --git a/core/pim/notes/mainwindow.h b/core/pim/notes/mainwindow.h
new file mode 100644
index 0000000..32431ef
--- a/dev/null
+++ b/core/pim/notes/mainwindow.h
@@ -0,0 +1,52 @@
1#include <qpe/qpeapplication.h>
2#include <qlistbox.h>
3#include <qdir.h>
4#include <qfile.h>
5#include <qtextstream.h>
6#include <qmessagebox.h>
7
8#include <opie2/opimmainwindow.h>
9#include <opie2/owidgetstack.h>
10
11class mainWindowWidget : public Opie::OPimMainWindow
12{
13 Q_OBJECT
14
15 public:
16 QListBox *notesList;
17 QDir fileList;
18
19 mainWindowWidget( QWidget *parent=0, const char *name=0, WFlags fl=0 );
20 void refreshList();
21
22 public slots:
23 void openFile();
24 void deleteFile();
25
26 private:
27 int selected;
28 QString fileName;
29 QString documentsDirName;
30
31 void editFile(QString filename, int create);
32 void toBeDone(void);
33
34 private slots:
35 void slotItemNew();
36 void slotItemEdit();
37 void slotItemDuplicate();
38 void slotItemDelete();
39 void slotItemBeam();
40 void slotItemFind();
41 void slotConfigure();
42
43 protected slots:
44 void flush();
45 void reload();
46 int create();
47 bool remove( int uid );
48 void beam( int uid);
49 void show( int uid );
50 void edit( int uid );
51 void add( const Opie::OPimRecord& );
52};
diff --git a/core/pim/notes/opie-notes.pro b/core/pim/notes/opie-notes.pro
new file mode 100644
index 0000000..6a343d8
--- a/dev/null
+++ b/core/pim/notes/opie-notes.pro
@@ -0,0 +1,11 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3
4INCLUDEPATH += $(OPIEDIR)/include
5DEPENDPATH += $(OPIEDIR)/include
6LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2
7
8HEADERS = mainwindow.h editwindow.h
9SOURCES = mainwindow.cpp main.cpp editwindow.cpp
10
11include( $(OPIEDIR)/include.pro )