Diffstat (limited to 'noncore/graphics/drawpad/pageinformationdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/pageinformationdialog.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
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 | } | ||