Commit 7b89ba17 authored by Ahmad Samir's avatar Ahmad Samir Committed by Tomaz Canabrava
Browse files

Port away from KNewStuff deprecated API

parent 806bd5a0
......@@ -242,6 +242,7 @@ target_link_libraries(konsoleprivate
konsoleprofile
konsolecharacters
konsoledecoders
KF5::NewStuffWidgets
${konsole_LIBS}
ZLIB::ZLIB
)
......
......@@ -56,7 +56,7 @@
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout">
<layout name="colorSchemesBtnLayout" class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
......@@ -100,13 +100,6 @@
</property>
</widget>
</item>
<item>
<widget class="KNS3::Button" name="downloadColorSchemeButton">
<property name="text">
<string>Get New...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -778,11 +771,6 @@
<header>kmessagewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KNS3::Button</class>
<extends>QPushButton</extends>
<header location="global">KNS3/Button</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
......
......@@ -34,6 +34,8 @@
#include <KWindowSystem>
#include <kconfigwidgets_version.h>
#include <KNSWidgets/Button>
// Konsole
#include "ui_EditProfileAdvancedPage.h"
#include "ui_EditProfileAppearancePage.h"
......@@ -662,8 +664,6 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
_appearanceUi->removeColorSchemeButton->setEnabled(false);
_appearanceUi->resetColorSchemeButton->setEnabled(false);
_appearanceUi->downloadColorSchemeButton->setConfigFile(QStringLiteral("konsole.knsrc"));
// setup color list
// select the colorScheme used in the current profile
updateColorSchemeList(currentColorSchemeName());
......@@ -680,7 +680,6 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
connect(_appearanceUi->editColorSchemeButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::editColorScheme);
connect(_appearanceUi->removeColorSchemeButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::removeColorScheme);
connect(_appearanceUi->newColorSchemeButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::newColorScheme);
connect(_appearanceUi->downloadColorSchemeButton, &KNS3::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes);
connect(_appearanceUi->resetColorSchemeButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::resetColorScheme);
......@@ -771,6 +770,17 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
_appearanceUi->displayVerticalLineAtColumn->setValue(profile->verticalLineAtChar());
connect(_appearanceUi->displayVerticalLineAtColumn, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditProfileDialog::setVerticalLineColumn);
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
auto *getNewButton = new KNSWidgets::Button(this);
connect(getNewButton, &KNSWidgets::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes);
#else
auto *getNewButton = new KNS3::Button(this);
connect(getNewButton, &KNS3::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes);
#endif
getNewButton->setText(QStringLiteral("Get New..."));
getNewButton->setConfigFile(QStringLiteral("konsole.knsrc"));
_appearanceUi->colorSchemesBtnLayout->addWidget(getNewButton);
}
void EditProfileDialog::setAntialiasText(bool enable)
......@@ -1135,7 +1145,11 @@ void EditProfileDialog::removeColorScheme()
}
}
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
void EditProfileDialog::gotNewColorSchemes(const QList<KNSCore::EntryInternal> &changedEntries)
#else
void EditProfileDialog::gotNewColorSchemes(const KNS3::Entry::List &changedEntries)
#endif
{
int failures = 0;
for (auto &entry : qAsConst(changedEntries)) {
......
......@@ -10,7 +10,9 @@
// KDE
#include <KNS3/Entry>
#include <KNSCore/EntryInternal>
#include <KPageDialog>
#include <knewstuff_version.h>
// Konsole
#include "colorscheme/ColorScheme.h"
......@@ -140,7 +142,6 @@ private Q_SLOTS:
void editColorScheme();
void saveColorScheme(const ColorScheme &scheme, bool isNewScheme);
void removeColorScheme();
void gotNewColorSchemes(const KNS3::Entry::List &changedEntries);
void setVerticalLine(bool);
void setVerticalLineColumn(int);
void toggleBlinkingCursor(bool);
......@@ -153,6 +154,12 @@ private Q_SLOTS:
void lineSpacingChanged(int);
void setTerminalCenter(bool enable);
#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0)
void gotNewColorSchemes(const QList<KNSCore::EntryInternal> &changedEntries);
#else
void gotNewColorSchemes(const KNS3::Entry::List &changedEntries);
#endif
/**
* Deletes the selected colorscheme from the user's home dir location
* so that the original one from the system-wide location can be used
......
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