summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.cpp20
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.h5
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.cpp22
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.h2
-rw-r--r--pwmanager/pwmanager/commentbox.cpp87
-rw-r--r--pwmanager/pwmanager/commentbox.h40
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro3
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp4
-rw-r--r--pwmanager/pwmanager/pwmprefs.cpp3
-rw-r--r--pwmanager/pwmanager/pwmprefs.h1
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.cpp4
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp6
12 files changed, 132 insertions, 65 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp
index ed02e6d..dd09d13 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.cpp
+++ b/pwmanager/pwmanager/addentrywnd_emb.cpp
@@ -12,48 +12,49 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23$Id$ 23$Id$
24*/ 24*/
25 25
26#include "addentrywnd_emb.h" 26#include "addentrywnd_emb.h"
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31#include <qgroupbox.h> 31#include <qgroupbox.h>
32#include <klocale.h> 32#include <klocale.h>
33#include <kcombobox.h> 33#include <kcombobox.h>
34#include <klineedit.h> 34#include <klineedit.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qmultilineedit.h>
36 37
37/* 38/*
38 * Constructs a addEntryWnd as a child of 'parent', with the 39 * Constructs a addEntryWnd as a child of 'parent', with the
39 * name 'name' and widget flags set to 'f'. 40 * name 'name' and widget flags set to 'f'.
40 * 41 *
41 * The dialog will by default be modeless, unless you set 'modal' to 42 * The dialog will by default be modeless, unless you set 'modal' to
42 * TRUE to construct a modal dialog. 43 * TRUE to construct a modal dialog.
43 */ 44 */
44addEntryWnd::addEntryWnd( QWidget* parent, const char* name) 45addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
45 : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), 46 : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ),
46 KDialogBase::Ok | KDialogBase::Cancel, 47 KDialogBase::Ok | KDialogBase::Cancel,
47 KDialogBase::Ok, parent, name, true ) 48 KDialogBase::Ok, parent, name, true )
48{ 49{
49 QWidget *page = plainPage(); 50 QWidget *page = plainPage();
50 QVBoxLayout *pageLayout = new QVBoxLayout( page ); 51 QVBoxLayout *pageLayout = new QVBoxLayout( page );
51 52
52 QTabWidget* mTabWidget = new QTabWidget( page ); 53 QTabWidget* mTabWidget = new QTabWidget( page );
53 pageLayout->addWidget( mTabWidget ); 54 pageLayout->addWidget( mTabWidget );
54 55
55 //////////////////////////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////
56 // This is the Password tab 57 // This is the Password tab
57 QWidget *tab1 = new QWidget( mTabWidget ); 58 QWidget *tab1 = new QWidget( mTabWidget );
58 59
59 QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); 60 QGridLayout *layout = new QGridLayout( tab1, 3, 1 );
@@ -97,110 +98,95 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
97 layout->addWidget( revealButton, i, 0 ); 98 layout->addWidget( revealButton, i, 0 );
98 99
99 generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" ); 100 generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" );
100 layout->addWidget( generateButton, i, 1 ); 101 layout->addWidget( generateButton, i, 1 );
101 i++; 102 i++;
102 103
103 urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); 104 urlLineEdit = new KLineEdit( tab1, "urlLineEdit" );
104 label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); 105 label = new QLabel( urlLineEdit, i18n("URL:"), tab1 );
105 layout->addWidget( label, i, 0 ); 106 layout->addWidget( label, i, 0 );
106 layout->addWidget( urlLineEdit, i, 1 ); 107 layout->addWidget( urlLineEdit, i, 1 );
107 i++; 108 i++;
108 109
109 mTabWidget->addTab( tab1, i18n( "&Password" ) ); 110 mTabWidget->addTab( tab1, i18n( "&Password" ) );
110 111
111 112
112 //////////////////////////////////////////////////////////////////// 113 ////////////////////////////////////////////////////////////////////
113 // This is the Comment tab 114 // This is the Comment tab
114 QWidget *tab2 = new QWidget( mTabWidget ); 115 QWidget *tab2 = new QWidget( mTabWidget );
115 116
116 layout = new QGridLayout( tab2, 3, 1 ); 117 layout = new QGridLayout( tab2, 3, 1 );
117 layout->setMargin( KDialogBase::marginHintSmall() ); 118 layout->setMargin( KDialogBase::marginHintSmall() );
118 layout->setSpacing( KDialogBase::spacingHintSmall() ); 119 layout->setSpacing( KDialogBase::spacingHintSmall() );
119 i = 0; 120 i = 0;
120 121
121 122 commentTextEdit = new QMultiLineEdit(tab2);
122 123 layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 );
123 groupBox1 = new QGroupBox( tab2, "groupBox1" );
124 commentDummy = new QLabel( groupBox1, "commentDummy" );
125 commentDummy->setText( QString::null );
126
127 groupBox1->setTitle( i18n( "Comment:" ) );
128
129 layout->addMultiCellWidget( groupBox1, i, i, 0, 1 );
130 i++;
131
132
133 advancedCommentButton = new QPushButton( i18n("advanced comment"), groupBox1, "advancedCommentButton" );
134 advancedCommentButton->setToggleButton( FALSE );
135 layout->addMultiCellWidget( advancedCommentButton, i, i, 0, 1 );
136 i++; 124 i++;
137 125
138 126
139 mTabWidget->addTab( tab2, i18n( "&Comments" ) ); 127 mTabWidget->addTab( tab2, i18n( "&Comments" ) );
140 128
141 129
142 //////////////////////////////////////////////////////////////////// 130 ////////////////////////////////////////////////////////////////////
143 // This is the Launcher tab 131 // This is the Launcher tab
144 QWidget *tab3 = new QWidget( mTabWidget ); 132 QWidget *tab3 = new QWidget( mTabWidget );
145 133
146 layout = new QGridLayout( tab3, 3, 1 ); 134 layout = new QGridLayout( tab3, 3, 1 );
147 layout->setMargin( KDialogBase::marginHintSmall() ); 135 layout->setMargin( KDialogBase::marginHintSmall() );
148 layout->setSpacing( KDialogBase::spacingHintSmall() ); 136 layout->setSpacing( KDialogBase::spacingHintSmall() );
149 i = 0; 137 i = 0;
150 138
151 launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); 139 launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" );
152 label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); 140 label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 );
153 141
154 QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); 142 QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 );
155 QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); 143 QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 );
156 QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); 144 QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 );
157 QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); 145 QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 );
158 QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); 146 QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 );
159 147
160 label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); 148 label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 );
161 149
162 layout->addWidget( label1, i, 0 ); 150 layout->addWidget( label1, i, 0 );
163 layout->addWidget( label2, i, 1 ); 151 layout->addWidget( label2, i, 1 );
164 i++; 152 i++;
165 layout->addWidget( label3, i, 0 ); 153 layout->addWidget( label3, i, 0 );
166 layout->addWidget( label4, i, 1 ); 154 layout->addWidget( label4, i, 1 );
167 i++; 155 i++;
168 layout->addWidget( label5, i, 0 ); 156 layout->addWidget( label5, i, 0 );
169 i++; 157 i++;
170 158
171 layout->addWidget( label, i, 0 ); 159 layout->addWidget( label, i, 0 );
172 layout->addWidget( launcherLineEdit, i, 1 ); 160 layout->addWidget( launcherLineEdit, i, 1 );
173 i++; 161 i++;
174 162
175 163
176 mTabWidget->addTab( tab3, i18n( "&Launcher" ) ); 164 mTabWidget->addTab( tab3, i18n( "&Launcher" ) );
177 165
178 // signals and slots connections 166 // signals and slots connections
179 connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); 167 connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) );
180 connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); 168 connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) );
181 connect( advancedCommentButton, SIGNAL( toggled(bool) ), this, SLOT( advancedCommentButton_slot(bool) ) );
182
183} 169}
184 170
185/* 171/*
186 * Destroys the object and frees any allocated resources 172 * Destroys the object and frees any allocated resources
187 */ 173 */
188addEntryWnd::~addEntryWnd() 174addEntryWnd::~addEntryWnd()
189{ 175{
190 // no need to delete child widgets, Qt does it all for us 176 // no need to delete child widgets, Qt does it all for us
191} 177}
192 178
193void addEntryWnd::slotOk() 179void addEntryWnd::slotOk()
194{ 180{
195 qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); 181 qWarning( "addEntryWnd::slotOk(): Not implemented yet" );
196} 182}
197 183
198void addEntryWnd::revealButton_slot() 184void addEntryWnd::revealButton_slot()
199{ 185{
200 qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); 186 qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" );
201} 187}
202 188
203void addEntryWnd::generateButton_slot() 189void addEntryWnd::generateButton_slot()
204{ 190{
205 qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); 191 qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" );
206} 192}
diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h
index e368721..83761dc 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.h
+++ b/pwmanager/pwmanager/addentrywnd_emb.h
@@ -17,57 +17,56 @@
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22 22
23$Id$ 23$Id$
24*/ 24*/
25 25
26#ifndef ADDENTRYWND_EMB_H 26#ifndef ADDENTRYWND_EMB_H
27#define ADDENTRYWND_EMB_H 27#define ADDENTRYWND_EMB_H
28 28
29#include <qvariant.h> 29#include <qvariant.h>
30#include <kdialogbase.h> 30#include <kdialogbase.h>
31 31
32class QVBoxLayout; 32class QVBoxLayout;
33class QHBoxLayout; 33class QHBoxLayout;
34class QGridLayout; 34class QGridLayout;
35class QSpacerItem; 35class QSpacerItem;
36class KLineEdit; 36class KLineEdit;
37class QPushButton; 37class QPushButton;
38class KComboBox; 38class KComboBox;
39class QLabel; 39class QLabel;
40class QGroupBox; 40class QGroupBox;
41class QMultiLineEdit;
41 42
42class addEntryWnd : public KDialogBase 43class addEntryWnd : public KDialogBase
43{ 44{
44 Q_OBJECT 45 Q_OBJECT
45 46
46public: 47public:
47 addEntryWnd( QWidget* parent = 0, const char* name = 0); 48 addEntryWnd( QWidget* parent = 0, const char* name = 0);
48 ~addEntryWnd(); 49 ~addEntryWnd();
49 50
50 KLineEdit* launcherLineEdit; 51 KLineEdit* launcherLineEdit;
51 QPushButton* generateButton; 52 QPushButton* generateButton;
52 KLineEdit* descLineEdit; 53 KLineEdit* descLineEdit;
53 KComboBox* categoryComboBox; 54 KComboBox* categoryComboBox;
54 KLineEdit* usernameLineEdit; 55 KLineEdit* usernameLineEdit;
55 KLineEdit* pwLineEdit; 56 KLineEdit* pwLineEdit;
56 KLineEdit* urlLineEdit; 57 KLineEdit* urlLineEdit;
57 58
58 QPushButton* revealButton; 59 QPushButton* revealButton;
59 QGroupBox* groupBox1; 60 QMultiLineEdit* commentTextEdit;
60 QLabel* commentDummy;
61 QPushButton* advancedCommentButton;
62 61
63public slots: 62public slots:
64 virtual void revealButton_slot(); 63 virtual void revealButton_slot();
65 virtual void generateButton_slot(); 64 virtual void generateButton_slot();
66 virtual void advancedCommentButton_slot(bool on); 65 virtual void advancedCommentButton_slot(bool on);
67 66
68 protected slots: 67 protected slots:
69 virtual void slotOk(); 68 virtual void slotOk();
70 69
71}; 70};
72 71
73#endif // ADDENTRYWND_H 72#endif // ADDENTRYWND_H
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp
index ffd301f..d47f32c 100644
--- a/pwmanager/pwmanager/addentrywndimpl.cpp
+++ b/pwmanager/pwmanager/addentrywndimpl.cpp
@@ -12,67 +12,73 @@
12 * * 12 * *
13 ***************************************************************************/ 13 ***************************************************************************/
14 14
15/*************************************************************************** 15/***************************************************************************
16 * copyright (C) 2004 by Ulf Schenk 16 * copyright (C) 2004 by Ulf Schenk
17 * This file is originaly based on version 1.0.1 of pwmanager 17 * This file is originaly based on version 1.0.1 of pwmanager
18 * and was modified to run on embedded devices that run microkde 18 * and was modified to run on embedded devices that run microkde
19 * 19 *
20 * $Id$ 20 * $Id$
21 **************************************************************************/ 21 **************************************************************************/
22 22
23#include "addentrywndimpl.h" 23#include "addentrywndimpl.h"
24#include "pwmexception.h" 24#include "pwmexception.h"
25#include "pwgenwndimpl.h" 25#include "pwgenwndimpl.h"
26#ifndef PWM_EMBEDDED 26#ifndef PWM_EMBEDDED
27#include "advcommeditimpl.h" 27#include "advcommeditimpl.h"
28#endif 28#endif
29#include "htmlgen.h" 29#include "htmlgen.h"
30 30
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32#include <klocale.h> 32#include <klocale.h>
33 33
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlayout.h>
37
36 38
37#ifndef PWM_EMBEDDED 39#ifndef PWM_EMBEDDED
38AddEntryWndImpl::AddEntryWndImpl() 40AddEntryWndImpl::AddEntryWndImpl()
39 : addEntryWnd( 0, "AddEntryWndImpl", TRUE) 41 : addEntryWnd( 0, "AddEntryWndImpl", TRUE)
40#else 42#else
41AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) 43AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name)
42 : addEntryWnd( parent, name) 44 : addEntryWnd( parent, name)
43#endif 45#endif
44{ 46{
47#ifndef PWM_EMBEDDED
45 editAdvCommentButton = 0; 48 editAdvCommentButton = 0;
46 commentTextEdit = 0; 49 commentTextEdit = 0;
50#endif
47 switchComment(false); 51 switchComment(false);
48 pwGen = new PwGenWndImpl(this); 52 pwGen = new PwGenWndImpl(this);
49} 53}
50 54
51AddEntryWndImpl::~AddEntryWndImpl() 55AddEntryWndImpl::~AddEntryWndImpl()
52{ 56{
57#ifndef PWM_EMBEDDED
53 delete_ifnot_null(editAdvCommentButton); 58 delete_ifnot_null(editAdvCommentButton);
54 delete_ifnot_null(commentTextEdit); 59 delete_ifnot_null(commentTextEdit);
60#endif
55 delete pwGen; 61 delete pwGen;
56} 62}
57 63
58#ifdef PWM_EMBEDDED 64#ifdef PWM_EMBEDDED
59void AddEntryWndImpl::slotOk() 65void AddEntryWndImpl::slotOk()
60{ 66{
61 slotApply(); 67 slotApply();
62 68
63 if (pwLineEdit->text().isEmpty()) { 69 if (pwLineEdit->text().isEmpty()) {
64 KMessageBox::error(this, 70 KMessageBox::error(this,
65 i18n("Sorry, you haven't set a password."), 71 i18n("Sorry, you haven't set a password."),
66 i18n("no password")); 72 i18n("no password"));
67 return; 73 return;
68 } 74 }
69 75
70 if (descLineEdit->text().isEmpty()) { 76 if (descLineEdit->text().isEmpty()) {
71 KMessageBox::error(this, 77 KMessageBox::error(this,
72 i18n("You haven't set a \"Description\"."), 78 i18n("You haven't set a \"Description\"."),
73 i18n("Description not set")); 79 i18n("Description not set"));
74 return; 80 return;
75 } 81 }
76 82
77 KDialogBase::slotOk(); 83 KDialogBase::slotOk();
78} 84}
@@ -112,92 +118,100 @@ void AddEntryWndImpl::setCurrCategory(const QString &cat)
112 return; 118 return;
113 } 119 }
114 } 120 }
115 BUG(); 121 BUG();
116} 122}
117 123
118void AddEntryWndImpl::revealButton_slot() 124void AddEntryWndImpl::revealButton_slot()
119{ 125{
120 if (revealButton->isOn()) { 126 if (revealButton->isOn()) {
121 pwLineEdit->setEchoMode(QLineEdit::Normal); 127 pwLineEdit->setEchoMode(QLineEdit::Normal);
122 } else { 128 } else {
123 pwLineEdit->setEchoMode(QLineEdit::Password); 129 pwLineEdit->setEchoMode(QLineEdit::Password);
124 } 130 }
125} 131}
126 132
127void AddEntryWndImpl::generateButton_slot() 133void AddEntryWndImpl::generateButton_slot()
128{ 134{
129 if (!pwGen->exec()) 135 if (!pwGen->exec())
130 return; 136 return;
131 setPassword(pwGen->getPassword()); 137 setPassword(pwGen->getPassword());
132} 138}
133 139
134QString AddEntryWndImpl::getComment() 140QString AddEntryWndImpl::getComment()
135{ 141{
142#ifndef PWM_EMBEDDED
136 if (isAdvancedComment()) { 143 if (isAdvancedComment()) {
137 return advCommentDta; 144 return advCommentDta;
138 } 145 }
146#endif
139 return commentTextEdit->text(); 147 return commentTextEdit->text();
140} 148}
141 149
142void AddEntryWndImpl::setComment(const QString &comm) 150void AddEntryWndImpl::setComment(const QString &comm)
143{ 151{
152#ifndef PWM_EMBEDDED
144 if (HtmlGen::isHtml(comm)) { 153 if (HtmlGen::isHtml(comm)) {
145 advancedCommentButton->setOn(true); 154 advancedCommentButton->setOn(true);
146 advCommentDta = comm; 155 advCommentDta = comm;
147 } else { 156 } else {
148 advancedCommentButton->setOn(false); 157 advancedCommentButton->setOn(false);
149 commentTextEdit->setText(comm); 158 commentTextEdit->setText(comm);
150 } 159 }
160#else
161 commentTextEdit->setText(comm);
162#endif
151} 163}
152 164
153void AddEntryWndImpl::advancedCommentButton_slot(bool on) 165void AddEntryWndImpl::advancedCommentButton_slot(bool on)
154{ 166{
167#ifndef PWM_EMBEDDED
155 switchComment(on); 168 switchComment(on);
169#endif
156} 170}
157 171
158void AddEntryWndImpl::switchComment(bool toAdvanced) 172void AddEntryWndImpl::switchComment(bool toAdvanced)
159{ 173{
174#ifndef PWM_EMBEDDED
175
160 useAdvComment = toAdvanced; 176 useAdvComment = toAdvanced;
161 if (toAdvanced) { 177 if (toAdvanced) {
162 if (commentTextEdit) { 178 if (commentTextEdit) {
163 savedCommentText = commentTextEdit->text(); 179 savedCommentText = commentTextEdit->text();
164 delete_and_null(commentTextEdit); 180 delete_and_null(commentTextEdit);
165 } 181 }
166 if (editAdvCommentButton) 182 if (editAdvCommentButton)
167 return; 183 return;
168 editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."), 184 editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."),
169 commentDummy); 185 commentDummy);
170 editAdvCommentButton->resize(commentDummy->size().width(), 50); 186 editAdvCommentButton->resize(commentDummy->size().width(), 50);
171 connect(editAdvCommentButton, SIGNAL(clicked()), 187 connect(editAdvCommentButton, SIGNAL(clicked()),
172 this, SLOT(editAdvCommentButton_slot())); 188 this, SLOT(editAdvCommentButton_slot()));
173 editAdvCommentButton->show(); 189 editAdvCommentButton->show();
174 } else { 190 } else {
175 delete_ifnot_null(editAdvCommentButton); 191 delete_ifnot_null(editAdvCommentButton);
176 if (commentTextEdit) 192 if (commentTextEdit)
177 return; 193 return;
178#ifndef PWM_EMBEDDED 194
179 commentTextEdit = new QTextEdit(commentDummy); 195 commentTextEdit = new QTextEdit(commentDummy);
180 commentTextEdit->setTextFormat(Qt::PlainText); 196 commentTextEdit->setTextFormat(Qt::PlainText);
181#else
182 commentTextEdit = new QMultiLineEdit(commentDummy);
183#endif
184 commentTextEdit->resize(commentDummy->size()); 197 commentTextEdit->resize(commentDummy->size());
185 commentTextEdit->setText(savedCommentText); 198 commentTextEdit->setText(savedCommentText);
186 commentTextEdit->show(); 199 commentTextEdit->show();
187 } 200 }
201#endif
188} 202}
189 203
190void AddEntryWndImpl::editAdvCommentButton_slot() 204void AddEntryWndImpl::editAdvCommentButton_slot()
191{ 205{
192#ifndef PWM_EMBEDDED 206#ifndef PWM_EMBEDDED
193 AdvCommEditImpl editor(this); 207 AdvCommEditImpl editor(this);
194 editor.setHtmlDta(advCommentDta); 208 editor.setHtmlDta(advCommentDta);
195 if (editor.exec()) 209 if (editor.exec())
196 return; 210 return;
197 advCommentDta = editor.getHtmlDta(); 211 advCommentDta = editor.getHtmlDta();
198#endif 212#endif
199} 213}
200 214
201#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
202#include "addentrywndimpl.moc" 216#include "addentrywndimpl.moc"
203#endif 217#endif
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h
index 622e9d2..ce9a594 100644
--- a/pwmanager/pwmanager/addentrywndimpl.h
+++ b/pwmanager/pwmanager/addentrywndimpl.h
@@ -91,37 +91,37 @@ public slots:
91 void okButton_slot(); 91 void okButton_slot();
92 /** cancel button pressed */ 92 /** cancel button pressed */
93 void cancelButton_slot(); 93 void cancelButton_slot();
94//MOC_SKIP_END 94//MOC_SKIP_END
95#else 95#else
96 virtual void slotOk(); 96 virtual void slotOk();
97#endif 97#endif
98 /** Reveal button pressed */ 98 /** Reveal button pressed */
99 void revealButton_slot(); 99 void revealButton_slot();
100 /** Generate button pressed */ 100 /** Generate button pressed */
101 void generateButton_slot(); 101 void generateButton_slot();
102 /** advanced comment button pressed */ 102 /** advanced comment button pressed */
103 void advancedCommentButton_slot(bool on); 103 void advancedCommentButton_slot(bool on);
104 /** edit advanced comment button pressed */ 104 /** edit advanced comment button pressed */
105 void editAdvCommentButton_slot(); 105 void editAdvCommentButton_slot();
106 106
107protected: 107protected:
108 void switchComment(bool toAdvanced); 108 void switchComment(bool toAdvanced);
109 109
110protected: 110protected:
111 QPushButton *editAdvCommentButton; 111 QPushButton *editAdvCommentButton;
112#ifndef PWM_EMBEDDED 112#ifndef PWM_EMBEDDED
113 QTextEdit *commentTextEdit; 113 QTextEdit *commentTextEdit;
114#else 114#else
115 QMultiLineEdit * commentTextEdit; 115 //nothing here
116#endif 116#endif
117 /** saved data from normal comment text edit box */ 117 /** saved data from normal comment text edit box */
118 QString savedCommentText; 118 QString savedCommentText;
119 /** use an advanced comment? */ 119 /** use an advanced comment? */
120 bool useAdvComment; 120 bool useAdvComment;
121 /** data of advanced comment (if available) */ 121 /** data of advanced comment (if available) */
122 QString advCommentDta; 122 QString advCommentDta;
123 /** password generation object */ 123 /** password generation object */
124 PwGenWndImpl *pwGen; 124 PwGenWndImpl *pwGen;
125}; 125};
126 126
127#endif 127#endif
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp
index 280b139..4a76f36 100644
--- a/pwmanager/pwmanager/commentbox.cpp
+++ b/pwmanager/pwmanager/commentbox.cpp
@@ -10,229 +10,272 @@
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 "commentbox.h" 20#include "commentbox.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "htmlgen.h" 22#include "htmlgen.h"
23 23
24#include <klocale.h> 24#include <klocale.h>
25 25
26#ifndef PWM_EMBEDDED 26#ifndef PWM_EMBEDDED
27#include <khtml_part.h> 27#include <khtml_part.h>
28#include <khtmlview.h> 28#include <khtmlview.h>
29#include <qtextedit.h> 29#include <qtextedit.h>
30#else 30#else
31#include <qmultilineedit.h> 31#include <qmultilineedit.h>
32#endif 32#endif
33 33
34
35
36#ifndef PWM_EMBEDDED
34CommentBox::CommentBox(QWidget *_parentWidget) 37CommentBox::CommentBox(QWidget *_parentWidget)
35{ 38{
36 PWM_ASSERT(_parentWidget); 39 PWM_ASSERT(_parentWidget);
37 parentWidget = _parentWidget; 40 parentWidget = _parentWidget;
38 textDta = 0; 41 textDta = 0;
39#ifndef PWM_EMBEDDED
40 htmlDta = 0; 42 htmlDta = 0;
41#endif
42 mode = mode_notSet; 43 mode = mode_notSet;
43} 44}
44 45
45CommentBox::~CommentBox() 46CommentBox::~CommentBox()
46{ 47{
47 clearText(); 48 clearText();
48 clearHtml(); 49 clearHtml();
49} 50}
50 51
51void CommentBox::clear() 52void CommentBox::clear()
52{ 53{
53 clearText(); 54 clearText();
54 clearHtml(); 55 clearHtml();
55 mode = mode_notSet; 56 mode = mode_notSet;
57 this->hide();
56} 58}
57 59
58void CommentBox::clearText() 60void CommentBox::clearText()
59{ 61{
60 delete_ifnot_null(textDta); 62 delete_ifnot_null(textDta);
61} 63}
62 64
63void CommentBox::clearHtml() 65void CommentBox::clearHtml()
64{ 66{
65#ifndef PWM_EMBEDDED
66 delete_ifnot_null(htmlDta); 67 delete_ifnot_null(htmlDta);
67#endif
68} 68}
69 69
70void CommentBox::setText(const QString &text) 70void CommentBox::setText(const QString &text)
71{ 71{
72 switchTo(mode_text); 72 switchTo(mode_text);
73 PWM_ASSERT(textDta); 73 PWM_ASSERT(textDta);
74 textDta->setText(i18n("Comment") + ": " + text); 74 textDta->setText(i18n("Comment") + ": " + text);
75 if (!textDta->isVisible()) 75 if (!textDta->isVisible())
76 textDta->show(); 76 textDta->show();
77} 77}
78 78
79bool CommentBox::getText(QString *text) 79bool CommentBox::getText(QString *text)
80{ 80{
81 if (mode != mode_text) 81 if (mode != mode_text)
82 return false; 82 return false;
83 PWM_ASSERT(text); 83 PWM_ASSERT(text);
84 if (!textDta) { 84 if (!textDta) {
85 *text = ""; 85 *text = "";
86 return true; 86 return true;
87 } 87 }
88 *text = textDta->text(); 88 *text = textDta->text();
89 return true; 89 return true;
90} 90}
91 91
92void CommentBox::setHtml(QString code) 92void CommentBox::setHtml(QString code)
93{ 93{
94#ifndef PWM_EMBEDDED
95 switchTo(mode_html); 94 switchTo(mode_html);
96 PWM_ASSERT(htmlDta); 95 PWM_ASSERT(htmlDta);
97 if (!HtmlGen::replaceSSDummy(&code)) 96 if (!HtmlGen::replaceSSDummy(&code))
98 printWarn("CommentBox::setHtml(): replaceSSDummy() failed!"); 97 printWarn("CommentBox::setHtml(): replaceSSDummy() failed!");
99 htmlDta->begin(); 98 htmlDta->begin();
100 htmlDta->write(code); 99 htmlDta->write(code);
101 htmlDta->end(); 100 htmlDta->end();
102 htmlDta->show(); 101 htmlDta->show();
103#endif
104} 102}
105 103
106void CommentBox::setContent(const QString &dta) 104void CommentBox::setContent(const QString &dta)
107{ 105{
108 // if there's no data, hide the comment-box 106 // if there's no data, hide the comment-box
109 if (dta.isEmpty()) { 107 if (dta.isEmpty()) {
110 clear(); 108 clear();
111 return; 109 return;
112 } 110 }
113#ifndef PWM_EMBEDDED
114 if (HtmlGen::isHtml(dta)) { 111 if (HtmlGen::isHtml(dta)) {
115 setHtml(dta); 112 setHtml(dta);
116 return; 113 return;
117 } 114 }
118#endif
119 // we assume it's plain text 115 // we assume it's plain text
120 setText(dta); 116 setText(dta);
121} 117}
122 118
123void CommentBox::switchTo(commentBoxMode newMode) 119void CommentBox::switchTo(commentBoxMode newMode)
124{ 120{
125 if (newMode == mode) 121 if (newMode == mode)
126 return; 122 return;
127 123
128 // cleanup old mode 124 // cleanup old mode
129 switch (mode) { 125 switch (mode) {
130 case mode_text: 126 case mode_text:
131 clearText(); 127 clearText();
132 break; 128 break;
133 case mode_html: 129 case mode_html:
134 clearHtml(); 130 clearHtml();
135 break; 131 break;
136 default: 132 default:
137 break; 133 break;
138 } 134 }
139 135
140 // setup new mode 136 // setup new mode
141 switch (newMode) { 137 switch (newMode) {
142 case mode_text: 138 case mode_text:
143#ifndef PWM_EMBEDDED
144 textDta = new QTextEdit(parentWidget); 139 textDta = new QTextEdit(parentWidget);
145 textDta->setTextFormat(Qt::PlainText); 140 textDta->setTextFormat(Qt::PlainText);
146#else
147 textDta = new QMultiLineEdit(parentWidget);
148#endif
149 textDta->setReadOnly(true); 141 textDta->setReadOnly(true);
150 textDta->show(); 142 textDta->show();
151 break; 143 break;
152 case mode_html: 144 case mode_html:
153#ifndef PWM_EMBEDDED
154 htmlDta = new KHTMLPart(parentWidget, 0, 145 htmlDta = new KHTMLPart(parentWidget, 0,
155 parentWidget); 146 parentWidget);
156 htmlDta->show(); 147 htmlDta->show();
157#endif
158 break; 148 break;
159 default: 149 default:
160 BUG(); 150 BUG();
161 break; 151 break;
162 } 152 }
163 153
164 mode = newMode; 154 mode = newMode;
165} 155}
166 156
167void CommentBox::show() 157void CommentBox::show()
168{ 158{
169 switch (mode) { 159 switch (mode) {
170 case mode_text: 160 case mode_text:
171 PWM_ASSERT(textDta); 161 PWM_ASSERT(textDta);
172 textDta->show(); 162 textDta->show();
173 break; 163 break;
174 case mode_html: 164 case mode_html:
175#ifndef PWM_EMBEDDED
176 PWM_ASSERT(htmlDta); 165 PWM_ASSERT(htmlDta);
177 htmlDta->show(); 166 htmlDta->show();
178#endif
179 break; 167 break;
180 default: 168 default:
181 break; 169 break;
182 } 170 }
171
183} 172}
184 173
185void CommentBox::hide() 174void CommentBox::hide()
186{ 175{
187 switch (mode) { 176 switch (mode) {
188 case mode_text: 177 case mode_text:
189 PWM_ASSERT(textDta); 178 PWM_ASSERT(textDta);
190 textDta->hide(); 179 textDta->hide();
191 break; 180 break;
192 case mode_html: 181 case mode_html:
193#ifndef PWM_EMBEDDED
194 PWM_ASSERT(htmlDta); 182 PWM_ASSERT(htmlDta);
195 htmlDta->hide(); 183 htmlDta->hide();
196#endif
197 break; 184 break;
198 default: 185 default:
199 break; 186 break;
200 } 187 }
201} 188}
202 189
203void CommentBox::resize(const QSize &size) 190void CommentBox::resize(const QSize &size)
204{ 191{
205 switch (mode) { 192 switch (mode) {
206 case mode_text: 193 case mode_text:
207 PWM_ASSERT(textDta); 194 PWM_ASSERT(textDta);
208 textDta->resize(size); 195 textDta->resize(size);
209 break; 196 break;
210 case mode_html: 197 case mode_html:
211#ifndef PWM_EMBEDDED
212 PWM_ASSERT(htmlDta); 198 PWM_ASSERT(htmlDta);
213 htmlDta->view()->resize(size); 199 htmlDta->view()->resize(size);
214#endif
215 break; 200 break;
216 default: 201 default:
217 break; 202 break;
218 } 203 }
204
219} 205}
220 206
221QSize CommentBox::size() 207QSize CommentBox::size()
222{ 208{
223 switch (mode) { 209 switch (mode) {
224 case mode_text: 210 case mode_text:
225 PWM_ASSERT(textDta); 211 PWM_ASSERT(textDta);
226 return textDta->size(); 212 return textDta->size();
227 break; 213 break;
228 case mode_html: 214 case mode_html:
229#ifndef PWM_EMBEDDED
230 PWM_ASSERT(htmlDta); 215 PWM_ASSERT(htmlDta);
231 return htmlDta->view()->size(); 216 return htmlDta->view()->size();
232#endif
233 break; 217 break;
234 default: 218 default:
235 break; 219 break;
236 } 220 }
221
237 return QSize(); 222 return QSize();
238} 223}
224
225
226////////////////////////////////////////////////////////////////////////
227
228#else
229
230CommentBox::CommentBox(QWidget *_parentWidget)
231 : QMultiLineEdit(_parentWidget)
232
233{
234 this->setReadOnly(true);
235}
236
237CommentBox::~CommentBox()
238{
239}
240
241void CommentBox::clear()
242{
243 this->hide();
244}
245
246
247void CommentBox::setText(const QString &text)
248{
249 QMultiLineEdit::setText(i18n("Comment") + ": " + text);
250 if (!this->isVisible())
251 this->show();
252}
253
254bool CommentBox::getText(QString *text)
255{
256 *text = this->text();
257 return true;
258}
259
260void CommentBox::setContent(const QString &dta)
261{
262 // if there's no data, hide the comment-box
263 if (dta.isEmpty()) {
264 clear();
265 return;
266 }
267
268 // we assume it's plain text
269 setText(dta);
270}
271
272#endif
273
274
275
276
277
278
279
280
281
diff --git a/pwmanager/pwmanager/commentbox.h b/pwmanager/pwmanager/commentbox.h
index a220acd..352867c 100644
--- a/pwmanager/pwmanager/commentbox.h
+++ b/pwmanager/pwmanager/commentbox.h
@@ -1,56 +1,55 @@
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#ifndef COMMENTBOX_H 20#ifndef COMMENTBOX_H
21#define COMMENTBOX_H 21#define COMMENTBOX_H
22 22
23#include <qstring.h> 23#include <qstring.h>
24#include <qsize.h> 24#include <qsize.h>
25
26class QWidget; 25class QWidget;
27class QTextEdit; 26class QTextEdit;
28class QMultiLineEdit;
29class KHTMLPart; 27class KHTMLPart;
30 28
31/** Implementation of the advanced HTML comment box */ 29#ifndef PWM_EMBEDDED
32class CommentBox 30
31class CommentBox
33{ 32{
34protected: 33protected:
35 enum commentBoxMode 34 enum commentBoxMode
36 { 35 {
37 mode_notSet = 0, 36 mode_notSet = 0,
38 mode_text, 37 mode_text,
39 mode_html 38 mode_html
40 }; 39 };
41 40
42public: 41public:
43 CommentBox(QWidget *_parentWidget); 42 CommentBox(QWidget *_parentWidget);
44 ~CommentBox(); 43 ~CommentBox();
45 44
46 /** clear all data in the comment box */ 45 /** clear all data in the comment box */
47 void clear(); 46 void clear();
48 /** show the comment box */ 47 /** show the comment box */
49 void show(); 48 void show();
50 /** hide the comment box */ 49 /** hide the comment box */
51 void hide(); 50 void hide();
52 /** resize the comment box */ 51 /** resize the comment box */
53 void resize(const QSize &size); 52 void resize(const QSize &size);
54 void resize(int w, int h) 53 void resize(int w, int h)
55 { resize(QSize(w, h)); } 54 { resize(QSize(w, h)); }
56 /** get the size of the comment box */ 55 /** get the size of the comment box */
@@ -64,37 +63,62 @@ public:
64 */ 63 */
65 bool getText(QString *text); 64 bool getText(QString *text);
66 /** if neccessary switch to HTML-mode and 65 /** if neccessary switch to HTML-mode and
67 * insert this html code into the comment box 66 * insert this html code into the comment box
68 */ 67 */
69 void setHtml(QString code); 68 void setHtml(QString code);
70 /** checks "dta" for its type, sets the correct 69 /** checks "dta" for its type, sets the correct
71 * mode and writes "dta" to the comment box 70 * mode and writes "dta" to the comment box
72 */ 71 */
73 void setContent(const QString &dta); 72 void setContent(const QString &dta);
74 73
75protected: 74protected:
76 /** switch the current mode */ 75 /** switch the current mode */
77 void switchTo(commentBoxMode newMode); 76 void switchTo(commentBoxMode newMode);
78 /** clear all text data */ 77 /** clear all text data */
79 void clearText(); 78 void clearText();
80 /** clear all HTML data */ 79 /** clear all HTML data */
81 void clearHtml(); 80 void clearHtml();
82 81
83protected: 82protected:
84 /** parent widget for this comment box */ 83 /** parent widget for this comment box */
85 QWidget *parentWidget; 84 QWidget *parentWidget;
86 /** current comment box usage type */ 85 /** current comment box usage type */
87 commentBoxMode mode; 86 commentBoxMode mode;
88#ifndef PWM_EMBEDDED
89 /** if the comment box is a normal textbox, data is stored here */ 87 /** if the comment box is a normal textbox, data is stored here */
90 QTextEdit *textDta; 88 QTextEdit *textDta;
91 /** if the comment box is a HTML box, data is stored here */ 89 /** if the comment box is a HTML box, data is stored here */
92 KHTMLPart *htmlDta; 90 KHTMLPart *htmlDta;
91};
92
93#else 93#else
94 /** if the comment box is a normal textbox, data is stored here */ 94#include <qmultilineedit.h>
95 QMultiLineEdit *textDta; 95/** Implementation of the advanced HTML comment box */
96#endif 96//US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size
97// without conflicting with the two display modes
98
99class CommentBox : public QMultiLineEdit
100{
101public:
102 CommentBox(QWidget *_parentWidget);
103 ~CommentBox();
104
105 /** clear all data in the comment box */
106 void clear();
107 /** if neccessary switch to text-mode and
108 * insert this text into the comment box
109 */
110 void setText(const QString &text);
111 /** get the text of the comment box.
112 * If it's not in text-mode it returns false
113 */
114 bool getText(QString *text);
115 /** if neccessary switch to HTML-mode and
116 * insert this html code into the comment box
117 */
118 void setContent(const QString &dta);
97 119
98}; 120};
121#endif
122
99 123
100#endif 124#endif
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro
index 3bcf679..4e482ca 100644
--- a/pwmanager/pwmanager/pwmanagerE.pro
+++ b/pwmanager/pwmanager/pwmanagerE.pro
@@ -1,35 +1,36 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = pwmpi 5 TARGET = pwmpi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include 10INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include
11DEFINES += PWM_EMBEDDED PWM_DEBUG 11DEFINES += PWM_EMBEDDED CONFIG_DEBUG
12
12LIBS += -lmicrokde 13LIBS += -lmicrokde
13LIBS += -lmicroqtcompat 14LIBS += -lmicroqtcompat
14LIBS += -lmicrokdepim 15LIBS += -lmicrokdepim
15LIBS += -L$(QPEDIR)/lib 16LIBS += -L$(QPEDIR)/lib
16LIBS += -lqpe 17LIBS += -lqpe
17LIBS += -lbz2 18LIBS += -lbz2
18LIBS += $(QTOPIALIB) 19LIBS += $(QTOPIALIB)
19 20
20#INTERFACES = \ 21#INTERFACES = \
21#addentrywnd.ui \ 22#addentrywnd.ui \
22#configwnd.ui \ 23#configwnd.ui \
23#findwnd.ui \ 24#findwnd.ui \
24#getmasterpwwnd.ui \ 25#getmasterpwwnd.ui \
25#pwgenwnd.ui \ 26#pwgenwnd.ui \
26#setmasterpwwnd.ui \ 27#setmasterpwwnd.ui \
27#subtbledit.ui 28#subtbledit.ui
28 29
29#INTERFACES = \ 30#INTERFACES = \
30#subtbledit.ui \ 31#subtbledit.ui \
31 32
32 33
33 34
34#HEADERS = \ 35#HEADERS = \
35#configuration_31compat.h \ 36#configuration_31compat.h \
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index c167c2c..1b6d36f 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -23,50 +23,48 @@
23#include "sha1.h" 23#include "sha1.h"
24#include "globalstuff.h" 24#include "globalstuff.h"
25#include "gpasmanfile.h" 25#include "gpasmanfile.h"
26#include "serializer.h" 26#include "serializer.h"
27#include "compressgzip.h" 27#include "compressgzip.h"
28#include "compressbzip2.h" 28#include "compressbzip2.h"
29#include "randomizer.h" 29#include "randomizer.h"
30#include "pwminit.h" 30#include "pwminit.h"
31#ifndef PWM_EMBEDDED 31#ifndef PWM_EMBEDDED
32//US #include "libgryptif.h" 32//US #include "libgryptif.h"
33#else 33#else
34#include "pwmprefs.h" 34#include "pwmprefs.h"
35#include "kglobal.h" 35#include "kglobal.h"
36#endif 36#endif
37 37
38#ifdef CONFIG_KWALLETIF 38#ifdef CONFIG_KWALLETIF
39# include "kwalletemu.h" 39# include "kwalletemu.h"
40#endif // CONFIG_KWALLETIF 40#endif // CONFIG_KWALLETIF
41 41
42#include <qdatetime.h> 42#include <qdatetime.h>
43#include <qsize.h> 43#include <qsize.h>
44#include <qfileinfo.h> 44#include <qfileinfo.h>
45#include <qfile.h> 45#include <qfile.h>
46 46
47#define __USE_GNU
48#define _GNU_SOURCE
49#include <stdio.h> 47#include <stdio.h>
50#include <stdlib.h> 48#include <stdlib.h>
51#include <errno.h> 49#include <errno.h>
52#include <string.h> 50#include <string.h>
53//US#include <iostream> 51//US#include <iostream>
54#include <algorithm> 52#include <algorithm>
55#include <sys/types.h> 53#include <sys/types.h>
56#include <sys/stat.h> 54#include <sys/stat.h>
57#include <unistd.h> 55#include <unistd.h>
58#include <stdint.h> 56#include <stdint.h>
59 57
60//TODO: reset to its normal value. 58//TODO: reset to its normal value.
61 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ 59 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */
62 60
63using namespace std; 61using namespace std;
64 62
65 63
66void PwMDocList::add(PwMDoc *doc, const string &id) 64void PwMDocList::add(PwMDoc *doc, const string &id)
67{ 65{
68#ifdef PWM_DEBUG 66#ifdef PWM_DEBUG
69 // check for existance of object in debug mode only. 67 // check for existance of object in debug mode only.
70 vector<listItem>::iterator begin = docList.begin(), 68 vector<listItem>::iterator begin = docList.begin(),
71 end = docList.end(), 69 end = docList.end(),
72 i = begin; 70 i = begin;
@@ -1150,50 +1148,48 @@ bool PwMDoc::serializeDta(string *d)
1150 d->assign(ser.getXml()); 1148 d->assign(ser.getXml());
1151 if (!d->size()) 1149 if (!d->size())
1152 return false; 1150 return false;
1153 return true; 1151 return true;
1154} 1152}
1155 1153
1156bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) 1154bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked)
1157{ 1155{
1158 PWM_ASSERT(d); 1156 PWM_ASSERT(d);
1159#ifndef PWM_EMBEDDED 1157#ifndef PWM_EMBEDDED
1160 try { 1158 try {
1161 1159
1162 Serializer ser(d->c_str()); 1160 Serializer ser(d->c_str());
1163 ser.setDefaultLockStat(entriesLocked); 1161 ser.setDefaultLockStat(entriesLocked);
1164 if (!ser.deSerialize(&dta)) 1162 if (!ser.deSerialize(&dta))
1165 return false; 1163 return false;
1166 } catch (PwMException) { 1164 } catch (PwMException) {
1167 return false; 1165 return false;
1168 } 1166 }
1169#else 1167#else
1170 Serializer ser(d->c_str()); 1168 Serializer ser(d->c_str());
1171 ser.setDefaultLockStat(entriesLocked); 1169 ser.setDefaultLockStat(entriesLocked);
1172 if (!ser.deSerialize(&dta)) 1170 if (!ser.deSerialize(&dta))
1173 return false; 1171 return false;
1174 else
1175 return false;
1176#endif 1172#endif
1177 1173
1178 emitDataChanged(this); 1174 emitDataChanged(this);
1179 return true; 1175 return true;
1180} 1176}
1181 1177
1182bool PwMDoc::getEntry(const QString &category, unsigned int index, 1178bool PwMDoc::getEntry(const QString &category, unsigned int index,
1183 PwMDataItem * d, bool unlockIfLocked) 1179 PwMDataItem * d, bool unlockIfLocked)
1184{ 1180{
1185 PWM_ASSERT(d); 1181 PWM_ASSERT(d);
1186 unsigned int cat = 0; 1182 unsigned int cat = 0;
1187 1183
1188 if (!findCategory(category, &cat)) { 1184 if (!findCategory(category, &cat)) {
1189 BUG(); 1185 BUG();
1190 return false; 1186 return false;
1191 } 1187 }
1192 1188
1193 return getEntry(cat, index, d, unlockIfLocked); 1189 return getEntry(cat, index, d, unlockIfLocked);
1194} 1190}
1195 1191
1196bool PwMDoc::getEntry(unsigned int category, unsigned int index, 1192bool PwMDoc::getEntry(unsigned int category, unsigned int index,
1197 PwMDataItem *d, bool unlockIfLocked) 1193 PwMDataItem *d, bool unlockIfLocked)
1198{ 1194{
1199 if (index > dta[category].d.size() - 1) 1195 if (index > dta[category].d.size() - 1)
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp
index d3847f6..7fd347f 100644
--- a/pwmanager/pwmanager/pwmprefs.cpp
+++ b/pwmanager/pwmanager/pwmprefs.cpp
@@ -40,49 +40,50 @@ PWMPrefs::PWMPrefs()
40 40
41 addItemString( "autoStart", &mAutoStart, "" ); 41 addItemString( "autoStart", &mAutoStart, "" );
42 addItemString( "browserCommand", &mBrowserCommand, "" ); 42 addItemString( "browserCommand", &mBrowserCommand, "" );
43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND); 43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND);
44 addItemFont( "entryFont", &mEntryFont); 44 addItemFont( "entryFont", &mEntryFont);
45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT ); 45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT );
46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT ); 46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT );
47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION ); 47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION );
48 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS ); 48 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS );
49 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK ); 49 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK );
50 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN ); 50 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN );
51 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY ); 51 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY );
52 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP ); 52 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP );
53 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL ); 53 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL );
54 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK ); 54 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK );
55 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU ); 55 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU );
56 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT ); 56 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT );
57 57
58 KPrefs::setCurrentGroup( "Wnd" ); 58 KPrefs::setCurrentGroup( "Wnd" );
59 59
60 addItemSize( "MainWndSize", &mMainWndSize); 60 addItemSize( "MainWndSize", &mMainWndSize);
61 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); 61 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE );
62 addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); 62 addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE );
63 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); 63 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE );
64 addItemIntList( "CommentSplitter", &mCommentSplitter ); 64 addItemIntList( "commentSplitter", &mCommentSplitter );
65 addItemIntList( "categorySplitter", &mCategorySplitter );
65} 66}
66 67
67PWMPrefs::~PWMPrefs() 68PWMPrefs::~PWMPrefs()
68{ 69{
69} 70}
70 71
71PWMPrefs *PWMPrefs::instance() 72PWMPrefs *PWMPrefs::instance()
72{ 73{
73 if ( !sInstance ) { 74 if ( !sInstance ) {
74#ifdef PWM_EMBEDDED 75#ifdef PWM_EMBEDDED
75 sInstance = staticDeleter.setObject( new PWMPrefs() ); 76 sInstance = staticDeleter.setObject( new PWMPrefs() );
76#else //PWM_EMBEDDED 77#else //PWM_EMBEDDED
77 //US the following line has changed ???. Why 78 //US the following line has changed ???. Why
78 staticDeleter.setObject( sInstance, new PWMPrefs() ); 79 staticDeleter.setObject( sInstance, new PWMPrefs() );
79#endif //KAB_EMBEDDED 80#endif //KAB_EMBEDDED
80 sInstance->readConfig(); 81 sInstance->readConfig();
81 } 82 }
82 83
83 return sInstance; 84 return sInstance;
84} 85}
85 86
86 // US introduce a nonconst way to return the config object. 87 // US introduce a nonconst way to return the config object.
87KConfig* PWMPrefs::getConfig() 88KConfig* PWMPrefs::getConfig()
88{ 89{
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h
index 6a89d10..9fed7d2 100644
--- a/pwmanager/pwmanager/pwmprefs.h
+++ b/pwmanager/pwmanager/pwmprefs.h
@@ -115,36 +115,37 @@ public:
115 115
116 QString mAutoStart; 116 QString mAutoStart;
117 QString mBrowserCommand; 117 QString mBrowserCommand;
118 QString mXTermCommand; 118 QString mXTermCommand;
119 QFont mEntryFont; 119 QFont mEntryFont;
120 int mPwTimeout; 120 int mPwTimeout;
121 int mLockTimeout; 121 int mLockTimeout;
122 int mCompression; 122 int mCompression;
123 int mFilePermissions; 123 int mFilePermissions;
124 int mMinimizeLock; 124 int mMinimizeLock;
125 bool mUnlockOnOpen; 125 bool mUnlockOnOpen;
126 bool mTray; 126 bool mTray;
127 bool mMakeFileBackup; 127 bool mMakeFileBackup;
128 bool mAutostartDeeplocked; 128 bool mAutostartDeeplocked;
129 bool mAutoDeeplock; 129 bool mAutoDeeplock;
130 bool mKWalletEmu; 130 bool mKWalletEmu;
131 bool mNewEntrLockStat; 131 bool mNewEntrLockStat;
132 QSize mMainWndSize; 132 QSize mMainWndSize;
133 int mMainViewStyle; 133 int mMainViewStyle;
134 bool mAutoMinimizeOnStart; 134 bool mAutoMinimizeOnStart;
135 bool mClose; 135 bool mClose;
136 136
137 //US ENH 137 //US ENH
138 QValueList<int> mCommentSplitter; 138 QValueList<int> mCommentSplitter;
139 QValueList<int> mCategorySplitter;
139 140
140 141
141 // US introduce a nonconst way to return the config object. 142 // US introduce a nonconst way to return the config object.
142 KConfig* getConfig(); 143 KConfig* getConfig();
143 144
144 private: 145 private:
145 PWMPrefs(); 146 PWMPrefs();
146 147
147 static PWMPrefs *sInstance; 148 static PWMPrefs *sInstance;
148}; 149};
149 150
150#endif 151#endif
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp
index 9704615..0af1473 100644
--- a/pwmanager/pwmanager/pwmviewstyle.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle.cpp
@@ -34,95 +34,95 @@
34PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) 34PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name)
35 : QWidget(parent, name) 35 : QWidget(parent, name)
36{ 36{
37 curStyle = style_notset; 37 curStyle = style_notset;
38 s0 = 0; 38 s0 = 0;
39 s1 = 0; 39 s1 = 0;
40} 40}
41 41
42PwMViewStyle::~PwMViewStyle() 42PwMViewStyle::~PwMViewStyle()
43{ 43{
44 //US ENH : store the size of the listviewcolumns 44 //US ENH : store the size of the listviewcolumns
45 switch (curStyle) 45 switch (curStyle)
46 { 46 {
47 case style_0: 47 case style_0:
48 s0->saveSettings(PWMPrefs::instance()); 48 s0->saveSettings(PWMPrefs::instance());
49 break; 49 break;
50 case style_1: 50 case style_1:
51 s1->saveSettings(PWMPrefs::instance()); 51 s1->saveSettings(PWMPrefs::instance());
52 break; 52 break;
53 default: 53 default:
54 BUG(); 54 BUG();
55 } 55 }
56 56
57 57
58 PWMPrefs::instance()->getConfig()->sync(); 58 PWMPrefs::instance()->writeConfig();
59 59
60 delete_ifnot_null(s0); 60 delete_ifnot_null(s0);
61 delete_ifnot_null(s1); 61 delete_ifnot_null(s1);
62} 62}
63 63
64void PwMViewStyle::initStyle(style_t style) 64void PwMViewStyle::initStyle(style_t style)
65{ 65{
66 printDebug(string("initializing style ") + tostr(style)); 66 printDebug(string("initializing style ") + tostr(style));
67 bool wasMaximized = v->isMaximized(); 67 bool wasMaximized = v->isMaximized();
68 if (v->isVisible()) 68 if (v->isVisible())
69 v->hide(); 69 v->hide();
70 switch (style) { 70 switch (style) {
71 case style_0: 71 case style_0:
72 delete_ifnot_null(s0); 72 delete_ifnot_null(s0);
73 delete_ifnot_null(s1); 73 delete_ifnot_null(s1);
74 s0 = new PwMViewStyle_0(v); 74 s0 = new PwMViewStyle_0(v);
75 lv = s0->getLv(); 75 lv = s0->getLv();
76 commentBox = s0->getCommentBox(); 76 commentBox = s0->getCommentBox();
77 break; 77 break;
78 case style_1: 78 case style_1:
79 delete_ifnot_null(s0); 79 delete_ifnot_null(s0);
80 delete_ifnot_null(s1); 80 delete_ifnot_null(s1);
81 s1 = new PwMViewStyle_1(v); 81 s1 = new PwMViewStyle_1(v);
82 lv = s1->getLv(); 82 lv = s1->getLv();
83 commentBox = s1->getCommentBox(); 83 commentBox = s1->getCommentBox();
84 break; 84 break;
85 default: 85 default:
86 BUG(); 86 BUG();
87 return; 87 return;
88 } 88 }
89 curStyle = style; 89 curStyle = style;
90 connect(lv, SIGNAL(pressed(QListViewItem *)), 90 connect(lv, SIGNAL(pressed(QListViewItem *)),
91 v, SLOT(handleToggle(QListViewItem *))); 91 v, SLOT(handleToggle(QListViewItem *)));
92 connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), 92 connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)),
93 v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); 93 v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int)));
94 connect(lv, SIGNAL(clicked(QListViewItem *)), 94 connect(lv, SIGNAL(clicked(QListViewItem *)),
95 v, SLOT(refreshCommentTextEdit(QListViewItem *))); 95 v, SLOT(refreshCommentTextEdit(QListViewItem *)));
96 lv->addColumn(i18n("Description"), 180); 96 lv->addColumn(i18n("Description"), 180);
97 lv->addColumn(i18n("Username"), 150); 97 lv->addColumn(i18n("Username"), 150);
98 lv->addColumn(i18n("Password"), 150); 98 lv->addColumn(i18n("Password"), 150);
99 lv->addColumn(i18n("URL"), 180); 99 lv->addColumn(i18n("URL"), 180);
100 lv->addColumn(i18n("Launcher"), 120); 100 lv->addColumn(i18n("Launcher"), 120);
101 v->tmpReEnableSort(); 101 v->tmpReEnableSort();
102 102
103 //US ENH : load the size of the listviewcolumns 103 //US ENH : load the size of the listviewcolumns
104 switch (style) 104 switch (curStyle)
105 { 105 {
106 case style_0: 106 case style_0:
107 s0->restoreSettings(PWMPrefs::instance()); 107 s0->restoreSettings(PWMPrefs::instance());
108 break; 108 break;
109 case style_1: 109 case style_1:
110 s1->restoreSettings(PWMPrefs::instance()); 110 s1->restoreSettings(PWMPrefs::instance());
111 break; 111 break;
112 default: 112 default:
113 BUG(); 113 BUG();
114 } 114 }
115 115
116 resizeView(v->size()); 116 resizeView(v->size());
117 v->updateView(); 117 v->updateView();
118 if (wasMaximized) { 118 if (wasMaximized) {
119 v->showMaximized(); 119 v->showMaximized();
120 } else { 120 } else {
121 v->show(); 121 v->show();
122 } 122 }
123 connect(lv, SIGNAL(layoutChanged()), 123 connect(lv, SIGNAL(layoutChanged()),
124 v, SLOT(reorgLp())); 124 v, SLOT(reorgLp()));
125} 125}
126 126
127void PwMViewStyle::resizeView(const QSize &size) 127void PwMViewStyle::resizeView(const QSize &size)
128{ 128{
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp
index 8b2d6d3..374c698 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp
@@ -33,58 +33,58 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
33#ifndef PWM_EMBEDDED 33#ifndef PWM_EMBEDDED
34 splitter = new QSplitter(view); 34 splitter = new QSplitter(view);
35#else 35#else
36 splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); 36 splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view);
37 splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 37 splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
38 38
39 //US topLayout->addWidget(mMiniSplitter ); 39 //US topLayout->addWidget(mMiniSplitter );
40#endif 40#endif
41 41
42 vbox1 = new QVBox(splitter); 42 vbox1 = new QVBox(splitter);
43 categoriesTitle = new QLabel(vbox1); 43 categoriesTitle = new QLabel(vbox1);
44 categoriesList = new QListBox(vbox1); 44 categoriesList = new QListBox(vbox1);
45#ifndef PWM_EMBEDDED 45#ifndef PWM_EMBEDDED
46 splitter2 = new QSplitter(splitter); 46 splitter2 = new QSplitter(splitter);
47 splitter2->setOrientation(Qt::Vertical); 47 splitter2->setOrientation(Qt::Vertical);
48#else 48#else
49 splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); 49 splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter);
50 splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 50 splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
51 51
52 //US topLayout->addWidget(mMiniSplitter ); 52 //US topLayout->addWidget(mMiniSplitter );
53#endif 53#endif
54 lv = new ListViewPwM(splitter2); 54 lv = new ListViewPwM(splitter2);
55 commentBox = new CommentBox(splitter2); 55 commentBox = new CommentBox(splitter2);
56 // set sizes and styles 56 // set sizes and styles
57 commentBox->resize(commentBox->size().width(), 60); 57 //UScommentBox->resize(commentBox->size().width(), 60);
58 QValueList<int> sizes; 58 QValueList<int> sizes;
59#ifndef PWM_EMBEDDED 59#ifndef PWM_EMBEDDED
60 sizes.push_back(INITIAL_CATEGORIES_WIDTH); 60 sizes.push_back(INITIAL_CATEGORIES_WIDTH);
61 sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); 61 sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH);
62#else 62#else
63 sizes.append(INITIAL_CATEGORIES_WIDTH); 63 sizes.append(INITIAL_CATEGORIES_WIDTH);
64 sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); 64 sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH);
65#endif 65#endif
66 splitter->setSizes(sizes); 66 //USsplitter->setSizes(sizes);
67 categoriesTitle->setAlignment(Qt::AlignHCenter); 67 categoriesTitle->setAlignment(Qt::AlignHCenter);
68#ifndef PWM_EMBEDDED 68#ifndef PWM_EMBEDDED
69 categoriesTitle->setFrameShape(QFrame::MenuBarPanel); 69 categoriesTitle->setFrameShape(QFrame::MenuBarPanel);
70#else 70#else
71 categoriesTitle->setFrameShape(QFrame::StyledPanel); 71 categoriesTitle->setFrameShape(QFrame::StyledPanel);
72#endif 72#endif
73 categoriesTitle->setText(i18n("Categories:")); 73 categoriesTitle->setText(i18n("Categories:"));
74 catCtxMenu = new QPopupMenu(view); 74 catCtxMenu = new QPopupMenu(view);
75 catCtxMenu->insertItem(i18n("&Rename"), 75 catCtxMenu->insertItem(i18n("&Rename"),
76 view, SLOT(renCatButton_slot())); 76 view, SLOT(renCatButton_slot()));
77 catCtxMenu->insertItem(i18n("&Delete"), 77 catCtxMenu->insertItem(i18n("&Delete"),
78 view, SLOT(delCatButton_slot())); 78 view, SLOT(delCatButton_slot()));
79 // connections 79 // connections
80 connect(categoriesList, SIGNAL(highlighted(int)), 80 connect(categoriesList, SIGNAL(highlighted(int)),
81 view, SLOT(shiftToView())); 81 view, SLOT(shiftToView()));
82 connect(categoriesList, 82 connect(categoriesList,
83 SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), 83 SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)),
84 this, 84 this,
85 SLOT(catRightClick(QListBoxItem *, const QPoint &))); 85 SLOT(catRightClick(QListBoxItem *, const QPoint &)));
86} 86}
87 87
88PwMViewStyle_1::~PwMViewStyle_1() 88PwMViewStyle_1::~PwMViewStyle_1()
89{ 89{
90 delete catCtxMenu; 90 delete catCtxMenu;
@@ -110,41 +110,43 @@ void PwMViewStyle_1::delCategory(const QString &cat)
110 } 110 }
111 } 111 }
112 BUG(); 112 BUG();
113} 113}
114 114
115void PwMViewStyle_1::selectCategory(const QString &cat) 115void PwMViewStyle_1::selectCategory(const QString &cat)
116{ 116{
117 PWM_ASSERT(categoriesList); 117 PWM_ASSERT(categoriesList);
118 int i, count = categoriesList->count(); 118 int i, count = categoriesList->count();
119 for (i = 0; i < count; ++i) { 119 for (i = 0; i < count; ++i) {
120 if (categoriesList->text(i) == cat) { 120 if (categoriesList->text(i) == cat) {
121 categoriesList->setCurrentItem(i); 121 categoriesList->setCurrentItem(i);
122 return; 122 return;
123 } 123 }
124 } 124 }
125 // fall back to 0 125 // fall back to 0
126 categoriesList->setCurrentItem(0); 126 categoriesList->setCurrentItem(0);
127} 127}
128 128
129//US ENH: I need a place to load the view dependend settings. Eg. splittersize 129//US ENH: I need a place to load the view dependend settings. Eg. splittersize
130void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) 130void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
131{ 131{
132 //load and store the size of the listviewcolumns 132 //load and store the size of the listviewcolumns
133 lv->restoreLayout(prefs->getConfig(), "listview"); 133 lv->restoreLayout(prefs->getConfig(), "listview");
134 splitter->setSizes( prefs->mCategorySplitter );
134 splitter2->setSizes( prefs->mCommentSplitter ); 135 splitter2->setSizes( prefs->mCommentSplitter );
135 136
136} 137}
137 138
138//US ENH: I need a place to load the view dependend settings. Eg. splittersize 139//US ENH: I need a place to load the view dependend settings. Eg. splittersize
139void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) 140void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
140{ 141{
141 //store the size of the listviewcolumns 142 //store the size of the listviewcolumns
142 lv->saveLayout(prefs->getConfig(), "listview"); 143 lv->saveLayout(prefs->getConfig(), "listview");
144 prefs->mCategorySplitter = splitter->sizes();
143 prefs->mCommentSplitter = splitter2->sizes(); 145 prefs->mCommentSplitter = splitter2->sizes();
144 146
145} 147}
146 148
147 149
148#ifndef PWM_EMBEDDED 150#ifndef PWM_EMBEDDED
149#include "pwmviewstyle_1.moc" 151#include "pwmviewstyle_1.moc"
150#endif 152#endif