Diffstat (limited to 'pwmanager/pwmanager/pwmviewstyle_0.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp index 1d88a34..3d1f41f 100644 --- a/pwmanager/pwmanager/pwmviewstyle_0.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp | |||
@@ -1,118 +1,121 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 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 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 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 | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmviewstyle_0.h" | 20 | #include "pwmviewstyle_0.h" |
21 | #include "pwmview.h" | 21 | #include "pwmview.h" |
22 | #include "listviewpwm.h" | 22 | #include "listviewpwm.h" |
23 | #include "commentbox.h" | 23 | #include "commentbox.h" |
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
29 | //Added by qt3to4: | ||
30 | #include <QLabel> | ||
31 | #include <Q3ValueList> | ||
29 | 32 | ||
30 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) | 33 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) |
31 | : QObject() | 34 | : QObject() |
32 | { | 35 | { |
33 | vbox1 = new QVBox(view); | 36 | vbox1 = new Q3VBox(view); |
34 | vbox1->setSpacing(0); | 37 | vbox1->setSpacing(0); |
35 | hbox1 = new QHBox(vbox1); | 38 | hbox1 = new Q3HBox(vbox1); |
36 | hbox1->setSpacing(0); | 39 | hbox1->setSpacing(0); |
37 | categoriesTitle = new QLabel(hbox1); | 40 | categoriesTitle = new QLabel(hbox1); |
38 | categoriesTitle->setText(i18n("Category:")); | 41 | categoriesTitle->setText(i18n("Category:")); |
39 | categoriesCombo = new QComboBox(hbox1); | 42 | categoriesCombo = new QComboBox(hbox1); |
40 | categoriesCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred )); | 43 | categoriesCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred )); |
41 | renCatButton = new QPushButton( hbox1); | 44 | renCatButton = new QPushButton( hbox1); |
42 | renCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("edit", KIcon::Small) ); | 45 | renCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("edit", KIcon::Small) ); |
43 | int maxsi = renCatButton->sizeHint().height()+4; | 46 | int maxsi = renCatButton->sizeHint().height()+4; |
44 | renCatButton->setMinimumSize( maxsi, maxsi ); | 47 | renCatButton->setMinimumSize( maxsi, maxsi ); |
45 | delCatButton = new QPushButton( hbox1); | 48 | delCatButton = new QPushButton( hbox1); |
46 | delCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("editdelete", KIcon::Small) ); | 49 | delCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("editdelete", KIcon::Small) ); |
47 | maxsi = delCatButton->sizeHint().height()+4; | 50 | maxsi = delCatButton->sizeHint().height()+4; |
48 | delCatButton->setMinimumSize( maxsi, maxsi ); | 51 | delCatButton->setMinimumSize( maxsi, maxsi ); |
49 | delCatButton->setFocusPolicy( QWidget::NoFocus ); | 52 | delCatButton->setFocusPolicy( Qt::NoFocus ); |
50 | renCatButton->setFocusPolicy( QWidget::NoFocus ); | 53 | renCatButton->setFocusPolicy( Qt::NoFocus ); |
51 | 54 | ||
52 | #ifndef PWM_EMBEDDED | 55 | #ifndef PWM_EMBEDDED |
53 | splitter1 = new QSplitter(vbox1); | 56 | splitter1 = new QSplitter(vbox1); |
54 | splitter1->setOrientation(Qt::Vertical); | 57 | splitter1->setOrientation(Qt::Vertical); |
55 | #else | 58 | #else |
56 | splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); | 59 | splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); |
57 | splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 60 | splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
58 | 61 | ||
59 | //US topLayout->addWidget(mMiniSplitter ); | 62 | //US topLayout->addWidget(mMiniSplitter ); |
60 | #endif | 63 | #endif |
61 | lv = new ListViewPwM(splitter1); | 64 | lv = new ListViewPwM(splitter1); |
62 | commentBox = new CommentBox(splitter1); | 65 | commentBox = new CommentBox(splitter1); |
63 | // set sizes and styles | 66 | // set sizes and styles |
64 | commentBox->resize(commentBox->size().width(), 60); | 67 | commentBox->resize(commentBox->size().width(), 60); |
65 | categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); | 68 | categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); |
66 | // connections | 69 | // connections |
67 | connect(categoriesCombo, SIGNAL(activated(int)), | 70 | connect(categoriesCombo, SIGNAL(activated(int)), |
68 | view, SLOT(shiftToView())); | 71 | view, SLOT(shiftToView())); |
69 | connect(renCatButton, SIGNAL(clicked()), | 72 | connect(renCatButton, SIGNAL(clicked()), |
70 | view, SLOT(renCatButton_slot())); | 73 | view, SLOT(renCatButton_slot())); |
71 | connect(delCatButton, SIGNAL(clicked()), | 74 | connect(delCatButton, SIGNAL(clicked()), |
72 | view, SLOT(delCatButton_slot())); | 75 | view, SLOT(delCatButton_slot())); |
73 | connect(lv, SIGNAL(toggleOverview()), | 76 | connect(lv, SIGNAL(toggleOverview()), |
74 | this, SLOT(toggleSplitter())); | 77 | this, SLOT(toggleSplitter())); |
75 | } | 78 | } |
76 | 79 | ||
77 | PwMViewStyle_0::~PwMViewStyle_0() | 80 | PwMViewStyle_0::~PwMViewStyle_0() |
78 | { | 81 | { |
79 | delete vbox1; | 82 | delete vbox1; |
80 | } | 83 | } |
81 | void PwMViewStyle_0::toggleSplitter() | 84 | void PwMViewStyle_0::toggleSplitter() |
82 | { | 85 | { |
83 | 86 | ||
84 | QValueList<int> si = splitter1->sizes(); | 87 | Q3ValueList<int> si = splitter1->sizes(); |
85 | splitter1->toggle(); | 88 | splitter1->toggle(); |
86 | QValueList<int> si2 = splitter1->sizes(); | 89 | Q3ValueList<int> si2 = splitter1->sizes(); |
87 | //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); | 90 | //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); |
88 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { | 91 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { |
89 | int diff = si[0]/2; | 92 | int diff = si[0]/2; |
90 | if ( diff > 200 ) | 93 | if ( diff > 200 ) |
91 | diff = 200; | 94 | diff = 200; |
92 | si[0] -= diff; | 95 | si[0] -= diff; |
93 | si[1] += diff; | 96 | si[1] += diff; |
94 | splitter1->toggle(); | 97 | splitter1->toggle(); |
95 | splitter1->setSizes( si ); | 98 | splitter1->setSizes( si ); |
96 | } | 99 | } |
97 | 100 | ||
98 | } | 101 | } |
99 | 102 | ||
100 | void PwMViewStyle_0::delCategory(const QString &cat) | 103 | void PwMViewStyle_0::delCategory(const QString &cat) |
101 | { | 104 | { |
102 | PWM_ASSERT(categoriesCombo); | 105 | PWM_ASSERT(categoriesCombo); |
103 | int i, count = categoriesCombo->count(); | 106 | int i, count = categoriesCombo->count(); |
104 | for (i = 0; i < count; ++i) { | 107 | for (i = 0; i < count; ++i) { |
105 | if (categoriesCombo->text(i) == cat) { | 108 | if (categoriesCombo->text(i) == cat) { |
106 | categoriesCombo->removeItem(i); | 109 | categoriesCombo->removeItem(i); |
107 | return; | 110 | return; |
108 | } | 111 | } |
109 | } | 112 | } |
110 | BUG(); | 113 | BUG(); |
111 | } | 114 | } |
112 | 115 | ||
113 | void PwMViewStyle_0::selectCategory(const QString &cat) | 116 | void PwMViewStyle_0::selectCategory(const QString &cat) |
114 | { | 117 | { |
115 | PWM_ASSERT(categoriesCombo); | 118 | PWM_ASSERT(categoriesCombo); |
116 | int i, count = categoriesCombo->count(); | 119 | int i, count = categoriesCombo->count(); |
117 | for (i = 0; i < count; ++i) { | 120 | for (i = 0; i < count; ++i) { |
118 | if (categoriesCombo->text(i) == cat) { | 121 | if (categoriesCombo->text(i) == cat) { |