Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
klinkdialog
|
||||
SPDX-FileCopyrightText: 2008 Stephen Kelly <steveire@gmailcom>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "klinkdialog_p.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
/**
|
||||
Private class that helps to provide binary compatibility between releases.
|
||||
@internal
|
||||
*/
|
||||
//@cond PRIVATE
|
||||
class KLinkDialogPrivate
|
||||
{
|
||||
public:
|
||||
QLabel *textLabel = nullptr;
|
||||
QLineEdit *textLineEdit = nullptr;
|
||||
QLabel *linkUrlLabel = nullptr;
|
||||
QLineEdit *linkUrlLineEdit = nullptr;
|
||||
QDialogButtonBox *buttonBox = nullptr;
|
||||
};
|
||||
//@endcond
|
||||
|
||||
KLinkDialog::KLinkDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, d(new KLinkDialogPrivate)
|
||||
{
|
||||
setWindowTitle(i18n("Manage Link"));
|
||||
setModal(true);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
|
||||
QGridLayout *grid = new QGridLayout;
|
||||
|
||||
d->textLabel = new QLabel(i18n("Link Text:"), this);
|
||||
d->textLineEdit = new QLineEdit(this);
|
||||
d->textLineEdit->setClearButtonEnabled(true);
|
||||
d->linkUrlLabel = new QLabel(i18n("Link URL:"), this);
|
||||
d->linkUrlLineEdit = new QLineEdit(this);
|
||||
d->linkUrlLineEdit->setClearButtonEnabled(true);
|
||||
|
||||
grid->addWidget(d->textLabel, 0, 0);
|
||||
grid->addWidget(d->textLineEdit, 0, 1);
|
||||
grid->addWidget(d->linkUrlLabel, 1, 0);
|
||||
grid->addWidget(d->linkUrlLineEdit, 1, 1);
|
||||
|
||||
layout->addLayout(grid);
|
||||
|
||||
d->buttonBox = new QDialogButtonBox(this);
|
||||
d->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(d->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(d->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
layout->addWidget(d->buttonBox);
|
||||
|
||||
d->textLineEdit->setFocus();
|
||||
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
connect(d->textLineEdit, &QLineEdit::textChanged, this, &KLinkDialog::slotTextChanged);
|
||||
}
|
||||
|
||||
KLinkDialog::~KLinkDialog()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void KLinkDialog::slotTextChanged(const QString &text)
|
||||
{
|
||||
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.trimmed().isEmpty());
|
||||
}
|
||||
|
||||
void KLinkDialog::setLinkText(const QString &linkText)
|
||||
{
|
||||
d->textLineEdit->setText(linkText);
|
||||
if (!linkText.trimmed().isEmpty()) {
|
||||
d->linkUrlLineEdit->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void KLinkDialog::setLinkUrl(const QString &linkUrl)
|
||||
{
|
||||
d->linkUrlLineEdit->setText(linkUrl);
|
||||
}
|
||||
|
||||
QString KLinkDialog::linkText() const
|
||||
{
|
||||
return d->textLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
QString KLinkDialog::linkUrl() const
|
||||
{
|
||||
return d->linkUrlLineEdit->text();
|
||||
}
|
||||
|
||||
#include "moc_klinkdialog_p.cpp"
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
klinkdialog
|
||||
SPDX-FileCopyrightText: 2008 Stephen Kelly <steveire@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#ifndef KLINKDIALOG_H
|
||||
#define KLINKDIALOG_H
|
||||
|
||||
//@cond PRIVATE
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class KLinkDialogPrivate;
|
||||
class QString;
|
||||
|
||||
/**
|
||||
@short Dialog to allow user to configure a hyperlink.
|
||||
@author Stephen Kelly
|
||||
@since 4.1
|
||||
@internal
|
||||
|
||||
This class provides a dialog to ask the user for a link target url and
|
||||
text.
|
||||
|
||||
The size of the dialog is automatically saved to and restored from the
|
||||
global KDE config file.
|
||||
*/
|
||||
class KLinkDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Create a link dialog.
|
||||
* @param parent Parent widget.
|
||||
*/
|
||||
explicit KLinkDialog(QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~KLinkDialog() override;
|
||||
|
||||
/**
|
||||
* Returns the link text shown in the dialog
|
||||
* @param linkText The initial text
|
||||
*/
|
||||
void setLinkText(const QString &linkText);
|
||||
|
||||
/**
|
||||
* Sets the target link url shown in the dialog
|
||||
* @param linkUrl The initial link target url
|
||||
*/
|
||||
void setLinkUrl(const QString &linkUrl);
|
||||
|
||||
/**
|
||||
* Returns the link text entered by the user.
|
||||
* @return The link text
|
||||
*/
|
||||
QString linkText() const;
|
||||
|
||||
/**
|
||||
* Returns the target link url entered by the user.
|
||||
* @return The link url
|
||||
*/
|
||||
QString linkUrl() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotTextChanged(const QString &);
|
||||
|
||||
private:
|
||||
//@cond PRIVATE
|
||||
KLinkDialogPrivate *const d;
|
||||
//@endcond
|
||||
};
|
||||
|
||||
//@endcond
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user