Changeset View
Changeset View
Standalone View
Standalone View
kgpgoptions.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | #include <QCheckBox> | 35 | #include <QCheckBox> | ||
36 | 36 | | |||
37 | #include <QFile> | 37 | #include <QFile> | ||
38 | #include <QFileDialog> | 38 | #include <QFileDialog> | ||
39 | #include <QInputDialog> | 39 | #include <QInputDialog> | ||
40 | #include <QTextStream> | 40 | #include <QTextStream> | ||
41 | #include <QVBoxLayout> | 41 | #include <QVBoxLayout> | ||
42 | #include <QRegularExpression> | ||||
42 | #include <QStandardPaths> | 43 | #include <QStandardPaths> | ||
43 | 44 | | |||
44 | using namespace KgpgCore; | 45 | using namespace KgpgCore; | ||
45 | 46 | | |||
46 | // main window | 47 | // main window | ||
47 | kgpgOptions::kgpgOptions(QWidget *parent, KGpgItemModel *model) | 48 | kgpgOptions::kgpgOptions(QWidget *parent, KGpgItemModel *model) | ||
48 | : KConfigDialog(parent, QLatin1String( "settings" ), KGpgSettings::self()), | 49 | : KConfigDialog(parent, QLatin1String( "settings" ), KGpgSettings::self()), | ||
49 | m_config(new KConfig( QLatin1String( "kgpgrc" ), KConfig::SimpleConfig)), | 50 | m_config(new KConfig( QLatin1String( "kgpgrc" ), KConfig::SimpleConfig)), | ||
Show All 26 Lines | 61 | { | |||
76 | // Read the default keyserver from the GnuPG settings. | 77 | // Read the default keyserver from the GnuPG settings. | ||
77 | keyServer = KgpgInterface::getGpgSetting(QLatin1String( "keyserver" ), KGpgSettings::gpgConfigPath()); | 78 | keyServer = KgpgInterface::getGpgSetting(QLatin1String( "keyserver" ), KGpgSettings::gpgConfigPath()); | ||
78 | 79 | | |||
79 | // Read the servers stored in kgpgrc | 80 | // Read the servers stored in kgpgrc | ||
80 | serverList = KGpgSettings::keyServers(); | 81 | serverList = KGpgSettings::keyServers(); | ||
81 | 82 | | |||
82 | // Remove everything after a whitespace. This will normally be | 83 | // Remove everything after a whitespace. This will normally be | ||
83 | // ' (Default)' from KDE 3.x.x | 84 | // ' (Default)' from KDE 3.x.x | ||
84 | serverList.replaceInStrings(QRegExp( QLatin1String( " .*") ), QString() ); | 85 | serverList.replaceInStrings(QRegularExpression( QStringLiteral( " .*") ), QString() ); | ||
dakon: Please remove the extra spaces here, and at a few other places below that you have touched. | |||||
ahmadsamir: I was matching the existing style.
Anyhow I changed them. :) | |||||
85 | 86 | | |||
86 | m_serverModel->setStringList(serverList); | 87 | m_serverModel->setStringList(serverList); | ||
87 | // if the server from GnuPG config is set and is not in the list of servers put it there | 88 | // if the server from GnuPG config is set and is not in the list of servers put it there | ||
88 | if (!keyServer.isEmpty() && !serverList.contains(keyServer)) | 89 | if (!keyServer.isEmpty() && !serverList.contains(keyServer)) | ||
89 | serverList.prepend(keyServer); | 90 | serverList.prepend(keyServer); | ||
90 | m_page6->ServerBox->setModel(m_serverModel); | 91 | m_page6->ServerBox->setModel(m_serverModel); | ||
91 | 92 | | |||
92 | defaultConfigPath = QUrl::fromLocalFile(gpgConfigPath).fileName(); | 93 | defaultConfigPath = QUrl::fromLocalFile(gpgConfigPath).fileName(); | ||
▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | 278 | { | |||
286 | 287 | | |||
287 | listKeys(); | 288 | listKeys(); | ||
288 | fileEncryptionKey = KGpgSettings::fileEncryptionKey(); | 289 | fileEncryptionKey = KGpgSettings::fileEncryptionKey(); | ||
289 | // the contents are totally mess. There were key id, name and email stored | 290 | // the contents are totally mess. There were key id, name and email stored | ||
290 | // try to extract the key id, that's the only thing we really need | 291 | // try to extract the key id, that's the only thing we really need | ||
291 | if (!fileEncryptionKey.isEmpty()) { | 292 | if (!fileEncryptionKey.isEmpty()) { | ||
292 | int idpos = m_page1->file_key->findText(fileEncryptionKey); | 293 | int idpos = m_page1->file_key->findText(fileEncryptionKey); | ||
293 | if (idpos == -1) { | 294 | if (idpos == -1) { | ||
294 | idpos = fileEncryptionKey.indexOf(QRegExp( QLatin1String( "([0-9A-Fa-F]{8})+" ))); | 295 | idpos = fileEncryptionKey.indexOf(QRegularExpression( QStringLiteral( "([0-9A-Fa-f]{8})+" ))); | ||
295 | if (idpos >= 0) { | 296 | if (idpos >= 0) { | ||
296 | QString fileId = fileEncryptionKey.mid(idpos); | 297 | QString fileId = fileEncryptionKey.mid(idpos); | ||
297 | idpos = fileId.indexOf(QRegExp( QLatin1String( "[^a-fA-F0-9]" ))); | 298 | idpos = fileId.indexOf(QRegularExpression( QStringLiteral( "[^a-fA-F0-9]" ))); | ||
298 | if (idpos >= 0) { | 299 | if (idpos >= 0) { | ||
299 | fileId.truncate(idpos); | 300 | fileId.truncate(idpos); | ||
300 | fileId.chop(fileId.length() % 8); | 301 | fileId.chop(fileId.length() % 8); | ||
301 | } | 302 | } | ||
302 | 303 | | |||
303 | KGpgKeyNode *anode = m_combomodel->getModel()->findKeyNode(fileId); | 304 | KGpgKeyNode *anode = m_combomodel->getModel()->findKeyNode(fileId); | ||
304 | 305 | | |||
305 | if (anode != nullptr) | 306 | if (anode != nullptr) | ||
▲ Show 20 Lines • Show All 303 Lines • Show Last 20 Lines |
Please remove the extra spaces here, and at a few other places below that you have touched.