Пример #1
0
void KoDocumentInfoDlg::slotToggleEncryption()
{
    KoDocument* doc = dynamic_cast< KoDocument* >(d->m_info->parent());
    if (!doc)
        return;

    d->m_toggleEncryption = !d->m_toggleEncryption;

    if (doc->specialOutputFlag() == KoDocument::SaveEncrypted) {
        if (d->m_toggleEncryption) {
            QPixmap p = KIconLoader::global()->loadIcon("object-unlocked", KIconLoader::Small);
            d->m_aboutUi->lblEncrypted->setText(i18n("This document will be decrypted"));
            d->m_aboutUi->lblEncryptedPic->setPixmap(p);
            d->m_aboutUi->pbEncrypt->setText(i18n("Do not decrypt"));
        } else {
            QPixmap p = KIconLoader::global()->loadIcon("object-locked", KIconLoader::Small);
            d->m_aboutUi->lblEncrypted->setText(i18n("This document is encrypted"));
            d->m_aboutUi->lblEncryptedPic->setPixmap(p);
            d->m_aboutUi->pbEncrypt->setText(i18n("D&ecrypt"));
        }
    } else {
        if (d->m_toggleEncryption) {
            QPixmap p = KIconLoader::global()->loadIcon("object-locked", KIconLoader::Small);
            d->m_aboutUi->lblEncrypted->setText(i18n("This document will be encrypted."));
            d->m_aboutUi->lblEncryptedPic->setPixmap(p);
            d->m_aboutUi->pbEncrypt->setText(i18n("Do not encrypt"));
        } else {
            QPixmap p = KIconLoader::global()->loadIcon("object-unlocked", KIconLoader::Small);
            d->m_aboutUi->lblEncrypted->setText(i18n("This document is not encrypted"));
            d->m_aboutUi->lblEncryptedPic->setPixmap(p);
            d->m_aboutUi->pbEncrypt->setText(i18n("&Encrypt"));
        }
    }
}
Пример #2
0
void KoDocumentInfoDlg::initAboutTab()
{
    KoDocument* doc = dynamic_cast< KoDocument* >(d->m_info->parent());
    if (!doc)
        return;

    d->m_aboutUi->filePathLabel->setText(doc->localFilePath());

    d->m_aboutUi->leTitle->setText(d->m_info->aboutInfo("title"));
    d->m_aboutUi->leSubject->setText(d->m_info->aboutInfo("subject"));

    d->m_aboutUi->leKeywords->setToolTip(i18n("Use ';' (Example: Office;KDE;KOffice)"));
    if (!d->m_info->aboutInfo("keyword").isEmpty())
        d->m_aboutUi->leKeywords->setText(d->m_info->aboutInfo("keyword"));

    d->m_aboutUi->meComments->setPlainText(d->m_info->aboutInfo("comments"));
    if (!doc->mimeType().isEmpty()) {
        KMimeType::Ptr docmime = KMimeType::mimeType(doc->mimeType());
        if (docmime)
            d->m_aboutUi->lblType->setText(docmime->comment());
    }
    if (!d->m_info->aboutInfo("creation-date").isEmpty()) {
        QDateTime t = QDateTime::fromString(d->m_info->aboutInfo("creation-date"),
                                            Qt::ISODate);
        QString s = KGlobal::locale()->formatDateTime(t);
        d->m_aboutUi->lblCreated->setText(s + ", " +
                                          d->m_info->aboutInfo("initial-creator"));
    }

    if (!d->m_info->aboutInfo("date").isEmpty()) {
        QDateTime t = QDateTime::fromString(d->m_info->aboutInfo("date"), Qt::ISODate);
        QString s = KGlobal::locale()->formatDateTime(t);
        d->m_aboutUi->lblModified->setText(s + ", " + d->m_info->authorInfo("creator"));
    }

    d->m_aboutUi->lblRevision->setText(d->m_info->aboutInfo("editing-cycles"));

    if ( doc->supportedSpecialFormats() & KoDocument::SaveEncrypted ) {
        if (doc->specialOutputFlag() == KoDocument::SaveEncrypted) {
            if (d->m_toggleEncryption) {
                QPixmap p = KIconLoader::global()->loadIcon("object-unlocked", KIconLoader::Small);
                d->m_aboutUi->lblEncrypted->setText(i18n("This document will be decrypted"));
                d->m_aboutUi->lblEncryptedPic->setPixmap(p);
                d->m_aboutUi->pbEncrypt->setText(i18n("Do not decrypt"));
            } else {
                QPixmap p = KIconLoader::global()->loadIcon("object-locked", KIconLoader::Small);
                d->m_aboutUi->lblEncrypted->setText(i18n("This document is encrypted"));
                d->m_aboutUi->lblEncryptedPic->setPixmap(p);
                d->m_aboutUi->pbEncrypt->setText(i18n("D&ecrypt"));
            }
        } else {
            if (d->m_toggleEncryption) {
                QPixmap p = KIconLoader::global()->loadIcon("object-locked", KIconLoader::Small);
                d->m_aboutUi->lblEncrypted->setText(i18n("This document will be encrypted."));
                d->m_aboutUi->lblEncryptedPic->setPixmap(p);
                d->m_aboutUi->pbEncrypt->setText(i18n("Do not encrypt"));
            } else {
                QPixmap p = KIconLoader::global()->loadIcon("object-unlocked", KIconLoader::Small);
                d->m_aboutUi->lblEncrypted->setText(i18n("This document is not encrypted"));
                d->m_aboutUi->lblEncryptedPic->setPixmap(p);
                d->m_aboutUi->pbEncrypt->setText(i18n("&Encrypt"));
            }
        }
    } else {
        d->m_aboutUi->lblEncrypted->setText(i18n("This document does not support encryption"));
        d->m_aboutUi->pbEncrypt->setEnabled( false );
    }
    connect(d->m_aboutUi->pbReset, SIGNAL(clicked()),
            this, SLOT(slotResetMetaData()));
    connect(d->m_aboutUi->pbEncrypt, SIGNAL(clicked()),
            this, SLOT(slotToggleEncryption()));
}