summaryrefslogtreecommitdiff
authorhakan <hakan>2002-05-12 09:54:24 (UTC)
committer hakan <hakan>2002-05-12 09:54:24 (UTC)
commit6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d (patch) (unidiff)
tree6fac867effefe67c98896418047fe794a88c6953
parent6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6 (diff)
downloadopie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.zip
opie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.tar.gz
opie-6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d.tar.bz2
Added a ONoteEdit class which is a QMultiLineEdit subclass copying indentation from line to line
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.pro6
-rw-r--r--core/pim/datebook/dateentryimpl.cpp1
-rw-r--r--core/pim/datebook/noteentry.ui28
-rw-r--r--core/pim/datebook/noteentryimpl.cpp1
-rw-r--r--core/pim/datebook/onoteedit.cpp19
-rw-r--r--core/pim/datebook/onoteedit.h19
6 files changed, 67 insertions, 7 deletions
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index 60c2b08..cf3ed30 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -3,38 +3,40 @@ CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 4
5 HEADERS= datebookday.h \ 5 HEADERS= datebookday.h \
6 datebook.h \ 6 datebook.h \
7 dateentryimpl.h \ 7 dateentryimpl.h \
8 datebookdayheaderimpl.h \ 8 datebookdayheaderimpl.h \
9 datebooksettings.h \ 9 datebooksettings.h \
10 datebookweek.h \ 10 datebookweek.h \
11 datebookweeklst.h \ 11 datebookweeklst.h \
12 datebookweekheaderimpl.h \ 12 datebookweekheaderimpl.h \
13 repeatentry.h \ 13 repeatentry.h \
14 timepicker.h \ 14 timepicker.h \
15 noteentryimpl.h 15 noteentryimpl.h \
16 onoteedit.h
16 17
17 SOURCES= main.cpp \ 18 SOURCES= main.cpp \
18 datebookday.cpp \ 19 datebookday.cpp \
19 datebook.cpp \ 20 datebook.cpp \
20 dateentryimpl.cpp \ 21 dateentryimpl.cpp \
21 datebookdayheaderimpl.cpp \ 22 datebookdayheaderimpl.cpp \
22 datebooksettings.cpp \ 23 datebooksettings.cpp \
23 datebookweek.cpp \ 24 datebookweek.cpp \
24 datebookweeklst.cpp \ 25 datebookweeklst.cpp \
25 datebookweekheaderimpl.cpp \ 26 datebookweekheaderimpl.cpp \
26 repeatentry.cpp \ 27 repeatentry.cpp \
27 timepicker.cpp \ 28 timepicker.cpp \
28 noteentryimpl.cpp 29 noteentryimpl.cpp \
30 onoteedit.cpp
29 31
30 INTERFACES= dateentry.ui \ 32 INTERFACES= dateentry.ui \
31 datebookdayheader.ui \ 33 datebookdayheader.ui \
32 datebooksettingsbase.ui \ 34 datebooksettingsbase.ui \
33 datebookweekheader.ui \ 35 datebookweekheader.ui \
34 datebookweeklstheader.ui \ 36 datebookweeklstheader.ui \
35 datebookweeklstdayhdr.ui \ 37 datebookweeklstdayhdr.ui \
36 repeatentrybase.ui \ 38 repeatentrybase.ui \
37 noteentry.ui 39 noteentry.ui
38 40
39INCLUDEPATH += $(OPIEDIR)/include 41INCLUDEPATH += $(OPIEDIR)/include
40 DEPENDPATH+= $(OPIEDIR)/include 42 DEPENDPATH+= $(OPIEDIR)/include
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 9cc5073..dab3375 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -32,24 +32,25 @@
32#include <qevent.h> 32#include <qevent.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmultilineedit.h> 37#include <qmultilineedit.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43#include "timepicker.h" 43#include "timepicker.h"
44#include "onoteedit.h"
44 45
45#include <stdlib.h> 46#include <stdlib.h>
46#include <stdio.h> 47#include <stdio.h>
47 48
48/* 49/*
49 * Constructs a DateEntry which is a child of 'parent', with the 50 * Constructs a DateEntry which is a child of 'parent', with the
50 * name 'name' and widget flags set to 'f' 51 * name 'name' and widget flags set to 'f'
51 * 52 *
52 * The dialog will by default be modeless, unless you set 'modal' to 53 * The dialog will by default be modeless, unless you set 'modal' to
53 * TRUE to construct a modal dialog. 54 * TRUE to construct a modal dialog.
54 */ 55 */
55 56
diff --git a/core/pim/datebook/noteentry.ui b/core/pim/datebook/noteentry.ui
index ce3c4ad..0bea06e 100644
--- a/core/pim/datebook/noteentry.ui
+++ b/core/pim/datebook/noteentry.ui
@@ -44,25 +44,43 @@
44 <name>text</name> 44 <name>text</name>
45 <string>&lt;b&gt;1/10&lt;/b&gt; Lunch</string> 45 <string>&lt;b&gt;1/10&lt;/b&gt; Lunch</string>
46 </property> 46 </property>
47 <property stdset="1"> 47 <property stdset="1">
48 <name>alignment</name> 48 <name>alignment</name>
49 <set>AlignCenter</set> 49 <set>AlignCenter</set>
50 </property> 50 </property>
51 <property> 51 <property>
52 <name>hAlign</name> 52 <name>hAlign</name>
53 </property> 53 </property>
54 </widget> 54 </widget>
55 <widget> 55 <widget>
56 <class>QMultiLineEdit</class> 56 <class>ONoteEdit</class>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>name</name> 58 <name>name</name>
59 <cstring>note</cstring> 59 <cstring>note</cstring>
60 </property> 60 </property>
61 <property stdset="1">
62 <name>wordWrap</name>
63 <enum>WidgetWidth</enum>
64 </property>
65 </widget> 61 </widget>
66 </vbox> 62 </vbox>
67</widget> 63</widget>
64<customwidgets>
65 <customwidget>
66 <class>ONoteEdit</class>
67 <header location="local">onoteedit.h</header>
68 <sizehint>
69 <width>-1</width>
70 <height>-1</height>
71 </sizehint>
72 <container>0</container>
73 <sizepolicy>
74 <hordata>7</hordata>
75 <verdata>7</verdata>
76 </sizepolicy>
77 <pixmap>image0</pixmap>
78 </customwidget>
79</customwidgets>
80<images>
81 <image>
82 <name>image0</name>
83 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
84 </image>
85</images>
68</UI> 86</UI>
diff --git a/core/pim/datebook/noteentryimpl.cpp b/core/pim/datebook/noteentryimpl.cpp
index 9e1abb9..0e45985 100644
--- a/core/pim/datebook/noteentryimpl.cpp
+++ b/core/pim/datebook/noteentryimpl.cpp
@@ -1,16 +1,17 @@
1#include "noteentryimpl.h" 1#include "noteentryimpl.h"
2#include "qstring.h" 2#include "qstring.h"
3#include "qmultilinedit.h" 3#include "qmultilinedit.h"
4#include "qlabel.h" 4#include "qlabel.h"
5#include "onoteedit.h"
5 6
6NoteEntry::NoteEntry(const QString &title, const QString &noteStr, 7NoteEntry::NoteEntry(const QString &title, const QString &noteStr,
7 QWidget* parent, const char* name, bool modal, 8 QWidget* parent, const char* name, bool modal,
8 WFlags fl) : 9 WFlags fl) :
9 NoteEntryBase(parent, name, modal, fl) { 10 NoteEntryBase(parent, name, modal, fl) {
10 11
11 12
12 eventLabel->setText(title); 13 eventLabel->setText(title);
13 note->setText(noteStr); 14 note->setText(noteStr);
14 int l=note->length(); 15 int l=note->length();
15 note->setCursorPosition(l,l,false); 16 note->setCursorPosition(l,l,false);
16} 17}
diff --git a/core/pim/datebook/onoteedit.cpp b/core/pim/datebook/onoteedit.cpp
new file mode 100644
index 0000000..d66ad86
--- a/dev/null
+++ b/core/pim/datebook/onoteedit.cpp
@@ -0,0 +1,19 @@
1#include "onoteedit.h"
2
3ONoteEdit::ONoteEdit (QWidget * parent, const char * name) :
4 QMultiLineEdit(parent,name) {
5 setDefaultTabStop(2);
6 setWordWrap(WidgetWidth);
7}
8
9// Copy indentation from previous line
10void ONoteEdit::newLine() {
11 int l,c;
12 getCursorPosition(&l,&c);
13 QString s=textLine(l);
14
15 insert("\n");
16
17 int i=0;
18 while (s[i]==' ' || s[i]=='\t') insert(QString(s[i])), i++;
19}
diff --git a/core/pim/datebook/onoteedit.h b/core/pim/datebook/onoteedit.h
new file mode 100644
index 0000000..2f71d0d
--- a/dev/null
+++ b/core/pim/datebook/onoteedit.h
@@ -0,0 +1,19 @@
1#ifndef ONOTEEDIT_H
2#define ONOTEEDIT_H
3
4#include <qmultilineedit.h>
5
6class ONoteEdit: public QMultiLineEdit {
7
8 Q_OBJECT
9
10 public:
11
12 ONoteEdit (QWidget * parent=0, const char * name=0);
13
14 protected:
15
16 virtual void newLine ();
17};
18
19#endif