Changeset View
Changeset View
Standalone View
Standalone View
src/crypto/gui/signencryptfileswizard.cpp
Show All 36 Lines | |||||
37 | #include "signencryptwidget.h" | 37 | #include "signencryptwidget.h" | ||
38 | 38 | | |||
39 | #include "newresultpage.h" | 39 | #include "newresultpage.h" | ||
40 | 40 | | |||
41 | #include <KLocalizedString> | 41 | #include <KLocalizedString> | ||
42 | #include <KSharedConfig> | 42 | #include <KSharedConfig> | ||
43 | #include <KColorScheme> | 43 | #include <KColorScheme> | ||
44 | #include <KConfigGroup> | 44 | #include <KConfigGroup> | ||
45 | #include <KWindowConfig> | ||||
45 | 46 | | |||
46 | #include <KMessageBox> | 47 | #include <KMessageBox> | ||
47 | 48 | | |||
48 | #include "kleopatra_debug.h" | 49 | #include "kleopatra_debug.h" | ||
49 | #include <utils/gnupg-helper.h> | 50 | #include <utils/gnupg-helper.h> | ||
50 | 51 | | |||
51 | #include <Libkleo/FileNameRequester> | 52 | #include <Libkleo/FileNameRequester> | ||
53 | #include <QWindow> | ||||
52 | #include <QVBoxLayout> | 54 | #include <QVBoxLayout> | ||
53 | #include <QWizardPage> | 55 | #include <QWizardPage> | ||
54 | #include <QGroupBox> | 56 | #include <QGroupBox> | ||
55 | #include <QLabel> | 57 | #include <QLabel> | ||
56 | #include <QIcon> | 58 | #include <QIcon> | ||
57 | #include <QCheckBox> | 59 | #include <QCheckBox> | ||
58 | 60 | | |||
59 | 61 | | |||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | 389 | private: | |||
388 | SignEncryptFilesWizard *mParent; | 390 | SignEncryptFilesWizard *mParent; | ||
389 | }; | 391 | }; | ||
390 | 392 | | |||
391 | SignEncryptFilesWizard::SignEncryptFilesWizard(QWidget *parent, Qt::WindowFlags f) | 393 | SignEncryptFilesWizard::SignEncryptFilesWizard(QWidget *parent, Qt::WindowFlags f) | ||
392 | : QWizard(parent, f) | 394 | : QWizard(parent, f) | ||
393 | , mSigningUserMutable(true) | 395 | , mSigningUserMutable(true) | ||
394 | , mEncryptionUserMutable(true) | 396 | , mEncryptionUserMutable(true) | ||
395 | { | 397 | { | ||
398 | readConfig(); | ||||
399 | | ||||
396 | bool de_vs = Kleo::gpgComplianceP("de-vs"); | 400 | bool de_vs = Kleo::gpgComplianceP("de-vs"); | ||
397 | #ifdef Q_OS_WIN | 401 | #ifdef Q_OS_WIN | ||
398 | // Enforce modern style to avoid vista style ugliness. | 402 | // Enforce modern style to avoid vista style ugliness. | ||
399 | setWizardStyle(QWizard::ModernStyle); | 403 | setWizardStyle(QWizard::ModernStyle); | ||
400 | #endif | 404 | #endif | ||
401 | mSigEncPage = new SigEncPage(this); | 405 | mSigEncPage = new SigEncPage(this); | ||
402 | mResultPage = new ResultPage(this); | 406 | mResultPage = new ResultPage(this); | ||
403 | 407 | | |||
Show All 12 Lines | 417 | if (de_vs) { | |||
416 | mLabel = button(QWizard::CustomButton1); | 420 | mLabel = button(QWizard::CustomButton1); | ||
417 | /* We style the button so that it looks and acts like a | 421 | /* We style the button so that it looks and acts like a | ||
418 | label. */ | 422 | label. */ | ||
419 | mLabel->setStyleSheet(QStringLiteral("border: none")); | 423 | mLabel->setStyleSheet(QStringLiteral("border: none")); | ||
420 | mLabel->setFocusPolicy(Qt::NoFocus); | 424 | mLabel->setFocusPolicy(Qt::NoFocus); | ||
421 | } else { | 425 | } else { | ||
422 | mLabel = nullptr; | 426 | mLabel = nullptr; | ||
423 | } | 427 | } | ||
424 | | ||||
425 | KConfigGroup cfgGroup(KSharedConfig::openConfig(), "SignEncryptFilesWizard"); | | |||
426 | const QByteArray geom = cfgGroup.readEntry("geometry", QByteArray()); | | |||
427 | if (!geom.isEmpty()) { | | |||
428 | restoreGeometry(geom); | | |||
429 | return; | | |||
430 | } | | |||
431 | } | 428 | } | ||
432 | 429 | | |||
433 | void SignEncryptFilesWizard::setLabelText(const QString &label) const | 430 | void SignEncryptFilesWizard::setLabelText(const QString &label) const | ||
434 | { | 431 | { | ||
435 | if (mLabel) { | 432 | if (mLabel) { | ||
436 | mLabel->setText(label); | 433 | mLabel->setText(label); | ||
437 | } | 434 | } | ||
438 | } | 435 | } | ||
439 | 436 | | |||
440 | void SignEncryptFilesWizard::slotCurrentIdChanged(int id) | 437 | void SignEncryptFilesWizard::slotCurrentIdChanged(int id) | ||
441 | { | 438 | { | ||
442 | if (id == ResultPageId) { | 439 | if (id == ResultPageId) { | ||
443 | Q_EMIT operationPrepared(); | 440 | Q_EMIT operationPrepared(); | ||
444 | } | 441 | } | ||
445 | } | 442 | } | ||
446 | 443 | | |||
447 | SignEncryptFilesWizard::~SignEncryptFilesWizard() | 444 | SignEncryptFilesWizard::~SignEncryptFilesWizard() | ||
448 | { | 445 | { | ||
449 | qCDebug(KLEOPATRA_LOG); | 446 | qCDebug(KLEOPATRA_LOG); | ||
450 | KConfigGroup cfgGroup(KSharedConfig::openConfig(), "SignEncryptFilesWizard"); | 447 | writeConfig(); | ||
451 | cfgGroup.writeEntry("geometry", saveGeometry()); | | |||
452 | cfgGroup.sync(); | | |||
453 | } | 448 | } | ||
454 | 449 | | |||
455 | void SignEncryptFilesWizard::setSigningPreset(bool preset) | 450 | void SignEncryptFilesWizard::setSigningPreset(bool preset) | ||
456 | { | 451 | { | ||
457 | mSigEncPage->setSigningPreset(preset); | 452 | mSigEncPage->setSigningPreset(preset); | ||
458 | } | 453 | } | ||
459 | 454 | | |||
460 | void SignEncryptFilesWizard::setSigningUserMutable(bool mut) | 455 | void SignEncryptFilesWizard::setSigningUserMutable(bool mut) | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 507 | { | |||
513 | return mSigEncPage->outputNames(); | 508 | return mSigEncPage->outputNames(); | ||
514 | } | 509 | } | ||
515 | 510 | | |||
516 | bool SignEncryptFilesWizard::encryptSymmetric() const | 511 | bool SignEncryptFilesWizard::encryptSymmetric() const | ||
517 | { | 512 | { | ||
518 | return mSigEncPage->encryptSymmetric(); | 513 | return mSigEncPage->encryptSymmetric(); | ||
519 | } | 514 | } | ||
520 | 515 | | |||
516 | void SignEncryptFilesWizard::readConfig() | ||||
517 | { | ||||
518 | winId(); // ensure there's a window created | ||||
519 | | ||||
520 | // set default window size | ||||
521 | windowHandle()->resize(640, 480); | ||||
522 | | ||||
523 | // restore size from config file | ||||
524 | KConfigGroup cfgGroup(KSharedConfig::openConfig(), "SignEncryptFilesWizard"); | ||||
525 | KWindowConfig::restoreWindowSize(windowHandle(), cfgGroup); | ||||
526 | | ||||
527 | // NOTICE: QWindow::setGeometry() does NOT impact the backing QWidget geometry even if the platform | ||||
528 | // window was created -> QTBUG-40584. We therefore copy the size here. | ||||
529 | // TODO: remove once this was resolved in QWidget QPA | ||||
530 | resize(windowHandle()->size()); | ||||
531 | } | ||||
532 | | ||||
533 | void SignEncryptFilesWizard::writeConfig() | ||||
534 | { | ||||
535 | KConfigGroup cfgGroup(KSharedConfig::openConfig(), "SignEncryptFilesWizard"); | ||||
536 | KWindowConfig::saveWindowSize(windowHandle(), cfgGroup); | ||||
537 | cfgGroup.sync(); | ||||
538 | } | ||||
539 | | ||||
540 | | ||||
521 | #include "signencryptfileswizard.moc" | 541 | #include "signencryptfileswizard.moc" |