-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | core/pim/notes/editwindow.cpp | 57 | ||||
-rw-r--r-- | core/pim/notes/editwindow.h | 22 | ||||
-rw-r--r-- | core/pim/notes/main.cpp | 12 | ||||
-rw-r--r-- | core/pim/notes/mainwindow.cpp | 255 | ||||
-rw-r--r-- | core/pim/notes/mainwindow.h | 52 | ||||
-rw-r--r-- | core/pim/notes/opie-notes.pro | 11 |
7 files changed, 410 insertions, 0 deletions
@@ -1,30 +1,31 @@ | |||
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) |
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 | |||
3 | editWindowWidget::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 | |||
14 | void 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 | |||
37 | void 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 | |||
55 | editWindowWidget::~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 | |||
9 | class 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 | |||
3 | int 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 | |||
35 | mainWindowWidget::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 | |||
51 | void 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 | |||
71 | void 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 | |||
91 | int 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 | |||
101 | void mainWindowWidget::slotItemEdit() | ||
102 | { | ||
103 | openFile(); | ||
104 | } | ||
105 | |||
106 | void mainWindowWidget::slotItemDelete() | ||
107 | { | ||
108 | deleteFile(); | ||
109 | } | ||
110 | |||
111 | void mainWindowWidget::slotItemNew() | ||
112 | { | ||
113 | create(); | ||
114 | } | ||
115 | |||
116 | void 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 | |||
153 | void 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 | |||
164 | void 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 | |||
234 | void mainWindowWidget::slotItemBeam() | ||
235 | { | ||
236 | Ir obex; | ||
237 | |||
238 | obex.send(documentsDirName + fileList[notesList->currentItem()], "test", "text/plain"); | ||
239 | } | ||
240 | |||
241 | void mainWindowWidget::slotItemFind() { toBeDone();} | ||
242 | void mainWindowWidget::slotConfigure() { toBeDone();} | ||
243 | void mainWindowWidget::flush() { toBeDone();} | ||
244 | void mainWindowWidget::reload() { toBeDone();} | ||
245 | bool mainWindowWidget::remove( int /*uid*/ ) { toBeDone(); return false; } | ||
246 | void mainWindowWidget::beam( int /*uid*/ ) { toBeDone();} | ||
247 | void mainWindowWidget::show( int /*uid*/ ) { toBeDone();} | ||
248 | void mainWindowWidget::edit( int /*uid*/ ) { toBeDone();} | ||
249 | void mainWindowWidget::add( const Opie::OPimRecord& ) { toBeDone();} | ||
250 | |||
251 | void 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 | |||
11 | class 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 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | |||
4 | INCLUDEPATH += $(OPIEDIR)/include | ||
5 | DEPENDPATH += $(OPIEDIR)/include | ||
6 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiepim2 | ||
7 | |||
8 | HEADERS = mainwindow.h editwindow.h | ||
9 | SOURCES = mainwindow.cpp main.cpp editwindow.cpp | ||
10 | |||
11 | include( $(OPIEDIR)/include.pro ) | ||