-rw-r--r-- | noncore/graphics/drawpad/page.cpp | 24 | ||||
-rw-r--r-- | noncore/graphics/drawpad/page.h | 12 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.cpp | 49 | ||||
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.h | 4 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.cpp | 45 | ||||
-rw-r--r-- | noncore/graphics/drawpad/thumbnailview.h | 6 |
6 files changed, 134 insertions, 6 deletions
diff --git a/noncore/graphics/drawpad/page.cpp b/noncore/graphics/drawpad/page.cpp index 35ec0e0..7034a20 100644 --- a/noncore/graphics/drawpad/page.cpp +++ b/noncore/graphics/drawpad/page.cpp | |||
@@ -18,2 +18,3 @@ Page::Page() | |||
18 | { | 18 | { |
19 | m_lastModified = QDateTime::currentDateTime(); | ||
19 | } | 20 | } |
@@ -23,2 +24,3 @@ Page::Page(int w, int h) | |||
23 | { | 24 | { |
25 | m_lastModified = QDateTime::currentDateTime(); | ||
24 | } | 26 | } |
@@ -28,2 +30,3 @@ Page::Page(const QSize& size) | |||
28 | { | 30 | { |
31 | m_lastModified = QDateTime::currentDateTime(); | ||
29 | } | 32 | } |
@@ -33 +36,22 @@ Page::~Page() | |||
33 | } | 36 | } |
37 | |||
38 | QString Page::title() const | ||
39 | { | ||
40 | return m_title; | ||
41 | } | ||
42 | |||
43 | QDateTime Page::lastModified() const | ||
44 | { | ||
45 | return m_lastModified; | ||
46 | } | ||
47 | |||
48 | void Page::setTitle(QString title) | ||
49 | { | ||
50 | m_title = title; | ||
51 | } | ||
52 | |||
53 | void Page::setLastModified(QDateTime lastModified) | ||
54 | { | ||
55 | m_lastModified = lastModified; | ||
56 | } | ||
57 | |||
diff --git a/noncore/graphics/drawpad/page.h b/noncore/graphics/drawpad/page.h index 888f552..020ab1f 100644 --- a/noncore/graphics/drawpad/page.h +++ b/noncore/graphics/drawpad/page.h | |||
@@ -18,2 +18,4 @@ | |||
18 | 18 | ||
19 | #include <qdatetime.h> | ||
20 | |||
19 | class Page : public QPixmap | 21 | class Page : public QPixmap |
@@ -26,2 +28,12 @@ public: | |||
26 | ~Page(); | 28 | ~Page(); |
29 | |||
30 | QString title() const; | ||
31 | QDateTime lastModified() const; | ||
32 | |||
33 | void setTitle(QString title); | ||
34 | void setLastModified(QDateTime lastModified); | ||
35 | |||
36 | private: | ||
37 | QString m_title; | ||
38 | QDateTime m_lastModified; | ||
27 | }; | 39 | }; |
diff --git a/noncore/graphics/drawpad/pageinformationdialog.cpp b/noncore/graphics/drawpad/pageinformationdialog.cpp index 54cf89d..c0d055e 100644 --- a/noncore/graphics/drawpad/pageinformationdialog.cpp +++ b/noncore/graphics/drawpad/pageinformationdialog.cpp | |||
@@ -17,2 +17,5 @@ | |||
17 | 17 | ||
18 | #include <qpe/config.h> | ||
19 | #include <qpe/timestring.h> | ||
20 | |||
18 | #include <qgroupbox.h> | 21 | #include <qgroupbox.h> |
@@ -32,3 +35,8 @@ PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const | |||
32 | QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox); | 35 | QLabel* titleLabel = new QLabel(tr("Title:"), generalGroupBox); |
36 | |||
33 | m_pTitleLineEdit = new QLineEdit(generalGroupBox); | 37 | m_pTitleLineEdit = new QLineEdit(generalGroupBox); |
38 | m_pTitleLineEdit->setText(page->title()); | ||
39 | |||
40 | QLabel* dateLabel = new QLabel(tr("Date:"), generalGroupBox); | ||
41 | QLabel* dateValueLabel = new QLabel(dateTimeString(m_pPage->lastModified()), generalGroupBox); | ||
34 | 42 | ||
@@ -45,3 +53,3 @@ PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const | |||
45 | sizeGroupBox->layout()->setSpacing(4); | 53 | sizeGroupBox->layout()->setSpacing(4); |
46 | QGridLayout* generalLayout = new QGridLayout(generalGroupBox->layout(), 1, 1); | 54 | QGridLayout* generalLayout = new QGridLayout(generalGroupBox->layout(), 2, 2); |
47 | QGridLayout* sizeLayout = new QGridLayout(sizeGroupBox->layout(), 2, 2); | 55 | QGridLayout* sizeLayout = new QGridLayout(sizeGroupBox->layout(), 2, 2); |
@@ -50,2 +58,6 @@ PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const | |||
50 | generalLayout->addWidget(m_pTitleLineEdit, 0, 1); | 58 | generalLayout->addWidget(m_pTitleLineEdit, 0, 1); |
59 | generalLayout->addWidget(dateLabel, 1, 0); | ||
60 | generalLayout->addWidget(dateValueLabel, 1, 1); | ||
61 | |||
62 | generalLayout->setColStretch(1, 1); | ||
51 | 63 | ||
@@ -70 +82,36 @@ QString PageInformationDialog::selectedTitle() | |||
70 | } | 82 | } |
83 | |||
84 | QString PageInformationDialog::dateTimeString(QDateTime dateTime) | ||
85 | { | ||
86 | QString result; | ||
87 | |||
88 | Config config("qpe"); | ||
89 | config.setGroup("Date"); | ||
90 | |||
91 | QChar separator = config.readEntry("Separator", "/")[0]; | ||
92 | DateFormat::Order shortOrder = (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear); | ||
93 | |||
94 | for (int i = 0; i < 3; i++) { | ||
95 | switch((shortOrder >> (i * 3)) & 0x0007) { | ||
96 | case 0x0001: | ||
97 | result += QString().sprintf("%02d", dateTime.date().day()); | ||
98 | break; | ||
99 | case 0x0002: | ||
100 | result += QString().sprintf("%02d", dateTime.date().month()); | ||
101 | break; | ||
102 | case 0x0004: | ||
103 | result += QString().sprintf("%04d", dateTime.date().year()); | ||
104 | break; | ||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | if (i < 2) { | ||
110 | result += separator; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | result += QString().sprintf(" %02d:%02d", dateTime.time().hour(), dateTime.time().minute()); | ||
115 | |||
116 | return result; | ||
117 | } | ||
diff --git a/noncore/graphics/drawpad/pageinformationdialog.h b/noncore/graphics/drawpad/pageinformationdialog.h index cce74ec..60662a9 100644 --- a/noncore/graphics/drawpad/pageinformationdialog.h +++ b/noncore/graphics/drawpad/pageinformationdialog.h | |||
@@ -20,2 +20,4 @@ class Page; | |||
20 | 20 | ||
21 | #include <qdatetime.h> | ||
22 | |||
21 | class QLineEdit; | 23 | class QLineEdit; |
@@ -33,2 +35,4 @@ public: | |||
33 | private: | 35 | private: |
36 | QString dateTimeString(QDateTime dateTime); | ||
37 | |||
34 | Page* m_pPage; | 38 | Page* m_pPage; |
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp index 1eadc13..35955e8 100644 --- a/noncore/graphics/drawpad/thumbnailview.cpp +++ b/noncore/graphics/drawpad/thumbnailview.cpp | |||
@@ -20,3 +20,5 @@ | |||
20 | 20 | ||
21 | #include <qpe/config.h> | ||
21 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/timestring.h> | ||
22 | 24 | ||
@@ -56,6 +58,6 @@ PageListBoxItem::PageListBoxItem(Page* page, QListBox* parent) | |||
56 | 58 | ||
57 | m_titleText = QObject::tr("Title:") + " -"; | 59 | m_titleText = QObject::tr("Title:") + " " + m_pPage->title(); |
58 | m_dimensionText = QObject::tr("Dimension:") + " " + QString::number(m_pPage->width()) | 60 | m_dimensionText = QObject::tr("Dimension:") + " " + QString::number(m_pPage->width()) |
59 | + "x" + QString::number(m_pPage->height()); | 61 | + "x" + QString::number(m_pPage->height()); |
60 | m_dateTimeText = QObject::tr("Date:") + " -"; | 62 | m_dateText = QObject::tr("Date:") + " " + dateTimeString(m_pPage->lastModified()); |
61 | 63 | ||
@@ -88,3 +90,3 @@ int PageListBoxItem::width(const QListBox* lb) const | |||
88 | QMAX(fontMetrics.width(m_dimensionText), | 90 | QMAX(fontMetrics.width(m_dimensionText), |
89 | fontMetrics.width(m_dateTimeText))); | 91 | fontMetrics.width(m_dateText))); |
90 | 92 | ||
@@ -119,3 +121,3 @@ void PageListBoxItem::paint(QPainter *painter) | |||
119 | painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, m_dimensionText); | 121 | painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, m_dimensionText); |
120 | painter->drawText(textRect, Qt::AlignLeft | Qt::AlignBottom, m_dateTimeText); | 122 | painter->drawText(textRect, Qt::AlignLeft | Qt::AlignBottom, m_dateText); |
121 | 123 | ||
@@ -131,2 +133,37 @@ Page* PageListBoxItem::page() const | |||
131 | 133 | ||
134 | QString PageListBoxItem::dateTimeString(QDateTime dateTime) | ||
135 | { | ||
136 | QString result; | ||
137 | |||
138 | Config config("qpe"); | ||
139 | config.setGroup("Date"); | ||
140 | |||
141 | QChar separator = config.readEntry("Separator", "/")[0]; | ||
142 | DateFormat::Order shortOrder = (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear); | ||
143 | |||
144 | for (int i = 0; i < 3; i++) { | ||
145 | switch((shortOrder >> (i * 3)) & 0x0007) { | ||
146 | case 0x0001: | ||
147 | result += QString().sprintf("%02d", dateTime.date().day()); | ||
148 | break; | ||
149 | case 0x0002: | ||
150 | result += QString().sprintf("%02d", dateTime.date().month()); | ||
151 | break; | ||
152 | case 0x0004: | ||
153 | result += QString().sprintf("%04d", dateTime.date().year()); | ||
154 | break; | ||
155 | default: | ||
156 | break; | ||
157 | } | ||
158 | |||
159 | if (i < 2) { | ||
160 | result += separator; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | result += QString().sprintf(" %02d:%02d", dateTime.time().hour(), dateTime.time().minute()); | ||
165 | |||
166 | return result; | ||
167 | } | ||
168 | |||
132 | PageListBox::PageListBox(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) | 169 | PageListBox::PageListBox(DrawPadCanvas* drawPadCanvas, QWidget* parent, const char* name) |
diff --git a/noncore/graphics/drawpad/thumbnailview.h b/noncore/graphics/drawpad/thumbnailview.h index 88c3b27..2eac667 100644 --- a/noncore/graphics/drawpad/thumbnailview.h +++ b/noncore/graphics/drawpad/thumbnailview.h | |||
@@ -23,2 +23,4 @@ class Page; | |||
23 | 23 | ||
24 | #include <qdatetime.h> | ||
25 | |||
24 | class QToolButton; | 26 | class QToolButton; |
@@ -38,2 +40,4 @@ public: | |||
38 | private: | 40 | private: |
41 | QString dateTimeString(QDateTime dateTime); | ||
42 | |||
39 | Page* m_pPage; | 43 | Page* m_pPage; |
@@ -44,3 +48,3 @@ private: | |||
44 | QString m_dimensionText; | 48 | QString m_dimensionText; |
45 | QString m_dateTimeText; | 49 | QString m_dateText; |
46 | 50 | ||