author | hakan <hakan> | 2002-05-12 09:54:24 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-05-12 09:54:24 (UTC) |
commit | 6f19bc4691ec2c0ebbe36fc1aff09e879564fe7d (patch) (unidiff) | |
tree | 6fac867effefe67c98896418047fe794a88c6953 | |
parent | 6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6 (diff) | |
download | opie-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
-rw-r--r-- | core/pim/datebook/datebook.pro | 6 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/noteentry.ui | 28 | ||||
-rw-r--r-- | core/pim/datebook/noteentryimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/onoteedit.cpp | 19 | ||||
-rw-r--r-- | core/pim/datebook/onoteedit.h | 19 |
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 | |||
@@ -12,7 +12,8 @@ HEADERS = datebookday.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 \ |
@@ -25,7 +26,8 @@ SOURCES = main.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 \ |
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 | |||
@@ -41,6 +41,7 @@ | |||
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> |
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 | |||
@@ -53,16 +53,34 @@ | |||
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 | |||
@@ -2,6 +2,7 @@ | |||
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 | ||
6 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, | 7 | NoteEntry::NoteEntry(const QString &title, const QString ¬eStr, |
7 | QWidget* parent, const char* name, bool modal, | 8 | QWidget* parent, const char* name, bool modal, |
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 | |||
3 | ONoteEdit::ONoteEdit (QWidget * parent, const char * name) : | ||
4 | QMultiLineEdit(parent,name) { | ||
5 | setDefaultTabStop(2); | ||
6 | setWordWrap(WidgetWidth); | ||
7 | } | ||
8 | |||
9 | // Copy indentation from previous line | ||
10 | void 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 | |||
6 | class 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 | ||