Commit ce5936a0 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Create UI of Lookup Certificates dialog in code

GnuPG-bug-id: 5725
parent 46e16940
......@@ -310,7 +310,6 @@ if(KLEO_MODEL_TEST)
endif()
ki18n_wrap_ui(_kleopatra_SRCS
dialogs/lookupcertificatesdialog.ui
dialogs/ownertrustdialog.ui
dialogs/selectchecklevelwidget.ui
dialogs/selftestdialog.ui
......
......@@ -11,18 +11,27 @@
#include "lookupcertificatesdialog.h"
#include "ui_lookupcertificatesdialog.h"
#include "view/keytreeview.h"
#include <Libkleo/KeyListModel>
#include <KConfigGroup>
#include <gpgme++/key.h>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSeparator>
#include <KSharedConfig>
#include <QDialog>
#include <QDialogButtonBox>
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QSpacerItem>
#include <QTreeView>
#include <QVBoxLayout>
#include <KSharedConfig>
#include <gpgme++/key.h>
using namespace Kleo;
using namespace Kleo::Dialogs;
......@@ -90,11 +99,89 @@ private:
private:
bool passive;
struct Ui : Ui_LookupCertificatesDialog {
struct Ui {
QLabel *findLB;
QLineEdit *findED;
QPushButton *findPB;
Kleo::KeyTreeView *resultTV;
QPushButton *selectAllPB;
QPushButton *deselectAllPB;
QPushButton *detailsPB;
QPushButton *saveAsPB;
QDialogButtonBox *buttonBox;
void setupUi(QDialog *dialog)
{
auto verticalLayout = new QVBoxLayout{dialog};
auto gridLayout = new QGridLayout{};
int row = 0;
findLB = new QLabel{i18n("Find:"), dialog};
gridLayout->addWidget(findLB, row, 0, 1, 1);
findED = new QLineEdit{dialog};
findLB->setBuddy(findED);
gridLayout->addWidget(findED, row, 1, 1, 1);
findPB = new QPushButton{i18n("Search"), dialog};
findPB->setAutoDefault(false);
gridLayout->addWidget(findPB, row, 2, 1, 1);
row++;
gridLayout->addWidget(new KSeparator{Qt::Horizontal, dialog}, row, 0, 1, 3);
row++;
resultTV = new Kleo::KeyTreeView(dialog);
resultTV->setEnabled(true);
resultTV->setMinimumSize(QSize(400, 0));
gridLayout->addWidget(resultTV, row, 0, 1, 2);
auto buttonLayout = new QVBoxLayout{};
selectAllPB = new QPushButton{i18n("Select All"), dialog};
selectAllPB->setEnabled(false);
selectAllPB->setAutoDefault(false);
buttonLayout->addWidget(selectAllPB);
deselectAllPB = new QPushButton{i18n("Deselect All"), dialog};
deselectAllPB->setEnabled(false);
deselectAllPB->setAutoDefault(false);
buttonLayout->addWidget(deselectAllPB);
buttonLayout->addStretch();
detailsPB = new QPushButton{i18n("Details..."), dialog};
detailsPB->setEnabled(false);
detailsPB->setAutoDefault(false);
buttonLayout->addWidget(detailsPB);
saveAsPB = new QPushButton{i18n("Save As..."), dialog};
saveAsPB->setEnabled(false);
saveAsPB->setAutoDefault(false);
buttonLayout->addWidget(saveAsPB);
gridLayout->addLayout(buttonLayout, row, 2, 1, 1);
verticalLayout->addLayout(gridLayout);
buttonBox = new QDialogButtonBox{dialog};
buttonBox->setStandardButtons(QDialogButtonBox::Close|QDialogButtonBox::Save);
verticalLayout->addWidget(buttonBox);
QObject::connect(findED, SIGNAL(returnPressed()), findPB, SLOT(animateClick()));
QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
QObject::connect(findPB, SIGNAL(clicked()), dialog, SLOT(slotSearchClicked()));
QObject::connect(detailsPB, SIGNAL(clicked()), dialog, SLOT(slotDetailsClicked()));
QObject::connect(saveAsPB, SIGNAL(clicked()), dialog, SLOT(slotSaveAsClicked()));
QObject::connect(findED, SIGNAL(textChanged(QString)), dialog, SLOT(slotSearchTextChanged()));
QMetaObject::connectSlotsByName(dialog);
}
explicit Ui(LookupCertificatesDialog *q)
: Ui_LookupCertificatesDialog()
{
q->setWindowTitle(i18n("Lookup on Server"));
setupUi(q);
saveAsPB->hide(); // ### not yet implemented in LookupCertificatesCommand
......
<ui version="4.0" >
<class>LookupCertificatesDialog</class>
<widget class="QDialog" name="LookupCertificatesDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>553</width>
<height>292</height>
</rect>
</property>
<property name="windowTitle" >
<string>Lookup on Server</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="1" >
<widget class="QLineEdit" name="findED" />
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="findPB" >
<property name="text" >
<string>Search</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<widget class="Line" name="hr" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QPushButton" name="detailsPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Details...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="2" row="6" column="2" >
<widget class="QPushButton" name="saveAsPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Save As...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QPushButton" name="selectAllPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Select All</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2" >
<widget class="QPushButton" name="deselectAllPB" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Deselect All</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="findLB" >
<property name="text" >
<string>Find:</string>
</property>
<property name="buddy" >
<cstring>findED</cstring>
</property>
</widget>
</item>
<item rowspan="6" row="2" column="0" colspan="2" >
<widget class="Kleo::KeyTreeView" name="resultTV" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="minimumSize" >
<size>
<width>400</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Kleo::KeyTreeView</class>
<extends>QWidget</extends>
<header>view/keytreeview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>findED</sender>
<signal>returnPressed()</signal>
<receiver>findPB</receiver>
<slot>animateClick()</slot>
<hints>
<hint type="sourcelabel" >
<x>409</x>
<y>19</y>
</hint>
<hint type="destinationlabel" >
<x>430</x>
<y>19</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>28</x>
<y>265</y>
</hint>
<hint type="destinationlabel" >
<x>46</x>
<y>291</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>188</x>
<y>273</y>
</hint>
<hint type="destinationlabel" >
<x>218</x>
<y>291</y>
</hint>
</hints>
</connection>
<connection>
<sender>findPB</sender>
<signal>clicked()</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>slotSearchClicked()</slot>
<hints>
<hint type="sourcelabel" >
<x>437</x>
<y>39</y>
</hint>
<hint type="destinationlabel" >
<x>443</x>
<y>45</y>
</hint>
</hints>
</connection>
<connection>
<sender>detailsPB</sender>
<signal>clicked()</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>slotDetailsClicked()</slot>
<hints>
<hint type="sourcelabel" >
<x>523</x>
<y>177</y>
</hint>
<hint type="destinationlabel" >
<x>541</x>
<y>177</y>
</hint>
</hints>
</connection>
<connection>
<sender>saveAsPB</sender>
<signal>clicked()</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>slotSaveAsClicked()</slot>
<hints>
<hint type="sourcelabel" >
<x>517</x>
<y>221</y>
</hint>
<hint type="destinationlabel" >
<x>539</x>
<y>219</y>
</hint>
</hints>
</connection>
<connection>
<sender>findED</sender>
<signal>textChanged(QString)</signal>
<receiver>LookupCertificatesDialog</receiver>
<slot>slotSearchTextChanged()</slot>
<hints>
<hint type="sourcelabel" >
<x>93</x>
<y>19</y>
</hint>
<hint type="destinationlabel" >
<x>93</x>
<y>3</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>slotSearchClicked()</slot>
<slot>slotDetailsClicked()</slot>
<slot>slotSaveAsClicked()</slot>
<slot>slotSearchTextChanged()</slot>
</slots>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment