summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdoc.cpp
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/pwmdoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp58
1 files changed, 57 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 1f15ffd..6fbe110 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -1241,7 +1241,6 @@ bool PwMDoc::getEntry(unsigned int category, unsigned int index,
1241 1241
1242 return true; 1242 return true;
1243} 1243}
1244
1245PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos, 1244PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
1246 string *foundComment) 1245 string *foundComment)
1247{ 1246{
@@ -1264,6 +1263,63 @@ PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
1264 return e_generic; 1263 return e_generic;
1265} 1264}
1266 1265
1266PwMerror PwMDoc::getCommentByLvp_long(const QString &category, int listViewPos,
1267 string *foundComment)
1268{
1269 PWM_ASSERT(foundComment);
1270 unsigned int cat = 0;
1271
1272 if (!findCategory(category, &cat))
1273 return e_invalidArg;
1274
1275 unsigned int i, entries = numEntries(cat);
1276 for (i = 0; i < entries; ++i) {
1277 if (dti.dta[cat].d[i].listViewPos == listViewPos) {
1278 if (dti.dta[cat].d[i].binary)
1279 return e_binEntry;
1280 PwMCategoryItem* catItem = getCategoryEntry(cat);
1281 QString retval;
1282 QString tempval = QString (dti.dta[cat].d[i].desc.c_str());
1283 if ( !tempval.isEmpty() ) {
1284 retval += "<b>" +QString ( catItem->desc_text.c_str() )+ ":</b> "+ tempval+"<br>" ;
1285 }
1286 tempval = QString (dti.dta[cat].d[i].name.c_str());
1287 if ( !tempval.isEmpty() ) {
1288 retval += "<b>" +QString ( catItem->name_text.c_str() ) + ":</b> "+ tempval+"<br>" ;
1289 }
1290 tempval = QString (dti.dta[cat].d[i].pw.c_str());
1291 if ( !tempval.isEmpty() ) {
1292 if ( dti.dta[cat].d[i].lockStat )
1293 retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + i18n("<LOCKED>") +"<br>" ;
1294 else
1295 retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + tempval+"<br>" ;
1296 }
1297 tempval = QString (dti.dta[cat].d[i].url.c_str());
1298 if ( !tempval.isEmpty() ) {
1299 retval += "<b>" +i18n("URL:")+ "</b> " + tempval+"<br>" ;
1300 }
1301 tempval = QString (dti.dta[cat].d[i].launcher.c_str());
1302 if ( !tempval.isEmpty() ) {
1303 retval += "<b>" +i18n("Launcher:")+ "</b> " + tempval+"<br>" ;
1304 }
1305 tempval = QString (dti.dta[cat].d[i].comment.c_str());
1306 if ( !tempval.isEmpty() ) {
1307 tempval.replace(QRegExp ( "\n" ), "<br>" );
1308 retval += "<b>" +i18n("Comment:")+ "</b><br>" + tempval+"<br>" ;
1309 }
1310
1311 string ret ( retval.latin1() );
1312
1313
1314 // *foundComment = dti.dta[cat].d[i].comment;
1315 *foundComment = ret;
1316 return e_normalEntry;
1317 }
1318 }
1319 BUG();
1320 return e_generic;
1321}
1322
1267bool PwMDoc::compressDta(string *d, char algo) 1323bool PwMDoc::compressDta(string *d, char algo)
1268{ 1324{
1269 PWM_ASSERT(d); 1325 PWM_ASSERT(d);