summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/pageinformationdialog.cpp
authorleseb <leseb>2002-06-13 17:11:03 (UTC)
committer leseb <leseb>2002-06-13 17:11:03 (UTC)
commit615176c17202f1a8aa7aa504b8dd747b089385a9 (patch) (unidiff)
treeb5906e134037cd72871e0cecac4a3c9ed4c9a9e2 /noncore/graphics/drawpad/pageinformationdialog.cpp
parent54de91b66a2f0f985ff89503e919f85713d1f22c (diff)
downloadopie-615176c17202f1a8aa7aa504b8dd747b089385a9.zip
opie-615176c17202f1a8aa7aa504b8dd747b089385a9.tar.gz
opie-615176c17202f1a8aa7aa504b8dd747b089385a9.tar.bz2
More progress in page attributes
Diffstat (limited to 'noncore/graphics/drawpad/pageinformationdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/pageinformationdialog.cpp49
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
@@ -12,12 +12,15 @@
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "pageinformationdialog.h" 14#include "pageinformationdialog.h"
15 15
16#include "page.h" 16#include "page.h"
17 17
18#include <qpe/config.h>
19#include <qpe/timestring.h>
20
18#include <qgroupbox.h> 21#include <qgroupbox.h>
19#include <qlabel.h> 22#include <qlabel.h>
20#include <qlayout.h> 23#include <qlayout.h>
21#include <qlineedit.h> 24#include <qlineedit.h>
22 25
23PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const char* name) 26PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const char* name)
@@ -27,30 +30,39 @@ PageInformationDialog::PageInformationDialog(Page* page, QWidget* parent, const
27 30
28 setCaption(tr("Page Information")); 31 setCaption(tr("Page Information"));
29 32
30 QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this); 33 QGroupBox* generalGroupBox = new QGroupBox(0, Qt::Vertical, tr("General"), this);
31 34
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
35 QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this); 43 QGroupBox* sizeGroupBox = new QGroupBox(0, Qt::Vertical, tr("Size"), this);
36 44
37 QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox); 45 QLabel* widthLabel = new QLabel(tr("Width:"), sizeGroupBox);
38 QLabel* widthValueLabel = new QLabel(QString::number(m_pPage->width()), sizeGroupBox); 46 QLabel* widthValueLabel = new QLabel(QString::number(m_pPage->width()), sizeGroupBox);
39 47
40 QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox); 48 QLabel* heightLabel = new QLabel(tr("Height:"), sizeGroupBox);
41 QLabel* heightValueLabel = new QLabel(QString::number(m_pPage->height()), sizeGroupBox); 49 QLabel* heightValueLabel = new QLabel(QString::number(m_pPage->height()), sizeGroupBox);
42 50
43 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4); 51 QVBoxLayout* mainLayout = new QVBoxLayout(this, 4, 4);
44 generalGroupBox->layout()->setSpacing(4); 52 generalGroupBox->layout()->setSpacing(4);
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);
48 56
49 generalLayout->addWidget(titleLabel, 0, 0); 57 generalLayout->addWidget(titleLabel, 0, 0);
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
52 sizeLayout->addWidget(widthLabel, 0, 0); 64 sizeLayout->addWidget(widthLabel, 0, 0);
53 sizeLayout->addWidget(widthValueLabel, 0, 1); 65 sizeLayout->addWidget(widthValueLabel, 0, 1);
54 sizeLayout->addWidget(heightLabel, 1, 0); 66 sizeLayout->addWidget(heightLabel, 1, 0);
55 sizeLayout->addWidget(heightValueLabel, 1, 1); 67 sizeLayout->addWidget(heightValueLabel, 1, 1);
56 68
@@ -65,6 +77,41 @@ PageInformationDialog::~PageInformationDialog()
65} 77}
66 78
67QString PageInformationDialog::selectedTitle() 79QString PageInformationDialog::selectedTitle()
68{ 80{
69 return (m_pTitleLineEdit->text()); 81 return (m_pTitleLineEdit->text());
70} 82}
83
84QString 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}