KIO

pastedialog.cpp
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(items);
46 layout->addWidget(m_comboBox);
47
48 layout->addStretch();
49
50 QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
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"
QString i18n(const char *text, const TYPE &arg...)
void addStretch(int stretch)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
virtual void accept()
virtual void reject()
void setStandardButtons(StandardButtons buttons)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:49:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.