author | ulf69 <ulf69> | 2004-09-21 19:44:23 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-21 19:44:23 (UTC) |
commit | a6a6544fc57542752fecc3763e0d35e6a38040ac (patch) (unidiff) | |
tree | 3324285a4aaee1db873e0c83d0c8e911cbe1aefb | |
parent | 6a40d65ddd6657e34c69d839da458810a8d8ff98 (diff) | |
download | kdepimpi-a6a6544fc57542752fecc3763e0d35e6a38040ac.zip kdepimpi-a6a6544fc57542752fecc3763e0d35e6a38040ac.tar.gz kdepimpi-a6a6544fc57542752fecc3763e0d35e6a38040ac.tar.bz2 |
*** empty log message ***
-rw-r--r-- | pwmanager/pwmanager/configwnd.cpp | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 35 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmanagerE.pro | 27 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.h | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 19 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmtray.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/serializer.cpp | 1 |
10 files changed, 83 insertions, 23 deletions
diff --git a/pwmanager/pwmanager/configwnd.cpp b/pwmanager/pwmanager/configwnd.cpp index 230ca1b..108c40f 100644 --- a/pwmanager/pwmanager/configwnd.cpp +++ b/pwmanager/pwmanager/configwnd.cpp | |||
@@ -1,234 +1,235 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form implementation generated from reading ui file 'configwnd.ui' | 2 | ** Form implementation generated from reading ui file 'configwnd.ui' |
3 | ** | 3 | ** |
4 | ** Created: Tue Sep 14 15:20:58 2004 | 4 | ** Created: Tue Sep 14 15:20:58 2004 |
5 | ** by: The User Interface Compiler ($Id$) | 5 | ** by: The User Interface Compiler ($Id$) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | 9 | ||
10 | #include "configwnd.h" | 10 | #include "configwnd.h" |
11 | 11 | ||
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
14 | #include <qtabwidget.h> | 14 | #include <qtabwidget.h> |
15 | #include <qwidget.h> | 15 | #include <qwidget.h> |
16 | #include <qcombobox.h> | 16 | #include <qcombobox.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qlineedit.h> | 18 | #include <qlineedit.h> |
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qspinbox.h> | 20 | #include <qspinbox.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qtooltip.h> | 22 | #include <qtooltip.h> |
23 | #include <qwhatsthis.h> | 23 | #include <qwhatsthis.h> |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Constructs a configWnd as a child of 'parent', with the | 26 | * Constructs a configWnd as a child of 'parent', with the |
27 | * name 'name' and widget flags set to 'f'. | 27 | * name 'name' and widget flags set to 'f'. |
28 | * | 28 | * |
29 | * The dialog will by default be modeless, unless you set 'modal' to | 29 | * The dialog will by default be modeless, unless you set 'modal' to |
30 | * TRUE to construct a modal dialog. | 30 | * TRUE to construct a modal dialog. |
31 | */ | 31 | */ |
32 | configWnd::configWnd( QWidget* parent, const char* name, bool modal, WFlags fl ) | 32 | configWnd::configWnd( QWidget* parent, const char* name, bool modal, WFlags fl ) |
33 | : QDialog( parent, name, modal, fl ) | 33 | : QDialog( parent, name, modal, fl ) |
34 | { | 34 | { |
35 | if ( !name ) | 35 | if ( !name ) |
36 | setName( "configWnd" ); | 36 | setName( "configWnd" ); |
37 | 37 | ||
38 | okButton = new QPushButton( this, "okButton" ); | 38 | okButton = new QPushButton( this, "okButton" ); |
39 | okButton->setGeometry( QRect( 10, 280, 107, 27 ) ); | 39 | okButton->setGeometry( QRect( 10, 280, 107, 27 ) ); |
40 | 40 | ||
41 | cancelButton = new QPushButton( this, "cancelButton" ); | 41 | cancelButton = new QPushButton( this, "cancelButton" ); |
42 | cancelButton->setGeometry( QRect( 370, 280, 107, 27 ) ); | 42 | cancelButton->setGeometry( QRect( 370, 280, 107, 27 ) ); |
43 | 43 | ||
44 | tabWidget2 = new QTabWidget( this, "tabWidget2" ); | 44 | tabWidget2 = new QTabWidget( this, "tabWidget2" ); |
45 | tabWidget2->setGeometry( QRect( 10, 10, 470, 260 ) ); | 45 | tabWidget2->setGeometry( QRect( 10, 10, 470, 260 ) ); |
46 | 46 | ||
47 | ////////////////////////////// | ||
47 | tab = new QWidget( tabWidget2, "tab" ); | 48 | tab = new QWidget( tabWidget2, "tab" ); |
48 | 49 | ||
49 | windowStyleComboBox = new QComboBox( FALSE, tab, "windowStyleComboBox" ); | 50 | windowStyleComboBox = new QComboBox( FALSE, tab, "windowStyleComboBox" ); |
50 | windowStyleComboBox->setGeometry( QRect( 220, 180, 210, 28 ) ); | 51 | windowStyleComboBox->setGeometry( QRect( 220, 180, 210, 28 ) ); |
51 | 52 | ||
52 | textLabel1_5 = new QLabel( tab, "textLabel1_5" ); | 53 | textLabel1_5 = new QLabel( tab, "textLabel1_5" ); |
53 | textLabel1_5->setGeometry( QRect( 30, 180, 180, 20 ) ); | 54 | textLabel1_5->setGeometry( QRect( 30, 180, 180, 20 ) ); |
54 | textLabel1_5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 55 | textLabel1_5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
55 | 56 | ||
56 | textLabel1_4 = new QLabel( tab, "textLabel1_4" ); | 57 | textLabel1_4 = new QLabel( tab, "textLabel1_4" ); |
57 | textLabel1_4->setGeometry( QRect( 30, 40, 400, 20 ) ); | 58 | textLabel1_4->setGeometry( QRect( 30, 40, 400, 20 ) ); |
58 | 59 | ||
59 | selEntrFontButton = new QPushButton( tab, "selEntrFontButton" ); | 60 | selEntrFontButton = new QPushButton( tab, "selEntrFontButton" ); |
60 | selEntrFontButton->setGeometry( QRect( 30, 90, 160, 27 ) ); | 61 | selEntrFontButton->setGeometry( QRect( 30, 90, 160, 27 ) ); |
61 | 62 | ||
62 | currEntrFont = new QLabel( tab, "currEntrFont" ); | 63 | currEntrFont = new QLabel( tab, "currEntrFont" ); |
63 | currEntrFont->setGeometry( QRect( 30, 70, 230, 20 ) ); | 64 | currEntrFont->setGeometry( QRect( 30, 70, 230, 20 ) ); |
64 | tabWidget2->insertTab( tab, QString("") ); | 65 | tabWidget2->insertTab( tab, QString("") ); |
65 | 66 | ////////////////////////////////////// | |
66 | TabPage = new QWidget( tabWidget2, "TabPage" ); | 67 | TabPage = new QWidget( tabWidget2, "TabPage" ); |
67 | 68 | ||
68 | compressionComboBox = new QComboBox( FALSE, TabPage, "compressionComboBox" ); | 69 | compressionComboBox = new QComboBox( FALSE, TabPage, "compressionComboBox" ); |
69 | compressionComboBox->setGeometry( QRect( 290, 50, 150, 28 ) ); | 70 | compressionComboBox->setGeometry( QRect( 290, 50, 150, 28 ) ); |
70 | 71 | ||
71 | textLabel1_6 = new QLabel( TabPage, "textLabel1_6" ); | 72 | textLabel1_6 = new QLabel( TabPage, "textLabel1_6" ); |
72 | textLabel1_6->setGeometry( QRect( 10, 50, 270, 20 ) ); | 73 | textLabel1_6->setGeometry( QRect( 10, 50, 270, 20 ) ); |
73 | textLabel1_6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 74 | textLabel1_6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
74 | 75 | ||
75 | textLabel1_8 = new QLabel( TabPage, "textLabel1_8" ); | 76 | textLabel1_8 = new QLabel( TabPage, "textLabel1_8" ); |
76 | textLabel1_8->setGeometry( QRect( 10, 90, 270, 20 ) ); | 77 | textLabel1_8->setGeometry( QRect( 10, 90, 270, 20 ) ); |
77 | textLabel1_8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 78 | textLabel1_8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
78 | 79 | ||
79 | permissionLineEdit = new QLineEdit( TabPage, "permissionLineEdit" ); | 80 | permissionLineEdit = new QLineEdit( TabPage, "permissionLineEdit" ); |
80 | permissionLineEdit->setGeometry( QRect( 290, 90, 142, 27 ) ); | 81 | permissionLineEdit->setGeometry( QRect( 290, 90, 142, 27 ) ); |
81 | permissionLineEdit->setMaxLength( 3 ); | 82 | permissionLineEdit->setMaxLength( 3 ); |
82 | 83 | ||
83 | fileBackupCheckBox = new QCheckBox( TabPage, "fileBackupCheckBox" ); | 84 | fileBackupCheckBox = new QCheckBox( TabPage, "fileBackupCheckBox" ); |
84 | fileBackupCheckBox->setGeometry( QRect( 80, 140, 360, 23 ) ); | 85 | fileBackupCheckBox->setGeometry( QRect( 80, 140, 360, 23 ) ); |
85 | tabWidget2->insertTab( TabPage, QString("") ); | 86 | tabWidget2->insertTab( TabPage, QString("") ); |
86 | 87 | ////////////////////////////////////// | |
87 | tab_2 = new QWidget( tabWidget2, "tab_2" ); | 88 | tab_2 = new QWidget( tabWidget2, "tab_2" ); |
88 | 89 | ||
89 | pwTimeoutSpinBox = new QSpinBox( tab_2, "pwTimeoutSpinBox" ); | 90 | pwTimeoutSpinBox = new QSpinBox( tab_2, "pwTimeoutSpinBox" ); |
90 | pwTimeoutSpinBox->setGeometry( QRect( 390, 50, 55, 23 ) ); | 91 | pwTimeoutSpinBox->setGeometry( QRect( 390, 50, 55, 23 ) ); |
91 | 92 | ||
92 | textLabel1 = new QLabel( tab_2, "textLabel1" ); | 93 | textLabel1 = new QLabel( tab_2, "textLabel1" ); |
93 | textLabel1->setGeometry( QRect( 10, 20, 370, 80 ) ); | 94 | textLabel1->setGeometry( QRect( 10, 20, 370, 80 ) ); |
94 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); | 95 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); |
95 | 96 | ||
96 | textLabel1_7 = new QLabel( tab_2, "textLabel1_7" ); | 97 | textLabel1_7 = new QLabel( tab_2, "textLabel1_7" ); |
97 | textLabel1_7->setGeometry( QRect( 10, 110, 370, 80 ) ); | 98 | textLabel1_7->setGeometry( QRect( 10, 110, 370, 80 ) ); |
98 | textLabel1_7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); | 99 | textLabel1_7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); |
99 | 100 | ||
100 | lockTimeoutSpinBox = new QSpinBox( tab_2, "lockTimeoutSpinBox" ); | 101 | lockTimeoutSpinBox = new QSpinBox( tab_2, "lockTimeoutSpinBox" ); |
101 | lockTimeoutSpinBox->setGeometry( QRect( 390, 140, 55, 23 ) ); | 102 | lockTimeoutSpinBox->setGeometry( QRect( 390, 140, 55, 23 ) ); |
102 | 103 | ||
103 | autoDeepLockCheckBox = new QCheckBox( tab_2, "autoDeepLockCheckBox" ); | 104 | autoDeepLockCheckBox = new QCheckBox( tab_2, "autoDeepLockCheckBox" ); |
104 | autoDeepLockCheckBox->setGeometry( QRect( 60, 180, 380, 25 ) ); | 105 | autoDeepLockCheckBox->setGeometry( QRect( 60, 180, 380, 25 ) ); |
105 | tabWidget2->insertTab( tab_2, QString("") ); | 106 | tabWidget2->insertTab( tab_2, QString("") ); |
106 | 107 | /////////////////////////////////////////// | |
107 | tab_3 = new QWidget( tabWidget2, "tab_3" ); | 108 | tab_3 = new QWidget( tabWidget2, "tab_3" ); |
108 | 109 | ||
109 | textLabel1_3 = new QLabel( tab_3, "textLabel1_3" ); | 110 | textLabel1_3 = new QLabel( tab_3, "textLabel1_3" ); |
110 | textLabel1_3->setGeometry( QRect( 30, 30, 400, 20 ) ); | 111 | textLabel1_3->setGeometry( QRect( 30, 30, 400, 20 ) ); |
111 | 112 | ||
112 | autoStartLineEdit = new QLineEdit( tab_3, "autoStartLineEdit" ); | 113 | autoStartLineEdit = new QLineEdit( tab_3, "autoStartLineEdit" ); |
113 | autoStartLineEdit->setGeometry( QRect( 30, 50, 360, 20 ) ); | 114 | autoStartLineEdit->setGeometry( QRect( 30, 50, 360, 20 ) ); |
114 | 115 | ||
115 | browseAutoStButton = new QPushButton( tab_3, "browseAutoStButton" ); | 116 | browseAutoStButton = new QPushButton( tab_3, "browseAutoStButton" ); |
116 | browseAutoStButton->setGeometry( QRect( 400, 50, 30, 20 ) ); | 117 | browseAutoStButton->setGeometry( QRect( 400, 50, 30, 20 ) ); |
117 | 118 | ||
118 | autostartDeeplockedCheckBox = new QCheckBox( tab_3, "autostartDeeplockedCheckBox" ); | 119 | autostartDeeplockedCheckBox = new QCheckBox( tab_3, "autostartDeeplockedCheckBox" ); |
119 | autostartDeeplockedCheckBox->setGeometry( QRect( 40, 80, 390, 25 ) ); | 120 | autostartDeeplockedCheckBox->setGeometry( QRect( 40, 80, 390, 25 ) ); |
120 | tabWidget2->insertTab( tab_3, QString("") ); | 121 | tabWidget2->insertTab( tab_3, QString("") ); |
121 | 122 | //////////////////////////////////////////// | |
122 | tab_4 = new QWidget( tabWidget2, "tab_4" ); | 123 | tab_4 = new QWidget( tabWidget2, "tab_4" ); |
123 | 124 | ||
124 | textLabel2 = new QLabel( tab_4, "textLabel2" ); | 125 | textLabel2 = new QLabel( tab_4, "textLabel2" ); |
125 | textLabel2->setGeometry( QRect( 20, 40, 280, 20 ) ); | 126 | textLabel2->setGeometry( QRect( 20, 40, 280, 20 ) ); |
126 | textLabel2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 127 | textLabel2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
127 | 128 | ||
128 | browserLineEdit = new QLineEdit( tab_4, "browserLineEdit" ); | 129 | browserLineEdit = new QLineEdit( tab_4, "browserLineEdit" ); |
129 | browserLineEdit->setGeometry( QRect( 310, 40, 130, 27 ) ); | 130 | browserLineEdit->setGeometry( QRect( 310, 40, 130, 27 ) ); |
130 | 131 | ||
131 | xtermLineEdit = new QLineEdit( tab_4, "xtermLineEdit" ); | 132 | xtermLineEdit = new QLineEdit( tab_4, "xtermLineEdit" ); |
132 | xtermLineEdit->setGeometry( QRect( 310, 100, 130, 27 ) ); | 133 | xtermLineEdit->setGeometry( QRect( 310, 100, 130, 27 ) ); |
133 | 134 | ||
134 | textLabel3 = new QLabel( tab_4, "textLabel3" ); | 135 | textLabel3 = new QLabel( tab_4, "textLabel3" ); |
135 | textLabel3->setGeometry( QRect( 20, 100, 280, 20 ) ); | 136 | textLabel3->setGeometry( QRect( 20, 100, 280, 20 ) ); |
136 | textLabel3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 137 | textLabel3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
137 | tabWidget2->insertTab( tab_4, QString("") ); | 138 | tabWidget2->insertTab( tab_4, QString("") ); |
138 | 139 | /////////////////////////////////////////////// | |
139 | tab_5 = new QWidget( tabWidget2, "tab_5" ); | 140 | tab_5 = new QWidget( tabWidget2, "tab_5" ); |
140 | 141 | ||
141 | trayCheckBox = new QCheckBox( tab_5, "trayCheckBox" ); | 142 | trayCheckBox = new QCheckBox( tab_5, "trayCheckBox" ); |
142 | trayCheckBox->setGeometry( QRect( 30, 30, 400, 20 ) ); | 143 | trayCheckBox->setGeometry( QRect( 30, 30, 400, 20 ) ); |
143 | 144 | ||
144 | openUnlockedCheckBox = new QCheckBox( tab_5, "openUnlockedCheckBox" ); | 145 | openUnlockedCheckBox = new QCheckBox( tab_5, "openUnlockedCheckBox" ); |
145 | openUnlockedCheckBox->setGeometry( QRect( 30, 80, 400, 20 ) ); | 146 | openUnlockedCheckBox->setGeometry( QRect( 30, 80, 400, 20 ) ); |
146 | 147 | ||
147 | autoMinimizeCheckBox = new QCheckBox( tab_5, "autoMinimizeCheckBox" ); | 148 | autoMinimizeCheckBox = new QCheckBox( tab_5, "autoMinimizeCheckBox" ); |
148 | autoMinimizeCheckBox->setEnabled( FALSE ); | 149 | autoMinimizeCheckBox->setEnabled( FALSE ); |
149 | autoMinimizeCheckBox->setGeometry( QRect( 50, 50, 380, 25 ) ); | 150 | autoMinimizeCheckBox->setGeometry( QRect( 50, 50, 380, 25 ) ); |
150 | 151 | ||
151 | minimizeLockComboBox = new QComboBox( FALSE, tab_5, "minimizeLockComboBox" ); | 152 | minimizeLockComboBox = new QComboBox( FALSE, tab_5, "minimizeLockComboBox" ); |
152 | minimizeLockComboBox->setGeometry( QRect( 310, 170, 120, 27 ) ); | 153 | minimizeLockComboBox->setGeometry( QRect( 310, 170, 120, 27 ) ); |
153 | 154 | ||
154 | textLabel1_9 = new QLabel( tab_5, "textLabel1_9" ); | 155 | textLabel1_9 = new QLabel( tab_5, "textLabel1_9" ); |
155 | textLabel1_9->setGeometry( QRect( 30, 180, 270, 20 ) ); | 156 | textLabel1_9->setGeometry( QRect( 30, 180, 270, 20 ) ); |
156 | textLabel1_9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 157 | textLabel1_9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
157 | 158 | ||
158 | kwalletEmuCheckBox = new QCheckBox( tab_5, "kwalletEmuCheckBox" ); | 159 | kwalletEmuCheckBox = new QCheckBox( tab_5, "kwalletEmuCheckBox" ); |
159 | kwalletEmuCheckBox->setGeometry( QRect( 30, 110, 400, 25 ) ); | 160 | kwalletEmuCheckBox->setGeometry( QRect( 30, 110, 400, 25 ) ); |
160 | 161 | ||
161 | wndCloseCheckBox = new QCheckBox( tab_5, "wndCloseCheckBox" ); | 162 | wndCloseCheckBox = new QCheckBox( tab_5, "wndCloseCheckBox" ); |
162 | wndCloseCheckBox->setGeometry( QRect( 30, 140, 430, 24 ) ); | 163 | wndCloseCheckBox->setGeometry( QRect( 30, 140, 430, 24 ) ); |
163 | tabWidget2->insertTab( tab_5, QString("") ); | 164 | tabWidget2->insertTab( tab_5, QString("") ); |
164 | languageChange(); | 165 | languageChange(); |
165 | resize( QSize(490, 318).expandedTo(minimumSizeHint()) ); | 166 | resize( QSize(490, 318).expandedTo(minimumSizeHint()) ); |
166 | clearWState( WState_Polished ); | 167 | clearWState( WState_Polished ); |
167 | 168 | ||
168 | // signals and slots connections | 169 | // signals and slots connections |
169 | connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) ); | 170 | connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) ); |
170 | connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) ); | 171 | connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) ); |
171 | connect( browseAutoStButton, SIGNAL( clicked() ), this, SLOT( browseAutoStButton_slot() ) ); | 172 | connect( browseAutoStButton, SIGNAL( clicked() ), this, SLOT( browseAutoStButton_slot() ) ); |
172 | connect( selEntrFontButton, SIGNAL( clicked() ), this, SLOT( selEntrFontButton_slot() ) ); | 173 | connect( selEntrFontButton, SIGNAL( clicked() ), this, SLOT( selEntrFontButton_slot() ) ); |
173 | connect( trayCheckBox, SIGNAL( toggled(bool) ), autoMinimizeCheckBox, SLOT( setEnabled(bool) ) ); | 174 | connect( trayCheckBox, SIGNAL( toggled(bool) ), autoMinimizeCheckBox, SLOT( setEnabled(bool) ) ); |
174 | 175 | ||
175 | // tab order | 176 | // tab order |
176 | setTabOrder( pwTimeoutSpinBox, trayCheckBox ); | 177 | setTabOrder( pwTimeoutSpinBox, trayCheckBox ); |
177 | setTabOrder( trayCheckBox, okButton ); | 178 | setTabOrder( trayCheckBox, okButton ); |
178 | setTabOrder( okButton, cancelButton ); | 179 | setTabOrder( okButton, cancelButton ); |
179 | } | 180 | } |
180 | 181 | ||
181 | /* | 182 | /* |
182 | * Destroys the object and frees any allocated resources | 183 | * Destroys the object and frees any allocated resources |
183 | */ | 184 | */ |
184 | configWnd::~configWnd() | 185 | configWnd::~configWnd() |
185 | { | 186 | { |
186 | // no need to delete child widgets, Qt does it all for us | 187 | // no need to delete child widgets, Qt does it all for us |
187 | } | 188 | } |
188 | 189 | ||
189 | /* | 190 | /* |
190 | * Sets the strings of the subwidgets using the current | 191 | * Sets the strings of the subwidgets using the current |
191 | * language. | 192 | * language. |
192 | */ | 193 | */ |
193 | void configWnd::languageChange() | 194 | void configWnd::languageChange() |
194 | { | 195 | { |
195 | setCaption( tr( "PwManager Configuration" ) ); | 196 | setCaption( tr( "PwManager Configuration" ) ); |
196 | okButton->setText( tr( "&OK" ) ); | 197 | okButton->setText( tr( "&OK" ) ); |
197 | //US ENH okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) ); | 198 | //US ENH okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) ); |
198 | cancelButton->setText( tr( "&Cancel" ) ); | 199 | cancelButton->setText( tr( "&Cancel" ) ); |
199 | //US ENH cancelButton->setAccel( QKeySequence( tr( "Alt+C" ) ) ); | 200 | //US ENH cancelButton->setAccel( QKeySequence( tr( "Alt+C" ) ) ); |
200 | windowStyleComboBox->clear(); | 201 | windowStyleComboBox->clear(); |
201 | windowStyleComboBox->insertItem( tr( "Category on top" ) ); | 202 | windowStyleComboBox->insertItem( tr( "Category on top" ) ); |
202 | windowStyleComboBox->insertItem( tr( "Category-list left" ) ); | 203 | windowStyleComboBox->insertItem( tr( "Category-list left" ) ); |
203 | textLabel1_5->setText( tr( "Window-style:" ) ); | 204 | textLabel1_5->setText( tr( "Window-style:" ) ); |
204 | textLabel1_4->setText( tr( "Font for the password entries:" ) ); | 205 | textLabel1_4->setText( tr( "Font for the password entries:" ) ); |
205 | selEntrFontButton->setText( tr( "select Font" ) ); | 206 | selEntrFontButton->setText( tr( "select Font" ) ); |
206 | currEntrFont->setText( QString::null ); | 207 | currEntrFont->setText( QString::null ); |
207 | tabWidget2->changeTab( tab, tr( "Look && feel" ) ); | 208 | tabWidget2->changeTab( tab, tr( "Look && feel" ) ); |
208 | compressionComboBox->clear(); | 209 | compressionComboBox->clear(); |
209 | compressionComboBox->insertItem( tr( "none" ) ); | 210 | compressionComboBox->insertItem( tr( "none" ) ); |
210 | compressionComboBox->insertItem( tr( "gzip" ) ); | 211 | compressionComboBox->insertItem( tr( "gzip" ) ); |
211 | compressionComboBox->insertItem( tr( "bzip2" ) ); | 212 | compressionComboBox->insertItem( tr( "bzip2" ) ); |
212 | textLabel1_6->setText( tr( "*.pwm file compression:" ) ); | 213 | textLabel1_6->setText( tr( "*.pwm file compression:" ) ); |
213 | textLabel1_8->setText( tr( "permissions:" ) ); | 214 | textLabel1_8->setText( tr( "permissions:" ) ); |
214 | fileBackupCheckBox->setText( tr( "Make file backup before saving" ) ); | 215 | fileBackupCheckBox->setText( tr( "Make file backup before saving" ) ); |
215 | tabWidget2->changeTab( TabPage, tr( "File" ) ); | 216 | tabWidget2->changeTab( TabPage, tr( "File" ) ); |
216 | textLabel1->setText( tr( "Password timeout (timeout to hold password in memory, so you don't have to re-enter it, if you already have entered it) [set to 0 to disable]:" ) ); | 217 | textLabel1->setText( tr( "Password timeout (timeout to hold password in memory, so you don't have to re-enter it, if you already have entered it) [set to 0 to disable]:" ) ); |
217 | textLabel1_7->setText( tr( "Auto-lock timeout (auto lock document after this amount of seconds) [set to 0 to disable]:" ) ); | 218 | textLabel1_7->setText( tr( "Auto-lock timeout (auto lock document after this amount of seconds) [set to 0 to disable]:" ) ); |
218 | autoDeepLockCheckBox->setText( tr( "deep-lock on autolock" ) ); | 219 | autoDeepLockCheckBox->setText( tr( "deep-lock on autolock" ) ); |
219 | tabWidget2->changeTab( tab_2, tr( "Timeout" ) ); | 220 | tabWidget2->changeTab( tab_2, tr( "Timeout" ) ); |
220 | textLabel1_3->setText( tr( "Open this file automatically on startup:" ) ); | 221 | textLabel1_3->setText( tr( "Open this file automatically on startup:" ) ); |
221 | browseAutoStButton->setText( tr( "..." ) ); | 222 | browseAutoStButton->setText( tr( "..." ) ); |
222 | autostartDeeplockedCheckBox->setText( tr( "open deeplocked" ) ); | 223 | autostartDeeplockedCheckBox->setText( tr( "open deeplocked" ) ); |
223 | tabWidget2->changeTab( tab_3, tr( "Autostart" ) ); | 224 | tabWidget2->changeTab( tab_3, tr( "Autostart" ) ); |
224 | textLabel2->setText( tr( "Favourite browser:" ) ); | 225 | textLabel2->setText( tr( "Favourite browser:" ) ); |
225 | textLabel3->setText( tr( "Favourite X-terminal:" ) ); | 226 | textLabel3->setText( tr( "Favourite X-terminal:" ) ); |
226 | tabWidget2->changeTab( tab_4, tr( "External apps" ) ); | 227 | tabWidget2->changeTab( tab_4, tr( "External apps" ) ); |
227 | trayCheckBox->setText( tr( "Show icon in system-tray" ) ); | 228 | trayCheckBox->setText( tr( "Show icon in system-tray" ) ); |
228 | openUnlockedCheckBox->setText( tr( "Open document with passwords unlocked" ) ); | 229 | openUnlockedCheckBox->setText( tr( "Open document with passwords unlocked" ) ); |
229 | autoMinimizeCheckBox->setText( tr( "auto-minimize to tray on startup" ) ); | 230 | autoMinimizeCheckBox->setText( tr( "auto-minimize to tray on startup" ) ); |
230 | minimizeLockComboBox->clear(); | 231 | minimizeLockComboBox->clear(); |
231 | minimizeLockComboBox->insertItem( tr( "don't lock" ) ); | 232 | minimizeLockComboBox->insertItem( tr( "don't lock" ) ); |
232 | minimizeLockComboBox->insertItem( tr( "normal lock" ) ); | 233 | minimizeLockComboBox->insertItem( tr( "normal lock" ) ); |
233 | minimizeLockComboBox->insertItem( tr( "deep-lock" ) ); | 234 | minimizeLockComboBox->insertItem( tr( "deep-lock" ) ); |
234 | textLabel1_9->setText( tr( "auto-lock on minimize:" ) ); | 235 | textLabel1_9->setText( tr( "auto-lock on minimize:" ) ); |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index e5579f8..08fcb25 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -1,149 +1,154 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 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 <klocale.h> | 20 | #include <klocale.h> |
21 | #include <klistview.h> | 21 | #include <klistview.h> |
22 | #include <ktoolbar.h> | 22 | #include <ktoolbar.h> |
23 | #include <kfiledialog.h> | 23 | #include <kfiledialog.h> |
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include <kmessagebox.h> | 25 | #include <kmessagebox.h> |
26 | 26 | ||
27 | #ifndef PWM_EMBEDDED | 27 | #ifndef PWM_EMBEDDED |
28 | #include <kmenubar.h> | 28 | #include <kmenubar.h> |
29 | #include <kstatusbar.h> | 29 | #include <kstatusbar.h> |
30 | #include <dcopclient.h> | 30 | #include <dcopclient.h> |
31 | #include "configwndimpl.h" | ||
32 | #include "configuration.h" | ||
31 | #else | 33 | #else |
32 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #include <pwmprefs.h> | ||
37 | #include <kpimglobalprefs.h> | ||
38 | #include <kcmconfigs/kcmpwmconfig.h> | ||
39 | #include <kcmconfigs/kcmkdepimconfig.h> | ||
40 | #include <kcmultidialog.h> | ||
34 | #endif | 41 | #endif |
35 | 42 | ||
36 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
37 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
38 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
39 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
40 | #include <qfileinfo.h> | 47 | #include <qfileinfo.h> |
41 | #include <qclipboard.h> | 48 | #include <qclipboard.h> |
42 | 49 | ||
43 | 50 | ||
44 | #include <stdio.h> | 51 | #include <stdio.h> |
45 | 52 | ||
46 | #include "pwm.h" | 53 | #include "pwm.h" |
47 | #include "pwminit.h" | 54 | #include "pwminit.h" |
48 | #include "configwndimpl.h" | ||
49 | #include "pwmprint.h" | 55 | #include "pwmprint.h" |
50 | #include "addentrywndimpl.h" | 56 | #include "addentrywndimpl.h" |
51 | #include "globalstuff.h" | 57 | #include "globalstuff.h" |
52 | #include "findwndimpl.h" | 58 | #include "findwndimpl.h" |
53 | #include "configuration.h" | ||
54 | 59 | ||
55 | #ifdef CONFIG_KWALLETIF | 60 | #ifdef CONFIG_KWALLETIF |
56 | # include "kwalletif.h" | 61 | # include "kwalletif.h" |
57 | # include "kwalletemu.h" | 62 | # include "kwalletemu.h" |
58 | #endif | 63 | #endif |
59 | #ifdef CONFIG_KEYCARD | 64 | #ifdef CONFIG_KEYCARD |
60 | # include "pwmkeycard.h" | 65 | # include "pwmkeycard.h" |
61 | #endif | 66 | #endif |
62 | 67 | ||
63 | 68 | ||
64 | #define DEFAULT_SIZE (QSize(700, 400)) | 69 | #define DEFAULT_SIZE (QSize(700, 400)) |
65 | 70 | ||
66 | // Button IDs for "file" popup menu | 71 | // Button IDs for "file" popup menu |
67 | enum { | 72 | enum { |
68 | BUTTON_POPUP_FILE_NEW = 0, | 73 | BUTTON_POPUP_FILE_NEW = 0, |
69 | BUTTON_POPUP_FILE_OPEN, | 74 | BUTTON_POPUP_FILE_OPEN, |
70 | BUTTON_POPUP_FILE_CLOSE, | 75 | BUTTON_POPUP_FILE_CLOSE, |
71 | BUTTON_POPUP_FILE_SAVE, | 76 | BUTTON_POPUP_FILE_SAVE, |
72 | BUTTON_POPUP_FILE_SAVEAS, | 77 | BUTTON_POPUP_FILE_SAVEAS, |
73 | BUTTON_POPUP_FILE_EXPORT, | 78 | BUTTON_POPUP_FILE_EXPORT, |
74 | BUTTON_POPUP_FILE_IMPORT, | 79 | BUTTON_POPUP_FILE_IMPORT, |
75 | BUTTON_POPUP_FILE_PRINT, | 80 | BUTTON_POPUP_FILE_PRINT, |
76 | BUTTON_POPUP_FILE_QUIT | 81 | BUTTON_POPUP_FILE_QUIT |
77 | }; | 82 | }; |
78 | // Button IDs for "manage" popup menu | 83 | // Button IDs for "manage" popup menu |
79 | enum { | 84 | enum { |
80 | BUTTON_POPUP_MANAGE_ADD = 0, | 85 | BUTTON_POPUP_MANAGE_ADD = 0, |
81 | BUTTON_POPUP_MANAGE_EDIT, | 86 | BUTTON_POPUP_MANAGE_EDIT, |
82 | BUTTON_POPUP_MANAGE_DEL, | 87 | BUTTON_POPUP_MANAGE_DEL, |
83 | BUTTON_POPUP_MANAGE_CHANGEMP | 88 | BUTTON_POPUP_MANAGE_CHANGEMP |
84 | }; | 89 | }; |
85 | // Button IDs for chipcard popup menu | 90 | // Button IDs for chipcard popup menu |
86 | enum { | 91 | enum { |
87 | #ifdef CONFIG_KEYCARD | 92 | #ifdef CONFIG_KEYCARD |
88 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, | 93 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, |
89 | BUTTON_POPUP_CHIPCARD_DEL, | 94 | BUTTON_POPUP_CHIPCARD_DEL, |
90 | BUTTON_POPUP_CHIPCARD_READID, | 95 | BUTTON_POPUP_CHIPCARD_READID, |
91 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, | 96 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, |
92 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP | 97 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP |
93 | #else // CONFIG_KEYCARD | 98 | #else // CONFIG_KEYCARD |
94 | BUTTON_POPUP_CHIPCARD_NO = 0 | 99 | BUTTON_POPUP_CHIPCARD_NO = 0 |
95 | #endif // CONFIG_KEYCARD | 100 | #endif // CONFIG_KEYCARD |
96 | }; | 101 | }; |
97 | // Button IDs for "view" popup menu | 102 | // Button IDs for "view" popup menu |
98 | enum { | 103 | enum { |
99 | BUTTON_POPUP_VIEW_FIND = 0, | 104 | BUTTON_POPUP_VIEW_FIND = 0, |
100 | BUTTON_POPUP_VIEW_LOCK, | 105 | BUTTON_POPUP_VIEW_LOCK, |
101 | BUTTON_POPUP_VIEW_DEEPLOCK, | 106 | BUTTON_POPUP_VIEW_DEEPLOCK, |
102 | BUTTON_POPUP_VIEW_UNLOCK | 107 | BUTTON_POPUP_VIEW_UNLOCK |
103 | }; | 108 | }; |
104 | // Button IDs for "options" popup menu | 109 | // Button IDs for "options" popup menu |
105 | enum { | 110 | enum { |
106 | BUTTON_POPUP_OPTIONS_CONFIG = 0 | 111 | BUTTON_POPUP_OPTIONS_CONFIG = 0 |
107 | }; | 112 | }; |
108 | // Button IDs for "export" popup menu (in "file" popup menu) | 113 | // Button IDs for "export" popup menu (in "file" popup menu) |
109 | enum { | 114 | enum { |
110 | BUTTON_POPUP_EXPORT_TEXT = 0, | 115 | BUTTON_POPUP_EXPORT_TEXT = 0, |
111 | BUTTON_POPUP_EXPORT_GPASMAN | 116 | BUTTON_POPUP_EXPORT_GPASMAN |
112 | #ifdef CONFIG_KWALLETIF | 117 | #ifdef CONFIG_KWALLETIF |
113 | ,BUTTON_POPUP_EXPORT_KWALLET | 118 | ,BUTTON_POPUP_EXPORT_KWALLET |
114 | #endif | 119 | #endif |
115 | }; | 120 | }; |
116 | // Button IDs for "import" popup menu (in "file" popup menu) | 121 | // Button IDs for "import" popup menu (in "file" popup menu) |
117 | enum { | 122 | enum { |
118 | BUTTON_POPUP_IMPORT_TEXT = 0, | 123 | BUTTON_POPUP_IMPORT_TEXT = 0, |
119 | BUTTON_POPUP_IMPORT_GPASMAN | 124 | BUTTON_POPUP_IMPORT_GPASMAN |
120 | #ifdef CONFIG_KWALLETIF | 125 | #ifdef CONFIG_KWALLETIF |
121 | ,BUTTON_POPUP_IMPORT_KWALLET | 126 | ,BUTTON_POPUP_IMPORT_KWALLET |
122 | #endif | 127 | #endif |
123 | }; | 128 | }; |
124 | 129 | ||
125 | #ifdef PWM_EMBEDDED | 130 | #ifdef PWM_EMBEDDED |
126 | // Button IDs for "help" popup menu | 131 | // Button IDs for "help" popup menu |
127 | enum { | 132 | enum { |
128 | BUTTON_POPUP_HELP_LICENSE = 0, | 133 | BUTTON_POPUP_HELP_LICENSE = 0, |
129 | BUTTON_POPUP_HELP_FAQ, | 134 | BUTTON_POPUP_HELP_FAQ, |
130 | BUTTON_POPUP_HELP_ABOUT | 135 | BUTTON_POPUP_HELP_ABOUT |
131 | }; | 136 | }; |
132 | #endif | 137 | #endif |
133 | 138 | ||
134 | // Button IDs for toolbar | 139 | // Button IDs for toolbar |
135 | enum { | 140 | enum { |
136 | BUTTON_TOOL_NEW = 0, | 141 | BUTTON_TOOL_NEW = 0, |
137 | BUTTON_TOOL_OPEN, | 142 | BUTTON_TOOL_OPEN, |
138 | BUTTON_TOOL_SAVE, | 143 | BUTTON_TOOL_SAVE, |
139 | BUTTON_TOOL_SAVEAS, | 144 | BUTTON_TOOL_SAVEAS, |
140 | BUTTON_TOOL_PRINT, | 145 | BUTTON_TOOL_PRINT, |
141 | BUTTON_TOOL_ADD, | 146 | BUTTON_TOOL_ADD, |
142 | BUTTON_TOOL_EDIT, | 147 | BUTTON_TOOL_EDIT, |
143 | BUTTON_TOOL_DEL, | 148 | BUTTON_TOOL_DEL, |
144 | BUTTON_TOOL_FIND, | 149 | BUTTON_TOOL_FIND, |
145 | BUTTON_TOOL_LOCK, | 150 | BUTTON_TOOL_LOCK, |
146 | BUTTON_TOOL_DEEPLOCK, | 151 | BUTTON_TOOL_DEEPLOCK, |
147 | BUTTON_TOOL_UNLOCK | 152 | BUTTON_TOOL_UNLOCK |
148 | }; | 153 | }; |
149 | 154 | ||
@@ -658,235 +663,251 @@ void PwM::editPwd_slot(const QString *category, const int *index, | |||
658 | vector<string> catList; | 663 | vector<string> catList; |
659 | doc->getCategoryList(&catList); | 664 | doc->getCategoryList(&catList); |
660 | unsigned i, size = catList.size(); | 665 | unsigned i, size = catList.size(); |
661 | for (i = 0; i < size; ++i) { | 666 | for (i = 0; i < size; ++i) { |
662 | w.addCategory(catList[i].c_str()); | 667 | w.addCategory(catList[i].c_str()); |
663 | } | 668 | } |
664 | w.setCurrCategory(curCategory); | 669 | w.setCurrCategory(curCategory); |
665 | w.setDescription(currItem.desc.c_str()); | 670 | w.setDescription(currItem.desc.c_str()); |
666 | w.setUsername(currItem.name.c_str()); | 671 | w.setUsername(currItem.name.c_str()); |
667 | w.setPassword(currItem.pw.c_str()); | 672 | w.setPassword(currItem.pw.c_str()); |
668 | w.setUrl(currItem.url.c_str()); | 673 | w.setUrl(currItem.url.c_str()); |
669 | w.setLauncher(currItem.launcher.c_str()); | 674 | w.setLauncher(currItem.launcher.c_str()); |
670 | w.setComment(currItem.comment.c_str()); | 675 | w.setComment(currItem.comment.c_str()); |
671 | if (w.exec() == 1) { | 676 | if (w.exec() == 1) { |
672 | currItem.desc = w.getDescription().latin1(); | 677 | currItem.desc = w.getDescription().latin1(); |
673 | currItem.name = w.getUsername().latin1(); | 678 | currItem.name = w.getUsername().latin1(); |
674 | currItem.pw = w.getPassword().latin1(); | 679 | currItem.pw = w.getPassword().latin1(); |
675 | currItem.comment = w.getComment().latin1(); | 680 | currItem.comment = w.getComment().latin1(); |
676 | currItem.url = w.getUrl().latin1(); | 681 | currItem.url = w.getUrl().latin1(); |
677 | currItem.launcher = w.getLauncher().latin1(); | 682 | currItem.launcher = w.getLauncher().latin1(); |
678 | if (!doc->editEntry(curCategory, w.getCategory(), | 683 | if (!doc->editEntry(curCategory, w.getCategory(), |
679 | curEntryIndex, &currItem)) { | 684 | curEntryIndex, &currItem)) { |
680 | KMessageBox::error(this, | 685 | KMessageBox::error(this, |
681 | i18n("Couldn't edit the entry.\n" | 686 | i18n("Couldn't edit the entry.\n" |
682 | "Maybe you changed the category and " | 687 | "Maybe you changed the category and " |
683 | "this entry is already present in the new " | 688 | "this entry is already present in the new " |
684 | "category?"), | 689 | "category?"), |
685 | i18n("couldn't edit entry.")); | 690 | i18n("couldn't edit entry.")); |
686 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 691 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
687 | return; | 692 | return; |
688 | } | 693 | } |
689 | } | 694 | } |
690 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 695 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
691 | } | 696 | } |
692 | 697 | ||
693 | void PwM::deletePwd_slot() | 698 | void PwM::deletePwd_slot() |
694 | { | 699 | { |
695 | PWM_ASSERT(curDoc()); | 700 | PWM_ASSERT(curDoc()); |
696 | if (curDoc()->isDocEmpty()) | 701 | if (curDoc()->isDocEmpty()) |
697 | return; | 702 | return; |
698 | if (curDoc()->isDeepLocked()) | 703 | if (curDoc()->isDeepLocked()) |
699 | return; | 704 | return; |
700 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 705 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
701 | unsigned int curEntryIndex = 0; | 706 | unsigned int curEntryIndex = 0; |
702 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 707 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
703 | printDebug("couldn't get index"); | 708 | printDebug("couldn't get index"); |
704 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 709 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
705 | return; | 710 | return; |
706 | } | 711 | } |
707 | 712 | ||
708 | PwMDataItem currItem; | 713 | PwMDataItem currItem; |
709 | QString curCategory = view->getCurrentCategory(); | 714 | QString curCategory = view->getCurrentCategory(); |
710 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { | 715 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { |
711 | printDebug("couldn't get entry"); | 716 | printDebug("couldn't get entry"); |
712 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 717 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
713 | return; | 718 | return; |
714 | } | 719 | } |
715 | if (KMessageBox:: | 720 | if (KMessageBox:: |
716 | questionYesNo(this, | 721 | questionYesNo(this, |
717 | i18n | 722 | i18n |
718 | ("Do you really want to delete the selected entry") + | 723 | ("Do you really want to delete the selected entry") + |
719 | " \"" + QString(currItem.desc.c_str()) | 724 | " \"" + QString(currItem.desc.c_str()) |
720 | + "\" ?", i18n("delete?")) | 725 | + "\" ?", i18n("delete?")) |
721 | == KMessageBox::Yes) { | 726 | == KMessageBox::Yes) { |
722 | 727 | ||
723 | curDoc()->delEntry(curCategory, curEntryIndex); | 728 | curDoc()->delEntry(curCategory, curEntryIndex); |
724 | } | 729 | } |
725 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 730 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
726 | } | 731 | } |
727 | 732 | ||
728 | void PwM::changeMasterPwd_slot() | 733 | void PwM::changeMasterPwd_slot() |
729 | { | 734 | { |
730 | PWM_ASSERT(curDoc()); | 735 | PWM_ASSERT(curDoc()); |
731 | curDoc()->changeCurrentPw(); | 736 | curDoc()->changeCurrentPw(); |
732 | } | 737 | } |
733 | 738 | ||
734 | void PwM::lockWnd_slot() | 739 | void PwM::lockWnd_slot() |
735 | { | 740 | { |
736 | PWM_ASSERT(curDoc()); | 741 | PWM_ASSERT(curDoc()); |
737 | curDoc()->lockAll(true); | 742 | curDoc()->lockAll(true); |
738 | } | 743 | } |
739 | 744 | ||
740 | void PwM::deepLockWnd_slot() | 745 | void PwM::deepLockWnd_slot() |
741 | { | 746 | { |
742 | PWM_ASSERT(curDoc()); | 747 | PWM_ASSERT(curDoc()); |
743 | curDoc()->deepLock(); | 748 | curDoc()->deepLock(); |
744 | } | 749 | } |
745 | 750 | ||
746 | void PwM::unlockWnd_slot() | 751 | void PwM::unlockWnd_slot() |
747 | { | 752 | { |
748 | PWM_ASSERT(curDoc()); | 753 | PWM_ASSERT(curDoc()); |
749 | curDoc()->lockAll(false); | 754 | curDoc()->lockAll(false); |
750 | } | 755 | } |
751 | 756 | ||
752 | void PwM::config_slot() | 757 | void PwM::config_slot() |
753 | { | 758 | { |
754 | Configuration *conf = Configuration::obj(); | 759 | int oldStyle = conf()->confWndMainViewStyle(); |
755 | int oldStyle = conf->confWndMainViewStyle(); | 760 | #ifdef PWM_EMBEDDED |
761 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); | ||
762 | |||
763 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); | ||
764 | ConfigureDialog->addModule(pwmcfg ); | ||
756 | 765 | ||
766 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | ||
767 | ConfigureDialog->addModule(kdelibcfg ); | ||
768 | |||
769 | #ifndef DESKTOP_VERSION | ||
770 | ConfigureDialog->showMaximized(); | ||
771 | #endif | ||
772 | if ( ConfigureDialog->exec() ) | ||
773 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | ||
774 | delete ConfigureDialog; | ||
775 | |||
776 | #else //PWM_EMBEDDED | ||
757 | // display the configuration window (modal mode) | 777 | // display the configuration window (modal mode) |
758 | if (!conf->showConfWnd(this)) | 778 | if (!conf()->showConfWnd(this)) |
759 | return; | 779 | return; |
780 | #endif | ||
760 | 781 | ||
761 | int newStyle = conf->confWndMainViewStyle(); | 782 | int newStyle = conf()->confWndMainViewStyle(); |
762 | // reinitialize tray | 783 | // reinitialize tray |
763 | init->initTray(); | 784 | init->initTray(); |
764 | // reinitialize KWallet emulation | 785 | // reinitialize KWallet emulation |
765 | init->initKWalletEmu(); | 786 | init->initKWalletEmu(); |
766 | 787 | ||
767 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 788 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
768 | const vector<PwMDocList::listItem> *dl = _dl->getList(); | 789 | const vector<PwMDocList::listItem> *dl = _dl->getList(); |
769 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 790 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
770 | end = dl->end(); | 791 | end = dl->end(); |
771 | PwMDoc *doc; | 792 | PwMDoc *doc; |
772 | while (i != end) { | 793 | while (i != end) { |
773 | doc = (*i).doc; | 794 | doc = (*i).doc; |
774 | // unlock-without-mpw timeout | 795 | // unlock-without-mpw timeout |
775 | doc->timer()->start(DocTimer::id_mpwTimer); | 796 | doc->timer()->start(DocTimer::id_mpwTimer); |
776 | // auto-lock timeout | 797 | // auto-lock timeout |
777 | doc->timer()->start(DocTimer::id_autoLockTimer); | 798 | doc->timer()->start(DocTimer::id_autoLockTimer); |
778 | ++i; | 799 | ++i; |
779 | } | 800 | } |
780 | 801 | ||
781 | const QValueList<PwM *> *ml = init->mainWndList(); | 802 | const QValueList<PwM *> *ml = init->mainWndList(); |
782 | #ifndef PWM_EMBEDDED | 803 | #ifndef PWM_EMBEDDED |
783 | QValueList<PwM *>::const_iterator i2 = ml->begin(), | 804 | QValueList<PwM *>::const_iterator i2 = ml->begin(), |
784 | end2 = ml->end(); | 805 | end2 = ml->end(); |
785 | #else | 806 | #else |
786 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 807 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), |
787 | end2 = ml->end(); | 808 | end2 = ml->end(); |
788 | #endif | 809 | #endif |
789 | PwM *pwm; | 810 | PwM *pwm; |
790 | while (i2 != end2) { | 811 | while (i2 != end2) { |
791 | pwm = *i2; | 812 | pwm = *i2; |
792 | // reinitialize the window style. | 813 | // reinitialize the window style. |
793 | if (oldStyle != newStyle) | 814 | if (oldStyle != newStyle) |
794 | pwm->curView()->initStyle(newStyle); | 815 | pwm->curView()->initStyle(newStyle); |
795 | // set the new font | 816 | // set the new font |
796 | pwm->curView()->setFont(conf->confGlobEntryFont()); | 817 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
797 | ++i2; | 818 | ++i2; |
798 | } | 819 | } |
799 | } | 820 | } |
800 | 821 | ||
801 | void PwM::activateMpButton(bool activate) | 822 | void PwM::activateMpButton(bool activate) |
802 | { | 823 | { |
803 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); | 824 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); |
804 | } | 825 | } |
805 | 826 | ||
806 | void PwM::closeEvent(QCloseEvent *e) | 827 | void PwM::closeEvent(QCloseEvent *e) |
807 | { | 828 | { |
808 | e->accept(); | 829 | e->accept(); |
809 | } | 830 | } |
810 | 831 | ||
811 | void PwM::docClosed(PwMDoc *doc) | 832 | void PwM::docClosed(PwMDoc *doc) |
812 | { | 833 | { |
813 | PARAM_UNUSED(doc); | 834 | PARAM_UNUSED(doc); |
814 | PWM_ASSERT(doc == curDoc()); | 835 | PWM_ASSERT(doc == curDoc()); |
815 | close(); | 836 | close(); |
816 | } | 837 | } |
817 | 838 | ||
818 | void PwM::find_slot() | 839 | void PwM::find_slot() |
819 | { | 840 | { |
820 | PWM_ASSERT(curDoc()); | 841 | PWM_ASSERT(curDoc()); |
821 | if (curDoc()->isDocEmpty()) | 842 | if (curDoc()->isDocEmpty()) |
822 | return; | 843 | return; |
823 | if (curDoc()->isDeepLocked()) | 844 | if (curDoc()->isDeepLocked()) |
824 | return; | 845 | return; |
825 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 846 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
826 | FindWndImpl findWnd(view); | 847 | FindWndImpl findWnd(view); |
827 | findWnd.exec(); | 848 | findWnd.exec(); |
828 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 849 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
829 | } | 850 | } |
830 | 851 | ||
831 | void PwM::exportToText() | 852 | void PwM::exportToText() |
832 | { | 853 | { |
833 | PWM_ASSERT(curDoc()); | 854 | PWM_ASSERT(curDoc()); |
834 | if (curDoc()->isDocEmpty()) { | 855 | if (curDoc()->isDocEmpty()) { |
835 | KMessageBox::information(this, | 856 | KMessageBox::information(this, |
836 | i18n | 857 | i18n |
837 | ("Sorry, there's nothing to export.\n" | 858 | ("Sorry, there's nothing to export.\n" |
838 | "Please first add some passwords."), | 859 | "Please first add some passwords."), |
839 | i18n("nothing to do")); | 860 | i18n("nothing to do")); |
840 | return; | 861 | return; |
841 | } | 862 | } |
842 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 863 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
843 | QString fn(KFileDialog::getSaveFileName(QString::null, | 864 | QString fn(KFileDialog::getSaveFileName(QString::null, |
844 | i18n("*|plain-text file"), | 865 | i18n("*|plain-text file"), |
845 | this)); | 866 | this)); |
846 | if (fn == "") { | 867 | if (fn == "") { |
847 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 868 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
848 | return; | 869 | return; |
849 | } | 870 | } |
850 | 871 | ||
851 | PwMerror ret = curDoc()->exportToText(&fn); | 872 | PwMerror ret = curDoc()->exportToText(&fn); |
852 | if (ret != e_success) { | 873 | if (ret != e_success) { |
853 | KMessageBox::error(this, | 874 | KMessageBox::error(this, |
854 | i18n("Error: Couldn't write to file.\n" | 875 | i18n("Error: Couldn't write to file.\n" |
855 | "Please check if you have permission to write " | 876 | "Please check if you have permission to write " |
856 | "to the file in that directory."), | 877 | "to the file in that directory."), |
857 | i18n("error while writing")); | 878 | i18n("error while writing")); |
858 | } else | 879 | } else |
859 | showStatMsg(i18n("Successfully exported data.")); | 880 | showStatMsg(i18n("Successfully exported data.")); |
860 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 881 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
861 | } | 882 | } |
862 | 883 | ||
863 | bool PwM::importFromText() | 884 | bool PwM::importFromText() |
864 | { | 885 | { |
865 | if (!isVirgin()) { | 886 | if (!isVirgin()) { |
866 | if (KMessageBox::questionYesNo(this, | 887 | if (KMessageBox::questionYesNo(this, |
867 | i18n("Do you want to import the data " | 888 | i18n("Do you want to import the data " |
868 | "into the current document? (If you " | 889 | "into the current document? (If you " |
869 | "select \"no\", a new document will be " | 890 | "select \"no\", a new document will be " |
870 | "opened.)"), | 891 | "opened.)"), |
871 | i18n("import into this document?")) | 892 | i18n("import into this document?")) |
872 | == KMessageBox::No) { | 893 | == KMessageBox::No) { |
873 | // import the data to a new window. | 894 | // import the data to a new window. |
874 | PwM *newInstance = init->createMainWnd(); | 895 | PwM *newInstance = init->createMainWnd(); |
875 | bool ok = newInstance->importFromText(); | 896 | bool ok = newInstance->importFromText(); |
876 | if (!ok) { | 897 | if (!ok) { |
877 | newInstance->setForceQuit(true); | 898 | newInstance->setForceQuit(true); |
878 | delete_and_null(newInstance); | 899 | delete_and_null(newInstance); |
879 | } | 900 | } |
880 | return ok; | 901 | return ok; |
881 | } | 902 | } |
882 | } | 903 | } |
883 | 904 | ||
884 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 905 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
885 | PwMerror ret; | 906 | PwMerror ret; |
886 | QString path(KFileDialog::getOpenFileName(QString::null, | 907 | QString path(KFileDialog::getOpenFileName(QString::null, |
887 | i18n("*|PWM-exported text file"), | 908 | i18n("*|PWM-exported text file"), |
888 | this)); | 909 | this)); |
889 | if (path == "") | 910 | if (path == "") |
890 | goto cancelImport; | 911 | goto cancelImport; |
891 | 912 | ||
892 | ret = curDoc()->importFromText(&path, 0); | 913 | ret = curDoc()->importFromText(&path, 0); |
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro index 2cd69a5..5c29ea4 100644 --- a/pwmanager/pwmanager/pwmanagerE.pro +++ b/pwmanager/pwmanager/pwmanagerE.pro | |||
@@ -1,144 +1,153 @@ | |||
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 |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 6 | OBJECTS_DIR = obj/$(PLATFORM) |
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../microkde ../../microkde/kdecore ../../microkde/kdeui $(QPEDIR)/include | 10 | INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include |
11 | DEFINES += PWM_EMBEDDED PWM_DEBUG | 11 | DEFINES += PWM_EMBEDDED PWM_DEBUG |
12 | LIBS += -lmicrokde | 12 | LIBS += -lmicrokde |
13 | LIBS += -lmicroqtcompat | 13 | LIBS += -lmicroqtcompat |
14 | LIBS += -lmicrokdepim | ||
14 | LIBS += -L$(QPEDIR)/lib | 15 | LIBS += -L$(QPEDIR)/lib |
15 | LIBS += -lqpe | 16 | LIBS += -lqpe |
16 | LIBS += -lbz2 | 17 | LIBS += -lbz2 |
17 | LIBS += $(QTOPIALIB) | 18 | LIBS += $(QTOPIALIB) |
18 | 19 | ||
19 | #INTERFACES = \ | 20 | #INTERFACES = \ |
20 | #addentrywnd.ui \ | 21 | #addentrywnd.ui \ |
21 | #configwnd.ui \ | 22 | #configwnd.ui \ |
22 | #findwnd.ui \ | 23 | #findwnd.ui \ |
23 | #getmasterpwwnd.ui \ | 24 | #getmasterpwwnd.ui \ |
24 | #pwgenwnd.ui \ | 25 | #pwgenwnd.ui \ |
25 | #setmasterpwwnd.ui \ | 26 | #setmasterpwwnd.ui \ |
26 | #subtbledit.ui | 27 | #subtbledit.ui |
27 | 28 | ||
28 | #INTERFACES = \ | 29 | #INTERFACES = \ |
29 | #subtbledit.ui \ | 30 | #subtbledit.ui \ |
30 | 31 | ||
31 | 32 | ||
32 | 33 | ||
33 | #HEADERS = \ | 34 | #HEADERS = \ |
35 | #configuration_31compat.h \ | ||
36 | #configuration.h \ | ||
37 | #configwnd.h \ | ||
38 | #configwndimpl.h \ | ||
34 | #selftest.h | 39 | #selftest.h |
35 | 40 | ||
36 | HEADERS = \ | 41 | HEADERS = \ |
37 | addentrywnd.h \ | 42 | addentrywnd.h \ |
38 | addentrywndimpl.h \ | 43 | addentrywndimpl.h \ |
39 | base64.h \ | 44 | base64.h \ |
40 | binentrygen.h \ | 45 | binentrygen.h \ |
41 | blowfish.h \ | 46 | blowfish.h \ |
42 | commentbox.h \ | 47 | commentbox.h \ |
43 | compiler.h \ | 48 | compiler.h \ |
44 | compressbzip2.h \ | 49 | compressbzip2.h \ |
45 | compressgzip.h \ | 50 | compressgzip.h \ |
46 | configuration_31compat.h \ | ||
47 | configuration.h \ | ||
48 | configwnd.h \ | ||
49 | configwndimpl.h \ | ||
50 | findwnd.h \ | 51 | findwnd.h \ |
51 | findwndimpl.h \ | 52 | findwndimpl.h \ |
52 | genpasswd.h \ | 53 | genpasswd.h \ |
53 | getkeycardwnd.h \ | 54 | getkeycardwnd.h \ |
54 | getmasterpwwnd.h \ | 55 | getmasterpwwnd.h \ |
55 | getmasterpwwndimpl.h \ | 56 | getmasterpwwndimpl.h \ |
56 | globalstuff.h \ | 57 | globalstuff.h \ |
57 | gpasmanfile.h \ | 58 | gpasmanfile.h \ |
58 | htmlgen.h \ | 59 | htmlgen.h \ |
59 | htmlparse.h \ | 60 | htmlparse.h \ |
60 | ipc.h \ | 61 | ipc.h \ |
61 | listobjselectwnd.h \ | 62 | listobjselectwnd.h \ |
62 | listviewpwm.h \ | 63 | listviewpwm.h \ |
63 | printtext.h \ | 64 | printtext.h \ |
64 | pwgenwnd.h \ | 65 | pwgenwnd.h \ |
65 | pwgenwndimpl.h \ | 66 | pwgenwndimpl.h \ |
66 | pwmdoc.h \ | 67 | pwmdoc.h \ |
67 | pwmdocui.h \ | 68 | pwmdocui.h \ |
68 | pwmexception.h \ | 69 | pwmexception.h \ |
69 | pwm.h \ | 70 | pwm.h \ |
70 | pwminit.h \ | 71 | pwminit.h \ |
72 | pwmprefs.h \ | ||
71 | pwmprint.h \ | 73 | pwmprint.h \ |
72 | pwmtray.h \ | 74 | pwmtray.h \ |
73 | pwmview.h \ | 75 | pwmview.h \ |
74 | pwmviewstyle_0.h \ | 76 | pwmviewstyle_0.h \ |
75 | pwmviewstyle_1.h \ | 77 | pwmviewstyle_1.h \ |
76 | pwmviewstyle.h \ | 78 | pwmviewstyle.h \ |
77 | randomizer.h \ | 79 | randomizer.h \ |
78 | rc2.h \ | 80 | rc2.h \ |
79 | rencatwnd.h \ | 81 | rencatwnd.h \ |
80 | serializer.h \ | 82 | serializer.h \ |
81 | setmasterpwwnd.h \ | 83 | setmasterpwwnd.h \ |
82 | setmasterpwwndimpl.h \ | 84 | setmasterpwwndimpl.h \ |
83 | sha1.h \ | 85 | sha1.h \ |
84 | subtbledit.h \ | 86 | subtbledit.h \ |
85 | subtbleditimpl.h \ | 87 | subtbleditimpl.h \ |
86 | waitwnd.h | 88 | waitwnd.h \ |
89 | kcmconfigs/kcmpwmconfig.h \ | ||
90 | kcmconfigs/pwmconfigwidget.h \ | ||
87 | 91 | ||
92 | #sources that need not be build | ||
88 | #SOURCES = \ | 93 | #SOURCES = \ |
89 | #advcommeditimpl.cpp \ | 94 | #advcommeditimpl.cpp \ |
95 | #configuration.cpp \ | ||
96 | #configwnd.cpp \ | ||
97 | #configwndimpl.cpp \ | ||
90 | #configuration_31compat.cpp \ | 98 | #configuration_31compat.cpp \ |
91 | #htmlparse.cpp \ | 99 | #htmlparse.cpp \ |
92 | #printtext.cpp \ | 100 | #printtext.cpp \ |
93 | #selftest.cpp \ | 101 | #selftest.cpp \ |
94 | #pwmprint.cpp \ | 102 | #pwmprint.cpp \ |
95 | #spinforsignal.cpp | 103 | #spinforsignal.cpp |
96 | 104 | ||
97 | SOURCES = \ | 105 | SOURCES = \ |
98 | addentrywnd.cpp \ | 106 | addentrywnd.cpp \ |
99 | addentrywndimpl.cpp \ | 107 | addentrywndimpl.cpp \ |
100 | base64.cpp \ | 108 | base64.cpp \ |
101 | binentrygen.cpp \ | 109 | binentrygen.cpp \ |
102 | blowfish.cpp \ | 110 | blowfish.cpp \ |
103 | commentbox.cpp \ | 111 | commentbox.cpp \ |
104 | compressbzip2.cpp \ | 112 | compressbzip2.cpp \ |
105 | compressgzip.cpp \ | 113 | compressgzip.cpp \ |
106 | configuration.cpp \ | ||
107 | configwnd.cpp \ | ||
108 | configwndimpl.cpp \ | ||
109 | findwnd.cpp \ | 114 | findwnd.cpp \ |
110 | findwndimpl.cpp \ | 115 | findwndimpl.cpp \ |
111 | genpasswd.cpp \ | 116 | genpasswd.cpp \ |
112 | getkeycardwnd.cpp \ | 117 | getkeycardwnd.cpp \ |
113 | getmasterpwwnd.cpp \ | 118 | getmasterpwwnd.cpp \ |
114 | getmasterpwwndimpl.cpp \ | 119 | getmasterpwwndimpl.cpp \ |
115 | globalstuff.cpp \ | 120 | globalstuff.cpp \ |
116 | gpasmanfile.cpp \ | 121 | gpasmanfile.cpp \ |
117 | htmlgen.cpp \ | 122 | htmlgen.cpp \ |
118 | ipc.cpp \ | 123 | ipc.cpp \ |
119 | listobjselectwnd.cpp \ | 124 | listobjselectwnd.cpp \ |
120 | listviewpwm.cpp \ | 125 | listviewpwm.cpp \ |
121 | main.cpp \ | 126 | main.cpp \ |
122 | pwgenwnd.cpp \ | 127 | pwgenwnd.cpp \ |
123 | pwgenwndimpl.cpp \ | 128 | pwgenwndimpl.cpp \ |
124 | pwm.cpp \ | 129 | pwm.cpp \ |
125 | pwmdoc.cpp \ | 130 | pwmdoc.cpp \ |
126 | pwmdocui.cpp \ | 131 | pwmdocui.cpp \ |
127 | pwmexception.cpp \ | 132 | pwmexception.cpp \ |
128 | pwminit.cpp \ | 133 | pwminit.cpp \ |
134 | pwmprefs.cpp \ | ||
129 | pwmtray.cpp \ | 135 | pwmtray.cpp \ |
130 | pwmview.cpp \ | 136 | pwmview.cpp \ |
131 | pwmviewstyle_0.cpp \ | 137 | pwmviewstyle_0.cpp \ |
132 | pwmviewstyle_1.cpp \ | 138 | pwmviewstyle_1.cpp \ |
133 | pwmviewstyle.cpp \ | 139 | pwmviewstyle.cpp \ |
134 | randomizer.cpp \ | 140 | randomizer.cpp \ |
135 | rc2.cpp \ | 141 | rc2.cpp \ |
136 | rencatwnd.cpp \ | 142 | rencatwnd.cpp \ |
137 | serializer.cpp \ | 143 | serializer.cpp \ |
138 | setmasterpwwnd.cpp \ | 144 | setmasterpwwnd.cpp \ |
139 | setmasterpwwndimpl.cpp \ | 145 | setmasterpwwndimpl.cpp \ |
140 | sha1.cpp \ | 146 | sha1.cpp \ |
141 | subtbledit.cpp \ | 147 | subtbledit.cpp \ |
142 | subtbleditimpl.cpp \ | 148 | subtbleditimpl.cpp \ |
143 | waitwnd.cpp \ | 149 | waitwnd.cpp \ |
150 | kcmconfigs/kcmpwmconfig.cpp \ | ||
151 | kcmconfigs/pwmconfigwidget.cpp \ | ||
152 | |||
144 | 153 | ||
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index 04af360..9fe4809 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -1,129 +1,131 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 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 2.0 of pwmanager | 14 | * This file is originaly based on version 2.0 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 "pwmdoc.h" | 20 | #include "pwmdoc.h" |
21 | #include "pwmview.h" | 21 | #include "pwmview.h" |
22 | #include "blowfish.h" | 22 | #include "blowfish.h" |
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" | ||
35 | #include "kglobal.h" | ||
34 | #endif | 36 | #endif |
35 | 37 | ||
36 | #ifdef CONFIG_KWALLETIF | 38 | #ifdef CONFIG_KWALLETIF |
37 | # include "kwalletemu.h" | 39 | # include "kwalletemu.h" |
38 | #endif // CONFIG_KWALLETIF | 40 | #endif // CONFIG_KWALLETIF |
39 | 41 | ||
40 | #include <qdatetime.h> | 42 | #include <qdatetime.h> |
41 | #include <qsize.h> | 43 | #include <qsize.h> |
42 | #include <qfileinfo.h> | 44 | #include <qfileinfo.h> |
43 | #include <qfile.h> | 45 | #include <qfile.h> |
44 | 46 | ||
45 | #include <stdio.h> | 47 | #include <stdio.h> |
46 | #include <stdlib.h> | 48 | #include <stdlib.h> |
47 | #include <errno.h> | 49 | #include <errno.h> |
48 | #include <string.h> | 50 | #include <string.h> |
49 | #include <iostream> | 51 | #include <iostream> |
50 | #include <algorithm> | 52 | #include <algorithm> |
51 | #include <sys/types.h> | 53 | #include <sys/types.h> |
52 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
53 | #include <unistd.h> | 55 | #include <unistd.h> |
54 | #include <stdint.h> | 56 | #include <stdint.h> |
55 | 57 | ||
56 | //TODO: reset to its normal value. | 58 | //TODO: reset to its normal value. |
57 | #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ | 59 | #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ |
58 | 60 | ||
59 | using namespace std; | 61 | using namespace std; |
60 | 62 | ||
61 | 63 | ||
62 | void PwMDocList::add(PwMDoc *doc, const string &id) | 64 | void PwMDocList::add(PwMDoc *doc, const string &id) |
63 | { | 65 | { |
64 | #ifdef PWM_DEBUG | 66 | #ifdef PWM_DEBUG |
65 | // check for existance of object in debug mode only. | 67 | // check for existance of object in debug mode only. |
66 | vector<listItem>::iterator begin = docList.begin(), | 68 | vector<listItem>::iterator begin = docList.begin(), |
67 | end = docList.end(), | 69 | end = docList.end(), |
68 | i = begin; | 70 | i = begin; |
69 | while (i != end) { | 71 | while (i != end) { |
70 | if (i->doc == doc) { | 72 | if (i->doc == doc) { |
71 | BUG(); | 73 | BUG(); |
72 | return; | 74 | return; |
73 | } | 75 | } |
74 | ++i; | 76 | ++i; |
75 | } | 77 | } |
76 | #endif | 78 | #endif |
77 | listItem newItem; | 79 | listItem newItem; |
78 | newItem.doc = doc; | 80 | newItem.doc = doc; |
79 | newItem.docId = id; | 81 | newItem.docId = id; |
80 | docList.push_back(newItem); | 82 | docList.push_back(newItem); |
81 | } | 83 | } |
82 | 84 | ||
83 | void PwMDocList::edit(PwMDoc *doc, const string &newId) | 85 | void PwMDocList::edit(PwMDoc *doc, const string &newId) |
84 | { | 86 | { |
85 | vector<listItem>::iterator begin = docList.begin(), | 87 | vector<listItem>::iterator begin = docList.begin(), |
86 | end = docList.end(), | 88 | end = docList.end(), |
87 | i = begin; | 89 | i = begin; |
88 | while (i != end) { | 90 | while (i != end) { |
89 | if (i->doc == doc) { | 91 | if (i->doc == doc) { |
90 | i->docId = newId; | 92 | i->docId = newId; |
91 | return; | 93 | return; |
92 | } | 94 | } |
93 | ++i; | 95 | ++i; |
94 | } | 96 | } |
95 | } | 97 | } |
96 | 98 | ||
97 | void PwMDocList::del(PwMDoc *doc) | 99 | void PwMDocList::del(PwMDoc *doc) |
98 | { | 100 | { |
99 | vector<listItem>::iterator begin = docList.begin(), | 101 | vector<listItem>::iterator begin = docList.begin(), |
100 | end = docList.end(), | 102 | end = docList.end(), |
101 | i = begin; | 103 | i = begin; |
102 | while (i != end) { | 104 | while (i != end) { |
103 | if (i->doc == doc) { | 105 | if (i->doc == doc) { |
104 | docList.erase(i); | 106 | docList.erase(i); |
105 | return; | 107 | return; |
106 | } | 108 | } |
107 | ++i; | 109 | ++i; |
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
111 | bool PwMDocList::find(const string &id, listItem *ret) | 113 | bool PwMDocList::find(const string &id, listItem *ret) |
112 | { | 114 | { |
113 | vector<listItem>::iterator begin = docList.begin(), | 115 | vector<listItem>::iterator begin = docList.begin(), |
114 | end = docList.end(), | 116 | end = docList.end(), |
115 | i = begin; | 117 | i = begin; |
116 | while (i != end) { | 118 | while (i != end) { |
117 | if (i->docId == id) { | 119 | if (i->docId == id) { |
118 | if (ret) | 120 | if (ret) |
119 | *ret = *i; | 121 | *ret = *i; |
120 | return true; | 122 | return true; |
121 | } | 123 | } |
122 | ++i; | 124 | ++i; |
123 | } | 125 | } |
124 | return false; | 126 | return false; |
125 | } | 127 | } |
126 | 128 | ||
127 | 129 | ||
128 | 130 | ||
129 | DocTimer::DocTimer(PwMDoc *_doc) | 131 | DocTimer::DocTimer(PwMDoc *_doc) |
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h index 9650d55..193247e 100644 --- a/pwmanager/pwmanager/pwmdoc.h +++ b/pwmanager/pwmanager/pwmdoc.h | |||
@@ -1,155 +1,155 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 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 2.0 of pwmanager | 14 | * This file is originaly based on version 2.0 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 __PWMDOC_H | 20 | #ifndef __PWMDOC_H |
21 | #define __PWMDOC_H | 21 | #define __PWMDOC_H |
22 | 22 | ||
23 | #define PWM_FILE_VER (static_cast<char>(0x05)) | 23 | #define PWM_FILE_VER (static_cast<char>(0x05)) |
24 | 24 | ||
25 | #define PWM_HASH_SHA1 (static_cast<char>(0x01)) | 25 | #define PWM_HASH_SHA1 (static_cast<char>(0x01)) |
26 | #define PWM_HASH_SHA256 (static_cast<char>(0x02)) | 26 | #define PWM_HASH_SHA256 (static_cast<char>(0x02)) |
27 | #define PWM_HASH_SHA384 (static_cast<char>(0x03)) | 27 | #define PWM_HASH_SHA384 (static_cast<char>(0x03)) |
28 | #define PWM_HASH_SHA512 (static_cast<char>(0x04)) | 28 | #define PWM_HASH_SHA512 (static_cast<char>(0x04)) |
29 | #define PWM_HASH_MD5 (static_cast<char>(0x05)) | 29 | #define PWM_HASH_MD5 (static_cast<char>(0x05)) |
30 | #define PWM_HASH_RMD160 (static_cast<char>(0x06)) | 30 | #define PWM_HASH_RMD160 (static_cast<char>(0x06)) |
31 | #define PWM_HASH_TIGER (static_cast<char>(0x07)) | 31 | #define PWM_HASH_TIGER (static_cast<char>(0x07)) |
32 | 32 | ||
33 | #define PWM_CRYPT_BLOWFISH(static_cast<char>(0x01)) | 33 | #define PWM_CRYPT_BLOWFISH(static_cast<char>(0x01)) |
34 | #define PWM_CRYPT_AES128(static_cast<char>(0x02)) | 34 | #define PWM_CRYPT_AES128(static_cast<char>(0x02)) |
35 | #define PWM_CRYPT_AES192(static_cast<char>(0x03)) | 35 | #define PWM_CRYPT_AES192(static_cast<char>(0x03)) |
36 | #define PWM_CRYPT_AES256(static_cast<char>(0x04)) | 36 | #define PWM_CRYPT_AES256(static_cast<char>(0x04)) |
37 | #define PWM_CRYPT_3DES (static_cast<char>(0x05)) | 37 | #define PWM_CRYPT_3DES (static_cast<char>(0x05)) |
38 | #define PWM_CRYPT_TWOFISH(static_cast<char>(0x06)) | 38 | #define PWM_CRYPT_TWOFISH(static_cast<char>(0x06)) |
39 | #define PWM_CRYPT_TWOFISH128(static_cast<char>(0x07)) | 39 | #define PWM_CRYPT_TWOFISH128(static_cast<char>(0x07)) |
40 | 40 | ||
41 | #define PWM_COMPRESS_NONE(static_cast<char>(0x00)) | 41 | #define PWM_COMPRESS_NONE(static_cast<char>(0x00)) |
42 | #define PWM_COMPRESS_GZIP(static_cast<char>(0x01)) | 42 | #define PWM_COMPRESS_GZIP(static_cast<char>(0x01)) |
43 | #define PWM_COMPRESS_BZIP2(static_cast<char>(0x02)) | 43 | #define PWM_COMPRESS_BZIP2(static_cast<char>(0x02)) |
44 | 44 | ||
45 | #define DEFAULT_MAX_ENTRIES(~(static_cast<unsigned int>(0))) | 45 | #define DEFAULT_MAX_ENTRIES(~(static_cast<unsigned int>(0))) |
46 | #define FILE_ID_HEADER "PWM_PASSWORD_FILE" | 46 | #define FILE_ID_HEADER "PWM_PASSWORD_FILE" |
47 | 47 | ||
48 | 48 | ||
49 | #include "pwmexception.h" | 49 | #include "pwmexception.h" |
50 | #include "pwmdocui.h" | 50 | #include "pwmdocui.h" |
51 | #include "configuration.h" | ||
52 | 51 | ||
53 | #include <qobject.h> | 52 | #include <qobject.h> |
54 | #include <qtimer.h> | 53 | #include <qtimer.h> |
55 | #include <qdatetime.h> | 54 | #include <qdatetime.h> |
56 | 55 | ||
57 | #include <kprocess.h> | 56 | #include <kprocess.h> |
58 | 57 | ||
59 | #ifndef PWM_EMBEDDED | 58 | #ifndef PWM_EMBEDDED |
59 | #include "configuration.h" | ||
60 | #else | 60 | #else |
61 | #include <kapplication.h> | 61 | #include <kapplication.h> |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #include <string> | 64 | #include <string> |
65 | #include <vector> | 65 | #include <vector> |
66 | #include <utility> | 66 | #include <utility> |
67 | 67 | ||
68 | using std::vector; | 68 | using std::vector; |
69 | using std::string; | 69 | using std::string; |
70 | using std::pair; | 70 | using std::pair; |
71 | 71 | ||
72 | /* used in findEntry() function */ | 72 | /* used in findEntry() function */ |
73 | #define SEARCH_IN_DESC (1) | 73 | #define SEARCH_IN_DESC (1) |
74 | #define SEARCH_IN_NAME (1 << 1) | 74 | #define SEARCH_IN_NAME (1 << 1) |
75 | #define SEARCH_IN_PW (1 << 2) | 75 | #define SEARCH_IN_PW (1 << 2) |
76 | #define SEARCH_IN_COMMENT(1 << 3) | 76 | #define SEARCH_IN_COMMENT(1 << 3) |
77 | #define SEARCH_IN_URL (1 << 4) | 77 | #define SEARCH_IN_URL (1 << 4) |
78 | #define SEARCH_IN_LAUNCHER(1 << 5) | 78 | #define SEARCH_IN_LAUNCHER(1 << 5) |
79 | #define SEARCH_IN_ALL (SEARCH_IN_DESC | SEARCH_IN_NAME| \ | 79 | #define SEARCH_IN_ALL (SEARCH_IN_DESC | SEARCH_IN_NAME| \ |
80 | SEARCH_IN_PW | SEARCH_IN_COMMENT| \ | 80 | SEARCH_IN_PW | SEARCH_IN_COMMENT| \ |
81 | SEARCH_IN_URL| SEARCH_IN_LAUNCHER) | 81 | SEARCH_IN_URL| SEARCH_IN_LAUNCHER) |
82 | 82 | ||
83 | /** document deeplocked. Data is out for lunch to disk */ | 83 | /** document deeplocked. Data is out for lunch to disk */ |
84 | #define DOC_STAT_DEEPLOCKED (1) | 84 | #define DOC_STAT_DEEPLOCKED (1) |
85 | /** encrypted document on disk is dirty. data has to go to disk. */ | 85 | /** encrypted document on disk is dirty. data has to go to disk. */ |
86 | #define DOC_STAT_DISK_DIRTY (1 << 1) | 86 | #define DOC_STAT_DISK_DIRTY (1 << 1) |
87 | /** we are using a chipcard to encrypt the data */ | 87 | /** we are using a chipcard to encrypt the data */ |
88 | #define DOC_STAT_USE_CHIPCARD (1 << 2) | 88 | #define DOC_STAT_USE_CHIPCARD (1 << 2) |
89 | /** use "currentPw" to unlock. (This flag is set/unset by a timer) */ | 89 | /** use "currentPw" to unlock. (This flag is set/unset by a timer) */ |
90 | #define DOC_STAT_UNLOCK_WITHOUT_PW(1 << 3) | 90 | #define DOC_STAT_UNLOCK_WITHOUT_PW(1 << 3) |
91 | 91 | ||
92 | class PwMDoc; | 92 | class PwMDoc; |
93 | class PwMView; | 93 | class PwMView; |
94 | class QFile; | 94 | class QFile; |
95 | 95 | ||
96 | /* meta data for a PwMDataItem */ | 96 | /* meta data for a PwMDataItem */ |
97 | struct PwMMetaData | 97 | struct PwMMetaData |
98 | { | 98 | { |
99 | PwMMetaData() | 99 | PwMMetaData() |
100 | : updateInt (0) | 100 | : updateInt (0) |
101 | { } | 101 | { } |
102 | /** creation date of the PwMDataItem to which | 102 | /** creation date of the PwMDataItem to which |
103 | * this meta data belongs. | 103 | * this meta data belongs. |
104 | */ | 104 | */ |
105 | QDateTimecreate; | 105 | QDateTimecreate; |
106 | /** becomes valid on this date */ | 106 | /** becomes valid on this date */ |
107 | QDateTimevalid; | 107 | QDateTimevalid; |
108 | /** expire date */ | 108 | /** expire date */ |
109 | QDateTimeexpire; | 109 | QDateTimeexpire; |
110 | /** update date (last updated at this date) */ | 110 | /** update date (last updated at this date) */ |
111 | QDateTimeupdate; | 111 | QDateTimeupdate; |
112 | /** update interval (in minutes). Time since the | 112 | /** update interval (in minutes). Time since the |
113 | * last update to remind the user to update the item. | 113 | * last update to remind the user to update the item. |
114 | * 0 disables. | 114 | * 0 disables. |
115 | */ | 115 | */ |
116 | unsigned long updateInt; | 116 | unsigned long updateInt; |
117 | 117 | ||
118 | //US ENH: enhancements of the filestructure | 118 | //US ENH: enhancements of the filestructure |
119 | /* each entry gets a unique id assigned */ | 119 | /* each entry gets a unique id assigned */ |
120 | QString uniqueid; | 120 | QString uniqueid; |
121 | 121 | ||
122 | 122 | ||
123 | void clear() | 123 | void clear() |
124 | { | 124 | { |
125 | create = QDateTime(); | 125 | create = QDateTime(); |
126 | expire = QDateTime(); | 126 | expire = QDateTime(); |
127 | update = QDateTime(); | 127 | update = QDateTime(); |
128 | updateInt = 0; | 128 | updateInt = 0; |
129 | uniqueid = KApplication::randomString(8); | 129 | uniqueid = KApplication::randomString(8); |
130 | } | 130 | } |
131 | inline bool isValid() const | 131 | inline bool isValid() const |
132 | { | 132 | { |
133 | if (valid.isNull()) | 133 | if (valid.isNull()) |
134 | return true; | 134 | return true; |
135 | return (valid < QDateTime::currentDateTime()); | 135 | return (valid < QDateTime::currentDateTime()); |
136 | } | 136 | } |
137 | inline bool isExpired() const | 137 | inline bool isExpired() const |
138 | { | 138 | { |
139 | if (expire.isNull()) | 139 | if (expire.isNull()) |
140 | return false; | 140 | return false; |
141 | return (expire < QDateTime::currentDateTime()); | 141 | return (expire < QDateTime::currentDateTime()); |
142 | } | 142 | } |
143 | inline bool isUpdateIntOver() const | 143 | inline bool isUpdateIntOver() const |
144 | { | 144 | { |
145 | if (updateInt == 0 || | 145 | if (updateInt == 0 || |
146 | update.isNull()) | 146 | update.isNull()) |
147 | return false; | 147 | return false; |
148 | QDateTime d(update); | 148 | QDateTime d(update); |
149 | return (d.addSecs(updateInt * 60) < QDateTime::currentDateTime()); | 149 | return (d.addSecs(updateInt * 60) < QDateTime::currentDateTime()); |
150 | } | 150 | } |
151 | }; | 151 | }; |
152 | 152 | ||
153 | struct PwMDataItem | 153 | struct PwMDataItem |
154 | { | 154 | { |
155 | PwMDataItem() | 155 | PwMDataItem() |
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index b308b40..3993fa8 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp | |||
@@ -1,134 +1,135 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 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 "pwmdocui.h" | 20 | #include "pwmdocui.h" |
21 | #include "setmasterpwwndimpl.h" | 21 | #include "setmasterpwwndimpl.h" |
22 | #include "getmasterpwwndimpl.h" | 22 | #include "getmasterpwwndimpl.h" |
23 | #include "pwmexception.h" | 23 | #include "pwmexception.h" |
24 | #include "getkeycardwnd.h" | 24 | #include "getkeycardwnd.h" |
25 | #include "pwm.h" | 25 | #include "pwm.h" |
26 | #include "globalstuff.h" | 26 | #include "globalstuff.h" |
27 | #include "spinforsignal.h" | 27 | #include "spinforsignal.h" |
28 | 28 | ||
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | 31 | ||
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
34 | 34 | ||
35 | #ifndef PWM_EMBEDDED | 35 | #ifndef PWM_EMBEDDED |
36 | #include <kwin.h> | 36 | #include <kwin.h> |
37 | #else | 37 | #else |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include "pwmprefs.h" | ||
39 | #endif | 40 | #endif |
40 | 41 | ||
41 | 42 | ||
42 | #ifdef CONFIG_KEYCARD | 43 | #ifdef CONFIG_KEYCARD |
43 | # include "pwmkeycard.h" | 44 | # include "pwmkeycard.h" |
44 | #endif | 45 | #endif |
45 | 46 | ||
46 | 47 | ||
47 | PwMDocUi::PwMDocUi(QObject *parent, const char *name) | 48 | PwMDocUi::PwMDocUi(QObject *parent, const char *name) |
48 | : QObject(parent, name) | 49 | : QObject(parent, name) |
49 | { | 50 | { |
50 | currentView = 0; | 51 | currentView = 0; |
51 | keyCard = 0; | 52 | keyCard = 0; |
52 | } | 53 | } |
53 | 54 | ||
54 | PwMDocUi::~PwMDocUi() | 55 | PwMDocUi::~PwMDocUi() |
55 | { | 56 | { |
56 | } | 57 | } |
57 | 58 | ||
58 | QString PwMDocUi::requestMpw(bool chipcard) | 59 | QString PwMDocUi::requestMpw(bool chipcard) |
59 | { | 60 | { |
60 | QString pw; | 61 | QString pw; |
61 | 62 | ||
62 | if (chipcard) { | 63 | if (chipcard) { |
63 | #ifdef CONFIG_KEYCARD | 64 | #ifdef CONFIG_KEYCARD |
64 | PWM_ASSERT(keyCard); | 65 | PWM_ASSERT(keyCard); |
65 | uint32_t id; | 66 | uint32_t id; |
66 | string ret; | 67 | string ret; |
67 | SpinForSignal *spinner = keyCard->getSpinner(); | 68 | SpinForSignal *spinner = keyCard->getSpinner(); |
68 | connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), | 69 | connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), |
69 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); | 70 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); |
70 | keyCard->getKey(); | 71 | keyCard->getKey(); |
71 | spinner->spin(&id, &ret); | 72 | spinner->spin(&id, &ret); |
72 | disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), | 73 | disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), |
73 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); | 74 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); |
74 | if (ret == "") | 75 | if (ret == "") |
75 | return ""; | 76 | return ""; |
76 | pw = ret.c_str(); | 77 | pw = ret.c_str(); |
77 | #else // CONFIG_KEYCARD | 78 | #else // CONFIG_KEYCARD |
78 | no_keycard_support_msg_box(currentView); | 79 | no_keycard_support_msg_box(currentView); |
79 | #endif // CONFIG_KEYCARD | 80 | #endif // CONFIG_KEYCARD |
80 | } else { | 81 | } else { |
81 | GetMasterPwWndImpl pwWnd; | 82 | GetMasterPwWndImpl pwWnd; |
82 | #ifndef PWM_EMBEDDED | 83 | #ifndef PWM_EMBEDDED |
83 | KWin::setState(pwWnd.winId(), NET::StaysOnTop); | 84 | KWin::setState(pwWnd.winId(), NET::StaysOnTop); |
84 | #endif | 85 | #endif |
85 | if (pwWnd.exec() != 1) | 86 | if (pwWnd.exec() != 1) |
86 | return ""; | 87 | return ""; |
87 | pw = pwWnd.pwLineEdit->text(); | 88 | pw = pwWnd.pwLineEdit->text(); |
88 | } | 89 | } |
89 | 90 | ||
90 | return pw; | 91 | return pw; |
91 | } | 92 | } |
92 | 93 | ||
93 | QString PwMDocUi::requestNewMpw(bool *chipcard) | 94 | QString PwMDocUi::requestNewMpw(bool *chipcard) |
94 | { | 95 | { |
95 | QString pw; | 96 | QString pw; |
96 | SetMasterPwWndImpl pwWnd(currentView); | 97 | SetMasterPwWndImpl pwWnd(currentView); |
97 | pwWnd.setPwMKeyCard(keyCard); | 98 | pwWnd.setPwMKeyCard(keyCard); |
98 | #ifndef PWM_EMBEDDED | 99 | #ifndef PWM_EMBEDDED |
99 | if (!chipcard) { | 100 | if (!chipcard) { |
100 | pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); | 101 | pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); |
101 | } | 102 | } |
102 | #else | 103 | #else |
103 | qDebug("PwMDocUi::requestNewMpw must be implemented"); | 104 | qDebug("PwMDocUi::requestNewMpw must be implemented"); |
104 | #endif | 105 | #endif |
105 | 106 | ||
106 | if (pwWnd.exec() != 1) | 107 | if (pwWnd.exec() != 1) |
107 | return ""; | 108 | return ""; |
108 | pw = pwWnd.getPw(chipcard).c_str(); | 109 | pw = pwWnd.getPw(chipcard).c_str(); |
109 | 110 | ||
110 | return pw; | 111 | return pw; |
111 | } | 112 | } |
112 | 113 | ||
113 | QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) | 114 | QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) |
114 | { | 115 | { |
115 | QString pw(requestMpw(*chipcard)); | 116 | QString pw(requestMpw(*chipcard)); |
116 | if (pw == "") | 117 | if (pw == "") |
117 | return ""; | 118 | return ""; |
118 | if (pw != *currentPw) { | 119 | if (pw != *currentPw) { |
119 | wrongMpwMsgBox(*chipcard); | 120 | wrongMpwMsgBox(*chipcard); |
120 | return ""; | 121 | return ""; |
121 | } | 122 | } |
122 | 123 | ||
123 | pw = requestNewMpw(chipcard); | 124 | pw = requestNewMpw(chipcard); |
124 | if (pw == "") | 125 | if (pw == "") |
125 | return ""; | 126 | return ""; |
126 | return pw; | 127 | return pw; |
127 | } | 128 | } |
128 | 129 | ||
129 | void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) | 130 | void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) |
130 | { | 131 | { |
131 | QString msg; | 132 | QString msg; |
132 | if (prefix != "") { | 133 | if (prefix != "") { |
133 | msg += prefix; | 134 | msg += prefix; |
134 | msg += "\n"; | 135 | msg += "\n"; |
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index 2f1aa4e..8946443 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -1,244 +1,261 @@ | |||
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 "pwminit.h" | 20 | #include "pwminit.h" |
21 | #include "configuration.h" | ||
22 | #include "randomizer.h" | 21 | #include "randomizer.h" |
23 | 22 | ||
24 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
25 | #include "selftest.h" | 24 | #include "selftest.h" |
25 | #include "configuration.h" | ||
26 | #else | ||
27 | #include "pwmprefs.h" | ||
26 | #endif | 28 | #endif |
27 | 29 | ||
28 | #include "pwm.h" | 30 | #include "pwm.h" |
29 | #include "pwmexception.h" | 31 | #include "pwmexception.h" |
30 | #include "pwmtray.h" | 32 | #include "pwmtray.h" |
31 | #include "pwmdoc.h" | 33 | #include "pwmdoc.h" |
32 | 34 | ||
33 | #ifdef CONFIG_KWALLETIF | 35 | #ifdef CONFIG_KWALLETIF |
34 | # include "kwalletemu.h" | 36 | # include "kwalletemu.h" |
35 | #endif // CONFIG_KWALLETIF | 37 | #endif // CONFIG_KWALLETIF |
36 | #ifdef CONFIG_KEYCARD | 38 | #ifdef CONFIG_KEYCARD |
37 | # include "pwmkeycard.h" | 39 | # include "pwmkeycard.h" |
38 | #endif // CONFIG_KEYCARD | 40 | #endif // CONFIG_KEYCARD |
39 | 41 | ||
40 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
41 | 43 | ||
42 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
43 | #ifndef PWM_EMBEDDED | 45 | #ifndef PWM_EMBEDDED |
44 | #include <kcmdlineargs.h> | 46 | #include <kcmdlineargs.h> |
45 | #include <kwin.h> | 47 | #include <kwin.h> |
46 | #include <dcopclient.h> | 48 | #include <dcopclient.h> |
47 | #endif | 49 | #endif |
48 | 50 | ||
49 | #include <kapplication.h> | 51 | #include <kapplication.h> |
50 | #include <kiconloader.h> | 52 | #include <kiconloader.h> |
51 | 53 | ||
52 | #include <signal.h> | 54 | #include <signal.h> |
53 | 55 | ||
54 | static PwMInit *sig_init_pointer; | 56 | static PwMInit *sig_init_pointer; |
55 | static NOREGPARM void sig_handler(int signum) | 57 | static NOREGPARM void sig_handler(int signum) |
56 | { | 58 | { |
57 | switch (signum) { | 59 | switch (signum) { |
58 | case SIGINT: | 60 | case SIGINT: |
59 | case SIGTERM: | 61 | case SIGTERM: |
60 | sig_init_pointer->shutdownApp(20 + signum); | 62 | sig_init_pointer->shutdownApp(20 + signum); |
61 | break; | 63 | break; |
62 | default: | 64 | default: |
63 | printDebug(string("unhandled signal ") | 65 | printDebug(string("unhandled signal ") |
64 | + tostr(signum)); | 66 | + tostr(signum)); |
65 | } | 67 | } |
66 | } | 68 | } |
67 | 69 | ||
68 | 70 | ||
69 | 71 | ||
70 | 72 | ||
71 | PwMInit::PwMInit(PwMApplication *_app) | 73 | PwMInit::PwMInit(PwMApplication *_app) |
72 | : runStatus (unknown) | 74 | : runStatus (unknown) |
73 | , _curWidget (0) | 75 | , _curWidget (0) |
74 | , _dcopClient (0) | 76 | , _dcopClient (0) |
75 | , _kwalletEmu (0) | 77 | , _kwalletEmu (0) |
76 | , _keycard (0) | 78 | , _keycard (0) |
77 | , _tray (0) | 79 | , _tray (0) |
78 | { | 80 | { |
79 | sig_init_pointer = this; | 81 | sig_init_pointer = this; |
80 | app = _app; | 82 | app = _app; |
81 | } | 83 | } |
82 | 84 | ||
83 | PwMInit::~PwMInit() | 85 | PwMInit::~PwMInit() |
84 | { | 86 | { |
85 | #ifndef PWM_EMBEDDED | 87 | #ifndef PWM_EMBEDDED |
86 | SelfTest::cancel(); | 88 | SelfTest::cancel(); |
87 | // close all open mainwnds | 89 | // close all open mainwnds |
88 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 90 | QValueList<PwM *>::iterator i = _mainWndList.begin(), |
89 | end = _mainWndList.end(); | 91 | end = _mainWndList.end(); |
90 | 92 | ||
91 | #else | 93 | #else |
92 | // close all open mainwnds | 94 | // close all open mainwnds |
93 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 95 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), |
94 | end = _mainWndList.end(); | 96 | end = _mainWndList.end(); |
95 | #endif | 97 | #endif |
96 | while (i != end) { | 98 | while (i != end) { |
97 | disconnect(*i, SIGNAL(closed(PwM *)), | 99 | disconnect(*i, SIGNAL(closed(PwM *)), |
98 | this, SLOT(mainWndClosed(PwM *))); | 100 | this, SLOT(mainWndClosed(PwM *))); |
99 | delete *i; | 101 | delete *i; |
100 | ++i; | 102 | ++i; |
101 | } | 103 | } |
102 | _mainWndList.clear(); | 104 | _mainWndList.clear(); |
103 | // close all remaining open documents | 105 | // close all remaining open documents |
104 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 106 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
105 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 107 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
106 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 108 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
107 | end2 = dl.end(); | 109 | end2 = dl.end(); |
108 | while (i2 != end2) { | 110 | while (i2 != end2) { |
109 | delete (*i2).doc; | 111 | delete (*i2).doc; |
110 | ++i2; | 112 | ++i2; |
111 | } | 113 | } |
112 | 114 | ||
113 | #ifdef CONFIG_KWALLETIF | 115 | #ifdef CONFIG_KWALLETIF |
114 | delete_ifnot_null(_kwalletEmu); | 116 | delete_ifnot_null(_kwalletEmu); |
115 | #endif // CONFIG_KWALLETIF | 117 | #endif // CONFIG_KWALLETIF |
116 | #ifdef CONFIG_KEYCARD | 118 | #ifdef CONFIG_KEYCARD |
117 | delete_ifnot_null(_keycard); | 119 | delete_ifnot_null(_keycard); |
118 | #endif // CONFIG_KEYCARD | 120 | #endif // CONFIG_KEYCARD |
119 | delete_ifnot_null(_tray); | 121 | delete_ifnot_null(_tray); |
120 | 122 | ||
121 | Randomizer::cleanup(); | 123 | Randomizer::cleanup(); |
124 | #ifndef PWM_EMBEDDED | ||
122 | Configuration::cleanup(); | 125 | Configuration::cleanup(); |
126 | #endif | ||
123 | } | 127 | } |
124 | 128 | ||
125 | void PwMInit::initializeApp() | 129 | void PwMInit::initializeApp() |
126 | { | 130 | { |
127 | PWM_ASSERT(runStatus == unknown); | 131 | PWM_ASSERT(runStatus == unknown); |
128 | runStatus = init; | 132 | runStatus = init; |
129 | initPosixSignalHandler(); | 133 | initPosixSignalHandler(); |
130 | Randomizer::init(); | 134 | Randomizer::init(); |
135 | #ifndef PWM_EMBEDDED | ||
131 | Configuration::init(); | 136 | Configuration::init(); |
137 | #endif | ||
132 | initDCOP(); | 138 | initDCOP(); |
133 | initKWalletEmu(); | 139 | initKWalletEmu(); |
134 | initKeycard(); | 140 | initKeycard(); |
135 | initTray(); | 141 | initTray(); |
136 | handleCmdLineArgs(); | 142 | handleCmdLineArgs(); |
137 | 143 | ||
138 | bool openDeeplocked = false; | 144 | bool openDeeplocked = false; |
139 | if (conf()->confGlobAutostartDeepLocked() || | 145 | if (conf()->confGlobAutostartDeepLocked() || |
140 | savedCmd.open_deeplocked) | 146 | savedCmd.open_deeplocked) |
141 | openDeeplocked = true; | 147 | openDeeplocked = true; |
142 | if (conf()->confWndAutoMinimizeOnStart() || | 148 | if (conf()->confWndAutoMinimizeOnStart() || |
143 | savedCmd.minToTray) { | 149 | savedCmd.minToTray) { |
144 | PwMDoc *newDoc = createDoc(); | 150 | PwMDoc *newDoc = createDoc(); |
145 | if (!newDoc->openDocUi(newDoc, | 151 | if (!newDoc->openDocUi(newDoc, |
146 | conf()->confGlobAutoStart(), | 152 | conf()->confGlobAutoStart(), |
147 | openDeeplocked)) { | 153 | openDeeplocked)) { |
148 | delete newDoc; | 154 | delete newDoc; |
155 | |||
156 | //US ENH for embedded devices: in the case of failure, open a document the default way | ||
157 | createMainWnd(conf()->confGlobAutoStart(), | ||
158 | openDeeplocked, | ||
159 | true, | ||
160 | 0, | ||
161 | savedCmd.minimized); | ||
162 | |||
163 | |||
164 | |||
165 | |||
149 | } | 166 | } |
150 | } else { | 167 | } else { |
151 | createMainWnd(conf()->confGlobAutoStart(), | 168 | createMainWnd(conf()->confGlobAutoStart(), |
152 | openDeeplocked, | 169 | openDeeplocked, |
153 | true, | 170 | true, |
154 | 0, | 171 | 0, |
155 | savedCmd.minimized); | 172 | savedCmd.minimized); |
156 | } | 173 | } |
157 | 174 | ||
158 | runStatus = running; | 175 | runStatus = running; |
159 | } | 176 | } |
160 | 177 | ||
161 | void PwMInit::shutdownApp(int exitStatus) | 178 | void PwMInit::shutdownApp(int exitStatus) |
162 | { | 179 | { |
163 | printDebug(string("PwMInit::shutdownApp(") | 180 | printDebug(string("PwMInit::shutdownApp(") |
164 | + tostr(exitStatus) + ") called."); | 181 | + tostr(exitStatus) + ") called."); |
165 | PWM_ASSERT((runStatus == running) || (runStatus == init)); | 182 | PWM_ASSERT((runStatus == running) || (runStatus == init)); |
166 | runStatus = shutdown; | 183 | runStatus = shutdown; |
167 | QApplication::exit(exitStatus); | 184 | QApplication::exit(exitStatus); |
168 | /* The destructor of PwMInit is called when control | 185 | /* The destructor of PwMInit is called when control |
169 | * leaves main() | 186 | * leaves main() |
170 | */ | 187 | */ |
171 | } | 188 | } |
172 | 189 | ||
173 | void PwMInit::initPosixSignalHandler() | 190 | void PwMInit::initPosixSignalHandler() |
174 | { | 191 | { |
175 | signal(SIGINT, sig_handler); | 192 | signal(SIGINT, sig_handler); |
176 | signal(SIGTERM, sig_handler); | 193 | signal(SIGTERM, sig_handler); |
177 | } | 194 | } |
178 | 195 | ||
179 | void PwMInit::initDCOP() | 196 | void PwMInit::initDCOP() |
180 | { | 197 | { |
181 | #ifndef PWM_EMBEDDED | 198 | #ifndef PWM_EMBEDDED |
182 | _dcopClient = app->dcopClient(); | 199 | _dcopClient = app->dcopClient(); |
183 | _dcopClient->setNotifications(true); | 200 | _dcopClient->setNotifications(true); |
184 | #endif | 201 | #endif |
185 | 202 | ||
186 | } | 203 | } |
187 | 204 | ||
188 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) | 205 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) |
189 | { | 206 | { |
190 | #ifdef CONFIG_KWALLETIF | 207 | #ifdef CONFIG_KWALLETIF |
191 | if (!conf()->confGlobKwalletEmu() || | 208 | if (!conf()->confGlobKwalletEmu() || |
192 | forceDisable) { | 209 | forceDisable) { |
193 | delete_ifnot_null(_kwalletEmu); | 210 | delete_ifnot_null(_kwalletEmu); |
194 | return; | 211 | return; |
195 | } | 212 | } |
196 | try { | 213 | try { |
197 | if (_kwalletEmu && forceReload) | 214 | if (_kwalletEmu && forceReload) |
198 | delete_and_null(_kwalletEmu); | 215 | delete_and_null(_kwalletEmu); |
199 | if (!_kwalletEmu) | 216 | if (!_kwalletEmu) |
200 | _kwalletEmu = new KWalletEmu(this); | 217 | _kwalletEmu = new KWalletEmu(this); |
201 | } catch (PwMException e) { | 218 | } catch (PwMException e) { |
202 | string errMsg("initializing KWallet emulation failed. ID: "); | 219 | string errMsg("initializing KWallet emulation failed. ID: "); |
203 | errMsg += tostr(static_cast<int>(e.getId())); | 220 | errMsg += tostr(static_cast<int>(e.getId())); |
204 | errMsg += " err-message: "; | 221 | errMsg += " err-message: "; |
205 | errMsg += e.getMessage(); | 222 | errMsg += e.getMessage(); |
206 | printWarn(errMsg); | 223 | printWarn(errMsg); |
207 | return; | 224 | return; |
208 | } | 225 | } |
209 | #else // CONFIG_KWALLETIF | 226 | #else // CONFIG_KWALLETIF |
210 | PARAM_UNUSED(forceDisable); | 227 | PARAM_UNUSED(forceDisable); |
211 | PARAM_UNUSED(forceReload); | 228 | PARAM_UNUSED(forceReload); |
212 | #endif // CONFIG_KWALLETIF | 229 | #endif // CONFIG_KWALLETIF |
213 | } | 230 | } |
214 | 231 | ||
215 | void PwMInit::initKeycard() | 232 | void PwMInit::initKeycard() |
216 | { | 233 | { |
217 | #ifdef CONFIG_KEYCARD | 234 | #ifdef CONFIG_KEYCARD |
218 | PWM_ASSERT(!_keycard); | 235 | PWM_ASSERT(!_keycard); |
219 | _keycard = new PwMKeyCard(this); | 236 | _keycard = new PwMKeyCard(this); |
220 | #endif // CONFIG_KEYCARD | 237 | #endif // CONFIG_KEYCARD |
221 | } | 238 | } |
222 | 239 | ||
223 | void PwMInit::initTray() | 240 | void PwMInit::initTray() |
224 | { | 241 | { |
225 | #ifdef PWM_EMBEDDED | 242 | #ifdef PWM_EMBEDDED |
226 | //US ENH : embedded version does not support a tray | 243 | //US ENH : embedded version does not support a tray |
227 | return; | 244 | return; |
228 | #endif | 245 | #endif |
229 | 246 | ||
230 | if (!conf()->confGlobTray()) { | 247 | if (!conf()->confGlobTray()) { |
231 | if (!_tray) | 248 | if (!_tray) |
232 | return; | 249 | return; |
233 | _tray->hide(); | 250 | _tray->hide(); |
234 | delete_and_null(_tray); | 251 | delete_and_null(_tray); |
235 | return; | 252 | return; |
236 | } | 253 | } |
237 | if (_tray) | 254 | if (_tray) |
238 | return; | 255 | return; |
239 | _tray = new PwMTray(this); | 256 | _tray = new PwMTray(this); |
240 | connect(_tray, SIGNAL(quitSelected()), | 257 | connect(_tray, SIGNAL(quitSelected()), |
241 | this, SLOT(removeTrayAndQuit())); | 258 | this, SLOT(removeTrayAndQuit())); |
242 | connect(_tray, SIGNAL(closed(PwMTray *)), | 259 | connect(_tray, SIGNAL(closed(PwMTray *)), |
243 | this, SLOT(trayIconClosed(PwMTray *))); | 260 | this, SLOT(trayIconClosed(PwMTray *))); |
244 | KIconLoader icons; | 261 | KIconLoader icons; |
diff --git a/pwmanager/pwmanager/pwmtray.cpp b/pwmanager/pwmanager/pwmtray.cpp index 0f286c1..fe074ca 100644 --- a/pwmanager/pwmanager/pwmtray.cpp +++ b/pwmanager/pwmanager/pwmtray.cpp | |||
@@ -1,124 +1,128 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * Original implementation of the tray-tree * | 6 | * Original implementation of the tray-tree * |
7 | * (c) by Matt Scifo <mscifo@o1.com> * | 7 | * (c) by Matt Scifo <mscifo@o1.com> * |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License version 2 * | 10 | * it under the terms of the GNU General Public License version 2 * |
11 | * as published by the Free Software Foundation. * | 11 | * as published by the Free Software Foundation. * |
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 "pwmtray.h" | 23 | #include "pwmtray.h" |
24 | #include "pwmexception.h" | 24 | #include "pwmexception.h" |
25 | #include "pwm.h" | 25 | #include "pwm.h" |
26 | #include "pwmdoc.h" | 26 | #include "pwmdoc.h" |
27 | #include "pwminit.h" | 27 | #include "pwminit.h" |
28 | #ifndef PWM_EMBEDDED | ||
28 | #include "configuration.h" | 29 | #include "configuration.h" |
30 | #else | ||
31 | #include "pwmprefs.h" | ||
32 | #endif | ||
29 | 33 | ||
30 | #include <klocale.h> | 34 | #include <klocale.h> |
31 | 35 | ||
32 | 36 | ||
33 | void ActiveTreeItem::execIt() | 37 | void ActiveTreeItem::execIt() |
34 | { | 38 | { |
35 | #ifndef PWM_EMBEDDED | 39 | #ifndef PWM_EMBEDDED |
36 | unsigned int entr = static_cast<unsigned int>(entry); | 40 | unsigned int entr = static_cast<unsigned int>(entry); |
37 | unsigned int cat = static_cast<unsigned int>(category); | 41 | unsigned int cat = static_cast<unsigned int>(category); |
38 | #else | 42 | #else |
39 | unsigned int entr = (unsigned int)(entry); | 43 | unsigned int entr = (unsigned int)(entry); |
40 | unsigned int cat = (unsigned int)(category); | 44 | unsigned int cat = (unsigned int)(category); |
41 | #endif | 45 | #endif |
42 | switch (task) { | 46 | switch (task) { |
43 | case pwToClipboard: { | 47 | case pwToClipboard: { |
44 | PwMDataItem d; | 48 | PwMDataItem d; |
45 | doc->getDataChangedLock(); | 49 | doc->getDataChangedLock(); |
46 | bool wasLocked = doc->isLocked(cat, entr); | 50 | bool wasLocked = doc->isLocked(cat, entr); |
47 | doc->getEntry(cat, entr, &d, true); | 51 | doc->getEntry(cat, entr, &d, true); |
48 | if (wasLocked) | 52 | if (wasLocked) |
49 | doc->lockAt(cat, entr, true); | 53 | doc->lockAt(cat, entr, true); |
50 | doc->putDataChangedLock(); | 54 | doc->putDataChangedLock(); |
51 | PwM::copyToClipboard(d.pw.c_str()); | 55 | PwM::copyToClipboard(d.pw.c_str()); |
52 | break; | 56 | break; |
53 | } case nameToClipboard: { | 57 | } case nameToClipboard: { |
54 | PwMDataItem d; | 58 | PwMDataItem d; |
55 | doc->getEntry(cat, entr, &d); | 59 | doc->getEntry(cat, entr, &d); |
56 | PwM::copyToClipboard(d.name.c_str()); | 60 | PwM::copyToClipboard(d.name.c_str()); |
57 | break; | 61 | break; |
58 | } case descToClipboard: { | 62 | } case descToClipboard: { |
59 | PwMDataItem d; | 63 | PwMDataItem d; |
60 | doc->getEntry(cat, entr, &d); | 64 | doc->getEntry(cat, entr, &d); |
61 | PwM::copyToClipboard(d.desc.c_str()); | 65 | PwM::copyToClipboard(d.desc.c_str()); |
62 | break; | 66 | break; |
63 | } case urlToClipboard: { | 67 | } case urlToClipboard: { |
64 | PwMDataItem d; | 68 | PwMDataItem d; |
65 | doc->getEntry(cat, entr, &d); | 69 | doc->getEntry(cat, entr, &d); |
66 | PwM::copyToClipboard(d.url.c_str()); | 70 | PwM::copyToClipboard(d.url.c_str()); |
67 | break; | 71 | break; |
68 | } case launcherToClipboard: { | 72 | } case launcherToClipboard: { |
69 | PwMDataItem d; | 73 | PwMDataItem d; |
70 | doc->getEntry(cat, entr, &d); | 74 | doc->getEntry(cat, entr, &d); |
71 | PwM::copyToClipboard(d.launcher.c_str()); | 75 | PwM::copyToClipboard(d.launcher.c_str()); |
72 | break; | 76 | break; |
73 | } case commentToClipboard: { | 77 | } case commentToClipboard: { |
74 | PwMDataItem d; | 78 | PwMDataItem d; |
75 | doc->getEntry(cat, entr, &d); | 79 | doc->getEntry(cat, entr, &d); |
76 | PwM::copyToClipboard(d.comment.c_str()); | 80 | PwM::copyToClipboard(d.comment.c_str()); |
77 | break; | 81 | break; |
78 | } case execLauncher: { | 82 | } case execLauncher: { |
79 | doc->execLauncher(cat, entr); | 83 | doc->execLauncher(cat, entr); |
80 | break; | 84 | break; |
81 | } case goToURL: { | 85 | } case goToURL: { |
82 | doc->goToURL(cat, entr); | 86 | doc->goToURL(cat, entr); |
83 | break; | 87 | break; |
84 | } case openMainWnd: { | 88 | } case openMainWnd: { |
85 | // search if there is already an open window. | 89 | // search if there is already an open window. |
86 | const QValueList<PwM *> *wl = tray->init->mainWndList(); | 90 | const QValueList<PwM *> *wl = tray->init->mainWndList(); |
87 | #ifndef PWM_EMBEDDED | 91 | #ifndef PWM_EMBEDDED |
88 | QValueList<PwM *>::const_iterator i = wl->begin(), | 92 | QValueList<PwM *>::const_iterator i = wl->begin(), |
89 | end = wl->end(); | 93 | end = wl->end(); |
90 | #else | 94 | #else |
91 | QValueList<PwM *>::ConstIterator i = wl->begin(), | 95 | QValueList<PwM *>::ConstIterator i = wl->begin(), |
92 | end = wl->end(); | 96 | end = wl->end(); |
93 | #endif | 97 | #endif |
94 | PwM *wnd; | 98 | PwM *wnd; |
95 | while (i != end) { | 99 | while (i != end) { |
96 | wnd = *i; | 100 | wnd = *i; |
97 | if (wnd->curDoc() == doc) { | 101 | if (wnd->curDoc() == doc) { |
98 | // now bring this window to the foreground. | 102 | // now bring this window to the foreground. |
99 | if (!wnd->hasFocus()) { | 103 | if (!wnd->hasFocus()) { |
100 | wnd->hide(); | 104 | wnd->hide(); |
101 | wnd->showNormal(); | 105 | wnd->showNormal(); |
102 | wnd->setFocus(); | 106 | wnd->setFocus(); |
103 | } | 107 | } |
104 | return; | 108 | return; |
105 | } | 109 | } |
106 | ++i; | 110 | ++i; |
107 | } | 111 | } |
108 | // there is no open window, so open a new one. | 112 | // there is no open window, so open a new one. |
109 | tray->init->createMainWnd(QString::null, false, false, doc); | 113 | tray->init->createMainWnd(QString::null, false, false, doc); |
110 | break; | 114 | break; |
111 | } case closeDoc: { | 115 | } case closeDoc: { |
112 | doc->tryDelete(); | 116 | doc->tryDelete(); |
113 | break; | 117 | break; |
114 | } case lock: { | 118 | } case lock: { |
115 | doc->lockAll(true); | 119 | doc->lockAll(true); |
116 | break; | 120 | break; |
117 | } case deepLock: { | 121 | } case deepLock: { |
118 | doc->deepLock(); | 122 | doc->deepLock(); |
119 | break; | 123 | break; |
120 | } case unlock: { | 124 | } case unlock: { |
121 | doc->lockAll(false); | 125 | doc->lockAll(false); |
122 | break; | 126 | break; |
123 | } default: { | 127 | } default: { |
124 | BUG(); | 128 | BUG(); |
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index c09fbf5..58c2fca 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp | |||
@@ -1,121 +1,125 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 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 "pwmview.h" | 20 | #include "pwmview.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "globalstuff.h" | 22 | #include "globalstuff.h" |
23 | #include "pwm.h" | 23 | #include "pwm.h" |
24 | #include "rencatwnd.h" | 24 | #include "rencatwnd.h" |
25 | #ifndef PWM_EMBEDDED | ||
25 | #include "configuration.h" | 26 | #include "configuration.h" |
27 | #else | ||
28 | #include "pwmprefs.h" | ||
29 | #endif | ||
26 | #include "commentbox.h" | 30 | #include "commentbox.h" |
27 | 31 | ||
28 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
29 | #include <klocale.h> | 33 | #include <klocale.h> |
30 | 34 | ||
31 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
32 | #include <qpoint.h> | 36 | #include <qpoint.h> |
33 | #include <qapplication.h> | 37 | #include <qapplication.h> |
34 | 38 | ||
35 | #define COLUMN_DESC 0 | 39 | #define COLUMN_DESC 0 |
36 | #define COLUMN_NAME 1 | 40 | #define COLUMN_NAME 1 |
37 | #define COLUMN_PW 2 | 41 | #define COLUMN_PW 2 |
38 | #define COLUMN_URL 3 | 42 | #define COLUMN_URL 3 |
39 | #define COLUMN_LAUNCHER 4 | 43 | #define COLUMN_LAUNCHER 4 |
40 | 44 | ||
41 | 45 | ||
42 | PwMView::PwMView(PwM *_mainClass, | 46 | PwMView::PwMView(PwM *_mainClass, |
43 | QWidget *parent, PwMDoc *_doc, | 47 | QWidget *parent, PwMDoc *_doc, |
44 | const char *name) | 48 | const char *name) |
45 | : PwMViewStyle(parent, name) | 49 | : PwMViewStyle(parent, name) |
46 | { | 50 | { |
47 | PWM_ASSERT(_mainClass); | 51 | PWM_ASSERT(_mainClass); |
48 | PWM_ASSERT(parent); | 52 | PWM_ASSERT(parent); |
49 | PWM_ASSERT(_doc); | 53 | PWM_ASSERT(_doc); |
50 | setView(this); | 54 | setView(this); |
51 | doc = _doc; | 55 | doc = _doc; |
52 | doc->setListViewPointer(this); | 56 | doc->setListViewPointer(this); |
53 | mainClass = _mainClass; | 57 | mainClass = _mainClass; |
54 | resize(_mainClass->size()); | 58 | resize(_mainClass->size()); |
55 | initStyle(conf()->confWndMainViewStyle()); | 59 | initStyle(conf()->confWndMainViewStyle()); |
56 | initCtxMenu(); | 60 | initCtxMenu(); |
57 | doc->setCurrentView(this); | 61 | doc->setCurrentView(this); |
58 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); | 62 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); |
59 | } | 63 | } |
60 | 64 | ||
61 | PwMView::~PwMView() | 65 | PwMView::~PwMView() |
62 | { | 66 | { |
63 | } | 67 | } |
64 | 68 | ||
65 | void PwMView::initCtxMenu() | 69 | void PwMView::initCtxMenu() |
66 | { | 70 | { |
67 | ctxMenu = new QPopupMenu(this); | 71 | ctxMenu = new QPopupMenu(this); |
68 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); | 72 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); |
69 | ctxMenu->insertSeparator(); | 73 | ctxMenu->insertSeparator(); |
70 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); | 74 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); |
71 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); | 75 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); |
72 | ctxMenu->insertSeparator(); | 76 | ctxMenu->insertSeparator(); |
73 | ctxMenu->insertItem(i18n("copy password to clipboard"), | 77 | ctxMenu->insertItem(i18n("copy password to clipboard"), |
74 | this, SLOT(copyPwToClip())); | 78 | this, SLOT(copyPwToClip())); |
75 | ctxMenu->insertItem(i18n("copy username to clipboard"), | 79 | ctxMenu->insertItem(i18n("copy username to clipboard"), |
76 | this, SLOT(copyNameToClip())); | 80 | this, SLOT(copyNameToClip())); |
77 | ctxMenu->insertItem(i18n("copy description to clipboard"), | 81 | ctxMenu->insertItem(i18n("copy description to clipboard"), |
78 | this, SLOT(copyDescToClip())); | 82 | this, SLOT(copyDescToClip())); |
79 | ctxMenu->insertItem(i18n("copy url to clipboard"), | 83 | ctxMenu->insertItem(i18n("copy url to clipboard"), |
80 | this, SLOT(copyUrlToClip())); | 84 | this, SLOT(copyUrlToClip())); |
81 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), | 85 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), |
82 | this, SLOT(copyLauncherToClip())); | 86 | this, SLOT(copyLauncherToClip())); |
83 | ctxMenu->insertItem(i18n("copy comment to clipboard"), | 87 | ctxMenu->insertItem(i18n("copy comment to clipboard"), |
84 | this, SLOT(copyCommentToClip())); | 88 | this, SLOT(copyCommentToClip())); |
85 | ctxMenu->insertSeparator(); | 89 | ctxMenu->insertSeparator(); |
86 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, | 90 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, |
87 | SLOT(execLauncher_slot())); | 91 | SLOT(execLauncher_slot())); |
88 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, | 92 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, |
89 | SLOT(goToURL_slot())); | 93 | SLOT(goToURL_slot())); |
90 | } | 94 | } |
91 | 95 | ||
92 | void PwMView::resizeEvent(QResizeEvent *) | 96 | void PwMView::resizeEvent(QResizeEvent *) |
93 | { | 97 | { |
94 | resizeView(size()); | 98 | resizeView(size()); |
95 | } | 99 | } |
96 | 100 | ||
97 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) | 101 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) |
98 | { | 102 | { |
99 | PWM_ASSERT(commentBox); | 103 | PWM_ASSERT(commentBox); |
100 | if (!curItem) | 104 | if (!curItem) |
101 | return; | 105 | return; |
102 | string comment; | 106 | string comment; |
103 | PwMerror ret; | 107 | PwMerror ret; |
104 | ret = document()->getCommentByLvp(getCurrentCategory(), | 108 | ret = document()->getCommentByLvp(getCurrentCategory(), |
105 | lv->childCount() - lv->itemIndex(curItem) - 1, | 109 | lv->childCount() - lv->itemIndex(curItem) - 1, |
106 | &comment); | 110 | &comment); |
107 | if (ret == e_binEntry) { | 111 | if (ret == e_binEntry) { |
108 | commentBox->setContent(i18n("This is a binary entry.\n" | 112 | commentBox->setContent(i18n("This is a binary entry.\n" |
109 | "It is not a normal password-entry, as it contains " | 113 | "It is not a normal password-entry, as it contains " |
110 | "binary data, which PwManager can't display here.")); | 114 | "binary data, which PwManager can't display here.")); |
111 | } else if (ret == e_normalEntry) { | 115 | } else if (ret == e_normalEntry) { |
112 | commentBox->setContent(comment.c_str()); | 116 | commentBox->setContent(comment.c_str()); |
113 | } else { | 117 | } else { |
114 | BUG(); | 118 | BUG(); |
115 | return; | 119 | return; |
116 | } | 120 | } |
117 | lv->ensureItemVisible(curItem); | 121 | lv->ensureItemVisible(curItem); |
118 | } | 122 | } |
119 | 123 | ||
120 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) | 124 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) |
121 | { | 125 | { |
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 65e442d..f29ef6c 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp | |||
@@ -1,120 +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 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 2.0 of pwmanager | 15 | * This file is originaly based on version 2.0 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #include "serializer.h" | 21 | #include "serializer.h" |
22 | #include "pwmexception.h" | 22 | #include "pwmexception.h" |
23 | 23 | ||
24 | #ifdef PWM_EMBEDDED | 24 | #ifdef PWM_EMBEDDED |
25 | #include <kglobal.h> | ||
25 | #include <klocale.h> | 26 | #include <klocale.h> |
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | /* enable/disable serializer debugging (0/1) */ | 29 | /* enable/disable serializer debugging (0/1) */ |
29 | #define SERIALIZER_DEBUG0 | 30 | #define SERIALIZER_DEBUG0 |
30 | /* use the old xml tags for writing (0/1) */ | 31 | /* use the old xml tags for writing (0/1) */ |
31 | #define USE_OLD_TAGS 0 | 32 | #define USE_OLD_TAGS 0 |
32 | /* write a CDATA section (0/1) */ | 33 | /* write a CDATA section (0/1) */ |
33 | #define WRITE_CDATA_SEC 0 | 34 | #define WRITE_CDATA_SEC 0 |
34 | 35 | ||
35 | 36 | ||
36 | #define META_CREATE_DATE"c" | 37 | #define META_CREATE_DATE"c" |
37 | #define META_VALID_DATE "v" | 38 | #define META_VALID_DATE "v" |
38 | #define META_EXPIRE_DATE"e" | 39 | #define META_EXPIRE_DATE"e" |
39 | #define META_UPDATE_DATE"u" | 40 | #define META_UPDATE_DATE"u" |
40 | #define META_UPDATE_INT "i" | 41 | #define META_UPDATE_INT "i" |
41 | //US ENH : uniqueid | 42 | //US ENH : uniqueid |
42 | #define META_UNIQUEID "n" | 43 | #define META_UNIQUEID "n" |
43 | 44 | ||
44 | /* This is compatibility stuff. | 45 | /* This is compatibility stuff. |
45 | * The names of the entries have changed and here are the | 46 | * The names of the entries have changed and here are the |
46 | * new and old ones | 47 | * new and old ones |
47 | */ | 48 | */ |
48 | #define ROOT_MAGIC_OLD "PwM-xml-dat" | 49 | #define ROOT_MAGIC_OLD "PwM-xml-dat" |
49 | #define VER_STR_OLD "ver" | 50 | #define VER_STR_OLD "ver" |
50 | #define COMPAT_VER_OLD "0x02" | 51 | #define COMPAT_VER_OLD "0x02" |
51 | #define CAT_ROOT_OLD "categories" | 52 | #define CAT_ROOT_OLD "categories" |
52 | #define CAT_PREFIX_OLD "cat_" | 53 | #define CAT_PREFIX_OLD "cat_" |
53 | #define CAT_NAME_OLD "name" | 54 | #define CAT_NAME_OLD "name" |
54 | #define ENTRY_PREFIX_OLD"entry_" | 55 | #define ENTRY_PREFIX_OLD"entry_" |
55 | #define ENTRY_DESC_OLD "desc" | 56 | #define ENTRY_DESC_OLD "desc" |
56 | #define ENTRY_NAME_OLD "name" | 57 | #define ENTRY_NAME_OLD "name" |
57 | #define ENTRY_PW_OLD "pw" | 58 | #define ENTRY_PW_OLD "pw" |
58 | #define ENTRY_COMMENT_OLD"comment" | 59 | #define ENTRY_COMMENT_OLD"comment" |
59 | #define ENTRY_URL_OLD "url" | 60 | #define ENTRY_URL_OLD "url" |
60 | #define ENTRY_LAUNCHER_OLD"launcher" | 61 | #define ENTRY_LAUNCHER_OLD"launcher" |
61 | #define ENTRY_LVP_OLD "listViewPos" | 62 | #define ENTRY_LVP_OLD "listViewPos" |
62 | #define ENTRY_BIN_OLD "b" | 63 | #define ENTRY_BIN_OLD "b" |
63 | #define ENTRY_META_OLD "m" | 64 | #define ENTRY_META_OLD "m" |
64 | 65 | ||
65 | #define ROOT_MAGIC_NEW "P" | 66 | #define ROOT_MAGIC_NEW "P" |
66 | #define VER_STR_NEW "v" | 67 | #define VER_STR_NEW "v" |
67 | #define COMPAT_VER_NEW "2" | 68 | #define COMPAT_VER_NEW "2" |
68 | #define CAT_ROOT_NEW "c" | 69 | #define CAT_ROOT_NEW "c" |
69 | #define CAT_PREFIX_NEW "c" | 70 | #define CAT_PREFIX_NEW "c" |
70 | #define CAT_NAME_NEW "n" | 71 | #define CAT_NAME_NEW "n" |
71 | #define ENTRY_PREFIX_NEW"e" | 72 | #define ENTRY_PREFIX_NEW"e" |
72 | #define ENTRY_DESC_NEW "d" | 73 | #define ENTRY_DESC_NEW "d" |
73 | #define ENTRY_NAME_NEW "n" | 74 | #define ENTRY_NAME_NEW "n" |
74 | #define ENTRY_PW_NEW "p" | 75 | #define ENTRY_PW_NEW "p" |
75 | #define ENTRY_COMMENT_NEW"c" | 76 | #define ENTRY_COMMENT_NEW"c" |
76 | #define ENTRY_URL_NEW "u" | 77 | #define ENTRY_URL_NEW "u" |
77 | #define ENTRY_LAUNCHER_NEW"l" | 78 | #define ENTRY_LAUNCHER_NEW"l" |
78 | #define ENTRY_LVP_NEW "v" | 79 | #define ENTRY_LVP_NEW "v" |
79 | #define ENTRY_BIN_NEW ENTRY_BIN_OLD | 80 | #define ENTRY_BIN_NEW ENTRY_BIN_OLD |
80 | #define ENTRY_META_NEW ENTRY_META_OLD | 81 | #define ENTRY_META_NEW ENTRY_META_OLD |
81 | 82 | ||
82 | #if USE_OLD_TAGS != 0 | 83 | #if USE_OLD_TAGS != 0 |
83 | # define ROOT_MAGIC_WR ROOT_MAGIC_OLD | 84 | # define ROOT_MAGIC_WR ROOT_MAGIC_OLD |
84 | # define VER_STR_WR VER_STR_OLD | 85 | # define VER_STR_WR VER_STR_OLD |
85 | # define COMPAT_VER_WR COMPAT_VER_OLD | 86 | # define COMPAT_VER_WR COMPAT_VER_OLD |
86 | # define CAT_ROOT_WR CAT_ROOT_OLD | 87 | # define CAT_ROOT_WR CAT_ROOT_OLD |
87 | # define CAT_PREFIX_WR CAT_PREFIX_OLD | 88 | # define CAT_PREFIX_WR CAT_PREFIX_OLD |
88 | # define CAT_NAME_WR CAT_NAME_OLD | 89 | # define CAT_NAME_WR CAT_NAME_OLD |
89 | # define ENTRY_PREFIX_WRENTRY_PREFIX_OLD | 90 | # define ENTRY_PREFIX_WRENTRY_PREFIX_OLD |
90 | # define ENTRY_DESC_WR ENTRY_DESC_OLD | 91 | # define ENTRY_DESC_WR ENTRY_DESC_OLD |
91 | # define ENTRY_NAME_WR ENTRY_NAME_OLD | 92 | # define ENTRY_NAME_WR ENTRY_NAME_OLD |
92 | # define ENTRY_PW_WR ENTRY_PW_OLD | 93 | # define ENTRY_PW_WR ENTRY_PW_OLD |
93 | # define ENTRY_COMMENT_WRENTRY_COMMENT_OLD | 94 | # define ENTRY_COMMENT_WRENTRY_COMMENT_OLD |
94 | # define ENTRY_URL_WR ENTRY_URL_OLD | 95 | # define ENTRY_URL_WR ENTRY_URL_OLD |
95 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_OLD | 96 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_OLD |
96 | # define ENTRY_LVP_WR ENTRY_LVP_OLD | 97 | # define ENTRY_LVP_WR ENTRY_LVP_OLD |
97 | # define ENTRY_BIN_WR ENTRY_BIN_OLD | 98 | # define ENTRY_BIN_WR ENTRY_BIN_OLD |
98 | # define ENTRY_META_WR ENTRY_META_OLD | 99 | # define ENTRY_META_WR ENTRY_META_OLD |
99 | #else | 100 | #else |
100 | # define ROOT_MAGIC_WR ROOT_MAGIC_NEW | 101 | # define ROOT_MAGIC_WR ROOT_MAGIC_NEW |
101 | # define VER_STR_WR VER_STR_NEW | 102 | # define VER_STR_WR VER_STR_NEW |
102 | # define COMPAT_VER_WR COMPAT_VER_NEW | 103 | # define COMPAT_VER_WR COMPAT_VER_NEW |
103 | # define CAT_ROOT_WR CAT_ROOT_NEW | 104 | # define CAT_ROOT_WR CAT_ROOT_NEW |
104 | # define CAT_PREFIX_WR CAT_PREFIX_NEW | 105 | # define CAT_PREFIX_WR CAT_PREFIX_NEW |
105 | # define CAT_NAME_WR CAT_NAME_NEW | 106 | # define CAT_NAME_WR CAT_NAME_NEW |
106 | # define ENTRY_PREFIX_WRENTRY_PREFIX_NEW | 107 | # define ENTRY_PREFIX_WRENTRY_PREFIX_NEW |
107 | # define ENTRY_DESC_WR ENTRY_DESC_NEW | 108 | # define ENTRY_DESC_WR ENTRY_DESC_NEW |
108 | # define ENTRY_NAME_WR ENTRY_NAME_NEW | 109 | # define ENTRY_NAME_WR ENTRY_NAME_NEW |
109 | # define ENTRY_PW_WR ENTRY_PW_NEW | 110 | # define ENTRY_PW_WR ENTRY_PW_NEW |
110 | # define ENTRY_COMMENT_WRENTRY_COMMENT_NEW | 111 | # define ENTRY_COMMENT_WRENTRY_COMMENT_NEW |
111 | # define ENTRY_URL_WR ENTRY_URL_NEW | 112 | # define ENTRY_URL_WR ENTRY_URL_NEW |
112 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_NEW | 113 | # define ENTRY_LAUNCHER_WRENTRY_LAUNCHER_NEW |
113 | # define ENTRY_LVP_WR ENTRY_LVP_NEW | 114 | # define ENTRY_LVP_WR ENTRY_LVP_NEW |
114 | # define ENTRY_BIN_WR ENTRY_BIN_NEW | 115 | # define ENTRY_BIN_WR ENTRY_BIN_NEW |
115 | # define ENTRY_META_WR ENTRY_META_NEW | 116 | # define ENTRY_META_WR ENTRY_META_NEW |
116 | #endif | 117 | #endif |
117 | 118 | ||
118 | 119 | ||
119 | Serializer::Serializer() | 120 | Serializer::Serializer() |
120 | { | 121 | { |