456
456
setAutoSaveSettings(cg, true);
457
457
applyMainWindowSettings(cg);
459
connect(s_kgpgEditor, SIGNAL(refreshImported(QStringList)), imodel, SLOT(refreshKeys(QStringList)));
460
459
connect(this, SIGNAL(fontChanged(QFont)), s_kgpgEditor, SLOT(slotSetFont(QFont)));
462
461
m_netnote = Solid::Networking::notifier();
528
527
KgpgEditor *kgpgtxtedit = new KgpgEditor(this, imodel, Qt::Window);
530
connect(kgpgtxtedit, SIGNAL(refreshImported(QStringList)), imodel, SLOT(refreshKeys(QStringList)));
531
529
connect(kgpgtxtedit, SIGNAL(encryptFiles(KUrl::List)), this, SIGNAL(encryptFiles(KUrl::List)));
532
530
connect(this, SIGNAL(fontChanged(QFont)), kgpgtxtedit, SLOT(slotSetFont(QFont)));
1641
1642
void KeysManager::renameGroup()
1643
KGpgNode *nd = iview->selectedNode();
1644
if (!nd || (nd->getType() != ITYPE_GROUP))
1647
const QString groupName = KInputDialog::getText(i18n("Rename Group"),
1648
i18nc("Enter the new name for the key group being renamed", "Enter new group name:"),
1649
nd->getName(), 0, this);
1651
if ((groupName == nd->getName()) || groupName.isEmpty())
1654
nd->toGroupNode()->rename(groupName);
1644
if (iview->selectionModel()->selectedIndexes().isEmpty())
1647
QModelIndex selectedNodeIndex = iview->selectionModel()->selectedIndexes().first();
1649
iview->edit(selectedNodeIndex);
1657
1652
void KeysManager::createNewGroup()
2621
QPointer<KgpgSelectPublicKeyDlg> dialog = new KgpgSelectPublicKeyDlg(this, imodel, goToDefaultKey->shortcut());
2616
QPointer<KgpgSelectPublicKeyDlg> dialog = new KgpgSelectPublicKeyDlg(this, imodel, goToDefaultKey->shortcut(), true);
2622
2617
if (dialog->exec() == KDialog::Accepted) {
2618
KGpgEncrypt::EncryptOptions encOptions = KGpgEncrypt::AsciiArmored;
2623
2619
QStringList options;
2625
2621
if (!dialog->getCustomOptions().isEmpty() && KGpgSettings::allowCustomEncryptionOptions())
2626
options = dialog->getCustomOptions().split(QLatin1Char( ' ' ), QString::SkipEmptyParts);
2622
options = dialog->getCustomOptions().split(QLatin1Char(' '), QString::SkipEmptyParts);
2628
2624
if (dialog->getUntrusted())
2629
options.append(QLatin1String( "--always-trust" ));
2630
if (dialog->getArmor())
2631
options.append(QLatin1String( "--armor" ));
2625
encOptions |= KGpgEncrypt::AllowUntrustedEncryption;
2632
2626
if (dialog->getHideId())
2633
options.append(QLatin1String( "--throw-keyid" ));
2627
encOptions |= KGpgEncrypt::HideKeyId;
2635
2629
if (KGpgSettings::pgpCompatibility())
2636
2630
options.append(QLatin1String( "--pgp6" ));
2638
options.append(QLatin1String( "--armor" ));
2641
if (!dialog->getSymmetric())
2642
selec = dialog->selectedKeys();
2644
KGpgTextInterface *txtEncrypt = new KGpgTextInterface();
2645
connect (txtEncrypt, SIGNAL(txtEncryptionFinished(QString)), SLOT(slotSetClip(QString)));
2632
KGpgEncrypt *enc = new KGpgEncrypt(this, dialog->selectedKeys(), cliptext, encOptions, options);
2633
connect(enc, SIGNAL(done(int)), SLOT(slotSetClip(int)));
2646
2635
m_trayicon->setStatus(KStatusNotifierItem::Active);
2647
txtEncrypt->encryptText(cliptext, selec, options);
2654
KeysManager::slotSetClip(const QString &newtxt)
2643
KeysManager::slotSetClip(int result)
2645
KGpgEncrypt *enc = qobject_cast<KGpgEncrypt *>(sender());
2646
Q_ASSERT(enc != NULL);
2656
2647
sender()->deleteLater();
2658
2649
m_trayicon->setStatus(KStatusNotifierItem::Passive);
2660
if (newtxt.isEmpty())
2651
if (result != KGpgTransaction::TS_OK)
2663
kapp->clipboard()->setText(newtxt, m_clipboardmode);
2654
kapp->clipboard()->setText(enc->encryptedText().join(QLatin1String("\n")), m_clipboardmode);
2665
2656
Q_ASSERT(m_trayicon != NULL);
2666
2657
m_trayicon->showMessage(QString(), i18n("Text successfully encrypted."), QLatin1String( "kgpg" ));