author | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:53:22 (UTC) |
commit | d3925ba5bd25224bc4a60d3d6a107c464994a1ea (patch) (unidiff) | |
tree | 60f69da1d2b79ee3081e7ef5c09a46470ca6eda0 /pwmanager/pwmanager/pwmviewstyle_1.cpp | |
parent | ce83a3479d23b9e8a59c745ccd0a0b14f64ef4e8 (diff) | |
download | kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.zip kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.gz kdepimpi-d3925ba5bd25224bc4a60d3d6a107c464994a1ea.tar.bz2 |
initial revision
Diffstat (limited to 'pwmanager/pwmanager/pwmviewstyle_1.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.cpp | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp new file mode 100644 index 0000000..4c24bc4 --- a/dev/null +++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp | |||
@@ -0,0 +1,130 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2004 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License version 2 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | /*************************************************************************** | ||
13 | * copyright (C) 2004 by Ulf Schenk | ||
14 | * This file is originaly based on version 1.0.1 of pwmanager | ||
15 | * and was modified to run on embedded devices that run microkde | ||
16 | * | ||
17 | * $Id$ | ||
18 | **************************************************************************/ | ||
19 | |||
20 | #include "pwmviewstyle_1.h" | ||
21 | #include "pwmview.h" | ||
22 | #include "listviewpwm.h" | ||
23 | #include "commentbox.h" | ||
24 | |||
25 | #include <klocale.h> | ||
26 | |||
27 | #define INITIAL_CATEGORIES_WIDTH100 | ||
28 | |||
29 | PwMViewStyle_1::PwMViewStyle_1(PwMView *view) | ||
30 | : QObject() | ||
31 | { | ||
32 | #ifndef PWM_EMBEDDED | ||
33 | splitter = new QSplitter(view); | ||
34 | #else | ||
35 | splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); | ||
36 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
37 | |||
38 | //US topLayout->addWidget(mMiniSplitter ); | ||
39 | #endif | ||
40 | |||
41 | vbox1 = new QVBox(splitter); | ||
42 | categoriesTitle = new QLabel(vbox1); | ||
43 | categoriesList = new QListBox(vbox1); | ||
44 | #ifndef PWM_EMBEDDED | ||
45 | splitter2 = new QSplitter(splitter); | ||
46 | splitter2->setOrientation(Qt::Vertical); | ||
47 | #else | ||
48 | splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); | ||
49 | splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | ||
50 | |||
51 | //US topLayout->addWidget(mMiniSplitter ); | ||
52 | #endif | ||
53 | lv = new ListViewPwM(splitter2); | ||
54 | commentBox = new CommentBox(splitter2); | ||
55 | // set sizes and styles | ||
56 | commentBox->resize(commentBox->size().width(), 60); | ||
57 | QValueList<int> sizes; | ||
58 | #ifndef PWM_EMBEDDED | ||
59 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); | ||
60 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); | ||
61 | #else | ||
62 | sizes.append(INITIAL_CATEGORIES_WIDTH); | ||
63 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); | ||
64 | #endif | ||
65 | splitter->setSizes(sizes); | ||
66 | categoriesTitle->setAlignment(Qt::AlignHCenter); | ||
67 | #ifndef PWM_EMBEDDED | ||
68 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); | ||
69 | #else | ||
70 | categoriesTitle->setFrameShape(QFrame::StyledPanel); | ||
71 | #endif | ||
72 | categoriesTitle->setText(i18n("Categories:")); | ||
73 | catCtxMenu = new QPopupMenu(view); | ||
74 | catCtxMenu->insertItem(i18n("&Rename"), | ||
75 | view, SLOT(renCatButton_slot())); | ||
76 | catCtxMenu->insertItem(i18n("&Delete"), | ||
77 | view, SLOT(delCatButton_slot())); | ||
78 | // connections | ||
79 | connect(categoriesList, SIGNAL(highlighted(int)), | ||
80 | view, SLOT(shiftToView())); | ||
81 | connect(categoriesList, | ||
82 | SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), | ||
83 | this, | ||
84 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); | ||
85 | } | ||
86 | |||
87 | PwMViewStyle_1::~PwMViewStyle_1() | ||
88 | { | ||
89 | delete catCtxMenu; | ||
90 | delete splitter; | ||
91 | } | ||
92 | |||
93 | void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point) | ||
94 | { | ||
95 | if (!item) | ||
96 | return; | ||
97 | catCtxMenu->move(point); | ||
98 | catCtxMenu->show(); | ||
99 | } | ||
100 | |||
101 | void PwMViewStyle_1::delCategory(const QString &cat) | ||
102 | { | ||
103 | PWM_ASSERT(categoriesList); | ||
104 | int i, count = categoriesList->count(); | ||
105 | for (i = 0; i < count; ++i) { | ||
106 | if (categoriesList->text(i) == cat) { | ||
107 | categoriesList->removeItem(i); | ||
108 | return; | ||
109 | } | ||
110 | } | ||
111 | BUG(); | ||
112 | } | ||
113 | |||
114 | void PwMViewStyle_1::selectCategory(const QString &cat) | ||
115 | { | ||
116 | PWM_ASSERT(categoriesList); | ||
117 | int i, count = categoriesList->count(); | ||
118 | for (i = 0; i < count; ++i) { | ||
119 | if (categoriesList->text(i) == cat) { | ||
120 | categoriesList->setCurrentItem(i); | ||
121 | return; | ||
122 | } | ||
123 | } | ||
124 | // fall back to 0 | ||
125 | categoriesList->setCurrentItem(0); | ||
126 | } | ||
127 | |||
128 | #ifndef PWM_EMBEDDED | ||
129 | #include "pwmviewstyle_1.moc" | ||
130 | #endif | ||