mirror of
https://bitbucket.org/smil3y/kde-playground.git
synced 2025-02-23 18:32:51 +00:00
kgpg: disable start button when source or destination is not valid
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8d4fe8f4f0
commit
ebbf2d8876
3 changed files with 50 additions and 0 deletions
|
@ -40,6 +40,11 @@ KGPG::KGPG(QWidget *parent)
|
||||||
m_ui.startbutton->setEnabled(false);
|
m_ui.startbutton->setEnabled(false);
|
||||||
m_ui.progressbar->setVisible(false);
|
m_ui.progressbar->setVisible(false);
|
||||||
|
|
||||||
|
connect(m_ui.sourcerequester, SIGNAL(textChanged(QString)), this, SLOT(slotSourceOrDestinationChanged(QString)));
|
||||||
|
connect(m_ui.sourcerequester, SIGNAL(urlSelected(KUrl)), this, SLOT(slotSourceOrDestinationChanged(KUrl)));
|
||||||
|
connect(m_ui.destinationrequester, SIGNAL(textChanged(QString)), this, SLOT(slotSourceOrDestinationChanged(QString)));
|
||||||
|
connect(m_ui.destinationrequester, SIGNAL(urlSelected(KUrl)), this, SLOT(slotSourceOrDestinationChanged(KUrl)));
|
||||||
|
|
||||||
connect(m_ui.keysbox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotKeysBox(int)));
|
connect(m_ui.keysbox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotKeysBox(int)));
|
||||||
connect(m_ui.startbutton, SIGNAL(clicked()), this, SLOT(slotStart()));
|
connect(m_ui.startbutton, SIGNAL(clicked()), this, SLOT(slotStart()));
|
||||||
|
|
||||||
|
@ -524,6 +529,31 @@ void KGPG::start()
|
||||||
|
|
||||||
// qDebug() << Q_FUNC_INFO << "verify" << gpgbuffer;
|
// qDebug() << Q_FUNC_INFO << "verify" << gpgbuffer;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
const gpgme_verify_result_t gpgverify = gpgme_op_verify_result(m_gpgctx);
|
||||||
|
if (!gpgverify->signatures) {
|
||||||
|
setError(i18n("No signatures"));
|
||||||
|
gpgme_data_release(gpgindata);
|
||||||
|
gpgme_data_release(gpgsigndata);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgme_signature_t gpgsignature;
|
||||||
|
bool breakswitch = false;
|
||||||
|
for (gpgsignature = gpgverify->signatures; gpgsignature; gpgsignature = gpgsignature->next) {
|
||||||
|
if (gpgsignature->validity_reason != 0) {
|
||||||
|
setError(gpgme_strerror(gpgsignature->validity_reason));
|
||||||
|
gpgme_data_release(gpgindata);
|
||||||
|
gpgme_data_release(gpgsigndata);
|
||||||
|
breakswitch = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (breakswitch) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gpgme_free(gpgbuffer);
|
gpgme_free(gpgbuffer);
|
||||||
gpgme_data_release(gpgindata);
|
gpgme_data_release(gpgindata);
|
||||||
gpgme_data_release(gpgsigndata);
|
gpgme_data_release(gpgsigndata);
|
||||||
|
@ -585,6 +615,20 @@ void KGPG::slotQuit()
|
||||||
qApp->quit();
|
qApp->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KGPG::slotSourceOrDestinationChanged(const QString &url)
|
||||||
|
{
|
||||||
|
Q_UNUSED(url);
|
||||||
|
const KUrl sourceurl = m_ui.sourcerequester->url();
|
||||||
|
const KUrl destinationurl = m_ui.destinationrequester->url();
|
||||||
|
m_ui.startbutton->setEnabled(sourceurl.isValid() && destinationurl.isValid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void KGPG::slotSourceOrDestinationChanged(const KUrl &url)
|
||||||
|
{
|
||||||
|
Q_UNUSED(url);
|
||||||
|
slotSourceOrDestinationChanged(QString());
|
||||||
|
}
|
||||||
|
|
||||||
void KGPG::updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret)
|
void KGPG::updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret)
|
||||||
{
|
{
|
||||||
if (!m_initialized) {
|
if (!m_initialized) {
|
||||||
|
|
|
@ -77,6 +77,9 @@ private Q_SLOTS:
|
||||||
void slotVerifyMode();
|
void slotVerifyMode();
|
||||||
void slotQuit();
|
void slotQuit();
|
||||||
|
|
||||||
|
void slotSourceOrDestinationChanged(const QString &url);
|
||||||
|
void slotSourceOrDestinationChanged(const KUrl &url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret);
|
void updateKeys(const gpgme_keylist_mode_t gpgmode, const bool gpgsecret);
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="KPushButton" name="startbutton">
|
<widget class="KPushButton" name="startbutton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Start</string>
|
<string>Start</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Reference in a new issue