コード例 #1
0
ファイル: kgpgme.cpp プロジェクト: perihelion/basket
gpgme_error_t KGpgMe::passphraseCb(void* hook, const char* uid_hint,
								   const char* passphrase_info,
								   int last_was_bad, int fd)
{
	KGpgMe* gpg = static_cast<KGpgMe*>(hook);
	return gpg->passphrase(uid_hint, passphrase_info, last_was_bad, fd);
}
コード例 #2
0
ファイル: kgpgme.cpp プロジェクト: achea/basket
    KGpgSelKey(QWidget *parent, const char *name, QString preselected,
               const KGpgMe& gpg):
        KDialog(parent) {

        // Dialog options
        setObjectName(name);
        setModal(true);
        setCaption(i18n("Private Key List"));
        setButtons(Ok | Cancel);

        QString keyname;
        QVBoxLayout* vbox;
        QWidget* page = new QWidget(this);
        QLabel* labeltxt;
        //  KIconLoader* loader = KIconLoader::global();
        QPixmap keyPair = KIcon("kgpg_key2").pixmap(20, 20);

        setMinimumSize(350, 100);
        keysListpr = new QTreeWidget(page);
        keysListpr->setRootIsDecorated(true);
        keysListpr->setColumnCount(3);
        QStringList headers;
        headers << i18n("Name") << i18n("Email") << i18n("ID");
        keysListpr->setHeaderLabels(headers);
        keysListpr->setAllColumnsShowFocus(true);

        labeltxt = new QLabel(i18n("Choose a secret key:"), page);
        vbox = new QVBoxLayout(page);

        KGpgKeyList list = gpg.keys(true);

        for (KGpgKeyList::iterator it = list.begin(); it != list.end(); ++it) {
            QString name = gpg.checkForUtf8((*it).name);
            QStringList values;
            values << name << (*it).email << (*it).id;
            QTreeWidgetItem *item = new
            QTreeWidgetItem(keysListpr, values, 3);
            item->setIcon(0, keyPair);
            if (preselected == (*it).id) {
                item->setSelected(true);
                keysListpr->setCurrentItem(item);
            }
        }
        if (!keysListpr->currentItem() && keysListpr->topLevelItemCount() > 0) {
            keysListpr->topLevelItem(0)->setSelected(true);
            keysListpr->setCurrentItem(keysListpr->topLevelItem(0));
        }
        vbox->addWidget(labeltxt);
        vbox->addWidget(keysListpr);
        setMainWidget(page);
    };
コード例 #3
0
ファイル: kgpgme.cpp プロジェクト: perihelion/basket
		KGpgSelKey(QWidget *parent, const char *name, QString preselected,
			const KGpgMe& gpg):
		     KDialog(parent) {

			// Dialog options
			setObjectName(name);
			setModal(true);
			setCaption(i18n("Private Key List"));
			setButtons(Ok | Cancel);

			QString keyname;
			QVBoxLayout* vbox;
			QWidget* page = new QWidget(this);
			QLabel* labeltxt;
			KIconLoader* loader = KIconLoader::global();
			QPixmap keyPair = KIcon("kgpg_key2").pixmap(20, 20);

			setMinimumSize(350,100);
			keysListpr = new K3ListView(page);
			keysListpr->setRootIsDecorated(true);
			keysListpr->addColumn(i18n("Name"));
			keysListpr->addColumn(i18n("Email"));
			keysListpr->addColumn(i18n("ID"));
			keysListpr->setShowSortIndicator(true);
			keysListpr->setFullWidth(true);
			keysListpr->setAllColumnsShowFocus(true);

			labeltxt = new QLabel(i18n("Choose a secret key:"),page);
			vbox = new QVBoxLayout(page);

			KGpgKeyList list = gpg.keys(true);

			for(KGpgKeyList::iterator it = list.begin(); it != list.end(); ++it) {
				QString name = gpg.checkForUtf8((*it).name);
				K3ListViewItem *item = new
					K3ListViewItem(keysListpr, name, (*it).email, (*it).id);
				item->setPixmap(0,keyPair);
				if(preselected == (*it).id) {
					keysListpr->setSelected(item, true);
					keysListpr->setCurrentItem(item);
				}
			}
			if(!keysListpr->selectedItem()) {
				keysListpr->setSelected(keysListpr->firstChild(), true);
				keysListpr->setCurrentItem(keysListpr->firstChild());
			}
			vbox->addWidget(labeltxt);
			vbox->addWidget(keysListpr);
			setMainWidget(page);
		};
コード例 #4
0
ファイル: password.cpp プロジェクト: KrissN/basket
Password::Password(QWidget *parent)
        : QWidget(parent)
{
    // Setup from the UI file
    setupUi(this);

    KGpgMe gpg;

    KGpgKeyList list = gpg.keys(true);
    for (KGpgKeyList::iterator it = list.begin(); it != list.end(); ++it) {
        QString name = gpg.checkForUtf8((*it).name);

        keyCombo->addItem(QString("%1 <%2> %3").arg(name).arg((*it).email).arg((*it).id));
    }
    publicPrivateRadioButton->setEnabled(keyCombo->count() > 0);
    keyCombo->setEnabled(keyCombo->count() > 0);
}