1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2005 David Faure <faure@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#include "pastedialog_p.h"
9
10#include <KLocalizedString>
11
12#include <QApplication>
13#include <QClipboard>
14#include <QComboBox>
15#include <QDialogButtonBox>
16#include <QLabel>
17#include <QLineEdit>
18#include <QVBoxLayout>
19
20KIO::PasteDialog::PasteDialog(const QString &title, const QString &label, const QString &value, const QStringList &items, QWidget *parent)
21 : QDialog(parent)
22{
23 setWindowTitle(title);
24 setModal(true);
25
26 QVBoxLayout *topLayout = new QVBoxLayout(this);
27
28 QFrame *frame = new QFrame(this);
29 topLayout->addWidget(frame);
30
31 QVBoxLayout *layout = new QVBoxLayout(frame);
32
33 m_label = new QLabel(label, frame);
34 m_label->setWordWrap(true);
35 layout->addWidget(m_label);
36
37 m_lineEdit = new QLineEdit(value, frame);
38 layout->addWidget(m_lineEdit);
39
40 m_lineEdit->setFocus();
41 m_label->setBuddy(m_lineEdit);
42
43 layout->addWidget(new QLabel(i18n("Data format:"), frame));
44 m_comboBox = new QComboBox(frame);
45 m_comboBox->addItems(texts: items);
46 layout->addWidget(m_comboBox);
47
48 layout->addStretch();
49
50 QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
51 buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
52 connect(sender: buttonBox, signal: &QDialogButtonBox::accepted, context: this, slot: &QDialog::accept);
53 connect(sender: buttonBox, signal: &QDialogButtonBox::rejected, context: this, slot: &QDialog::reject);
54 topLayout->addWidget(buttonBox);
55
56 setMinimumWidth(350);
57}
58
59QString KIO::PasteDialog::lineEditText() const
60{
61 return m_lineEdit->text();
62}
63
64int KIO::PasteDialog::comboItem() const
65{
66 return m_comboBox->currentIndex();
67}
68
69#include "moc_pastedialog_p.cpp"
70

source code of kio/src/widgets/pastedialog.cpp