Diffstat (limited to 'pwmanager/pwmanager/pwmviewstyle_0.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp new file mode 100644 index 0000000..6d46ac6 --- a/dev/null +++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp | |||
@@ -0,0 +1,93 @@ | |||
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_0.h" | ||
21 | #include "pwmview.h" | ||
22 | #include "listviewpwm.h" | ||
23 | #include "commentbox.h" | ||
24 | |||
25 | #include <klocale.h> | ||
26 | |||
27 | |||
28 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) | ||
29 | : QObject() | ||
30 | { | ||
31 | vbox1 = new QVBox(view); | ||
32 | vbox1->setSpacing(3); | ||
33 | hbox1 = new QHBox(vbox1); | ||
34 | hbox1->setSpacing(10); | ||
35 | categoriesTitle = new QLabel(hbox1); | ||
36 | categoriesTitle->setText(i18n("Categories:")); | ||
37 | categoriesCombo = new QComboBox(hbox1); | ||
38 | renCatButton = new QPushButton(i18n("&Rename"), hbox1); | ||
39 | delCatButton = new QPushButton(i18n("&Delete"), hbox1); | ||
40 | #ifndef PWM_EMBEDDED | ||
41 | splitter1 = new QSplitter(vbox1); | ||
42 | splitter1->setOrientation(Qt::Vertical); | ||
43 | #else | ||
44 | splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); | ||
45 | splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | ||
46 | |||
47 | //US topLayout->addWidget(mMiniSplitter ); | ||
48 | #endif | ||
49 | lv = new ListViewPwM(splitter1); | ||
50 | commentBox = new CommentBox(splitter1); | ||
51 | // set sizes and styles | ||
52 | commentBox->resize(commentBox->size().width(), 60); | ||
53 | categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); | ||
54 | // connections | ||
55 | connect(categoriesCombo, SIGNAL(activated(int)), | ||
56 | view, SLOT(shiftToView())); | ||
57 | connect(renCatButton, SIGNAL(clicked()), | ||
58 | view, SLOT(renCatButton_slot())); | ||
59 | connect(delCatButton, SIGNAL(clicked()), | ||
60 | view, SLOT(delCatButton_slot())); | ||
61 | } | ||
62 | |||
63 | PwMViewStyle_0::~PwMViewStyle_0() | ||
64 | { | ||
65 | delete vbox1; | ||
66 | } | ||
67 | |||
68 | void PwMViewStyle_0::delCategory(const QString &cat) | ||
69 | { | ||
70 | PWM_ASSERT(categoriesCombo); | ||
71 | int i, count = categoriesCombo->count(); | ||
72 | for (i = 0; i < count; ++i) { | ||
73 | if (categoriesCombo->text(i) == cat) { | ||
74 | categoriesCombo->removeItem(i); | ||
75 | return; | ||
76 | } | ||
77 | } | ||
78 | BUG(); | ||
79 | } | ||
80 | |||
81 | void PwMViewStyle_0::selectCategory(const QString &cat) | ||
82 | { | ||
83 | PWM_ASSERT(categoriesCombo); | ||
84 | int i, count = categoriesCombo->count(); | ||
85 | for (i = 0; i < count; ++i) { | ||
86 | if (categoriesCombo->text(i) == cat) { | ||
87 | categoriesCombo->setCurrentItem(i); | ||
88 | return; | ||
89 | } | ||
90 | } | ||
91 | // fall back to 0 | ||
92 | categoriesCombo->setCurrentItem(0); | ||
93 | } | ||