Commit 1dc53794 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to KNSWidgets/Button

parent 22b77e05
Pipeline #193572 failed with stage
in 56 seconds
......@@ -35,7 +35,7 @@ target_link_libraries(kcardgame
PRIVATE
KF5::Completion
KF5::GuiAddons
KF5::NewStuff
KF5::NewStuffWidgets
KF5::I18n
Qt${QT_MAJOR_VERSION}::Svg
)
......
......@@ -25,7 +25,7 @@
#include <KImageCache>
#include <KLineEdit>
#include <KLocalizedString>
#include <KNS3/DownloadDialog>
#include <KNSWidgets/Button>
// Qt
#include <QPushButton>
#include <QMutexLocker>
......@@ -331,17 +331,6 @@ void KCardThemeWidgetPrivate::updateListView( const QString & dirName )
listView->setCurrentIndex( index );
}
void KCardThemeWidgetPrivate::getNewCardThemes()
{
QPointer<KNS3::DownloadDialog> dialog = new KNS3::DownloadDialog( QStringLiteral("kcardtheme.knsrc"), q );
dialog->exec();
if ( dialog && !dialog->changedEntries().isEmpty() )
model->reload();
delete dialog;
}
KCardThemeWidget::KCardThemeWidget( const QSet<QString> & requiredFeatures, const QString & previewString, QWidget * parent )
: QWidget( parent ),
d( new KCardThemeWidgetPrivate( this ) )
......@@ -394,8 +383,13 @@ KCardThemeWidget::KCardThemeWidget( const QSet<QString> & requiredFeatures, cons
connect( d->listView->selectionModel(), &QItemSelectionModel::currentChanged, d, &KCardThemeWidgetPrivate::updateLineEdit );
connect( d->hiddenLineEdit, &QLineEdit::textChanged, d, &KCardThemeWidgetPrivate::updateListView );
d->newDeckButton = new QPushButton( QIcon::fromTheme( QStringLiteral( "get-hot-new-stuff") ), i18n("Get New Card Decks..." ), this );
connect( d->newDeckButton, &QAbstractButton::clicked, d, &KCardThemeWidgetPrivate::getNewCardThemes );
d->newDeckButton = new KNSWidgets::Button(this);
d->newDeckButton->setConfigFile(QStringLiteral("kcardtheme.knsrc"));
QObject::connect(d->newDeckButton, &KNSWidgets::Button::dialogFinished, this, [this](const QList<KNSCore::Entry> &changedEntries) {
if (!changedEntries.isEmpty()) {
d->model->reload();
}
});
QHBoxLayout * hLayout = new QHBoxLayout();
hLayout->addStretch( 1 );
......
......@@ -35,6 +35,9 @@ class KLineEdit;
class QPushButton;
class QListView;
namespace KNSWidgets {
class Button;
}
class PreviewThread : public QThread
{
......@@ -105,7 +108,6 @@ public:
public Q_SLOTS:
void updateLineEdit( const QModelIndex & index );
void updateListView( const QString & dirName );
void getNewCardThemes();
public:
KCardThemeWidget * q;
......@@ -115,7 +117,7 @@ public:
CardThemeModel * model;
QListView * listView;
KLineEdit * hiddenLineEdit;
QPushButton * newDeckButton;
KNSWidgets::Button * newDeckButton;
int itemMargin;
int textHeight;
......
Supports Markdown
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