Commit c66fe3b9 authored by Andrius Štikonas's avatar Andrius Štikonas

Port away from KDELibs4Support.

parent 9c19aa4f
......@@ -8,26 +8,19 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Qml Quick QuickWidgets Svg Test)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Completion
Config
ConfigWidgets
CoreAddons
Crash
DBusAddons
DNSSD
Declarative
GuiAddons
I18n
IconThemes
ItemModels
ItemViews
KDELibs4Support
KIO
NewStuff
Service
WidgetsAddons
XmlGui
WidgetsAddons
)
find_package(KF5DocTools ${KF5_MIN_VERSION})
find_package(KF5KDEGames 4.9.0 REQUIRED)
......@@ -51,7 +44,9 @@ add_definitions(
add_subdirectory(pics)
add_subdirectory(sounds)
add_subdirectory(icons)
add_subdirectory(doc)
if (KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
include_directories(${CMAKE_SOURCE_DIR}/libKF5KDEGames/highscore)
......@@ -84,12 +79,16 @@ add_executable(kreversi ${kreversi_SRCS})
target_link_libraries(kreversi
Qt5::Svg
KF5::Completion
KF5::ConfigCore
KF5::ConfigGui
KF5::CoreAddons
KF5::Crash
KF5::DBusAddons
KF5::Declarative
KF5::KDELibs4Support
KF5::TextWidgets
KF5::IconThemes
KF5::KIOCore
KF5::KIOFileWidgets
KF5::WidgetsAddons
KF5::XmlGui
KF5KDEGames
)
......
......@@ -19,30 +19,29 @@
#include "kexthighscore_gui.h"
#include <QLayout>
#include <QTextStream>
#include <QApplication>
#include <QFileDialog>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QTabWidget>
#include <QPushButton>
#include <QApplication>
#include <QFileDialog>
#include <QIcon>
#include <QtCore/QTemporaryFile>
#include <kmessagebox.h>
#include <kurllabel.h>
#include <krun.h>
#include <QLabel>
#include <QLayout>
#include <QPushButton>
#include <QTabWidget>
#include <QTemporaryFile>
#include <QTextStream>
#include <QVBoxLayout>
#include <KIO/NetAccess>
#include <KIconLoader>
#include <KLineEdit>
#include <KGuiItem>
#include <KIconLoader>
#include <KIO/StatJob>
#include <KIO/CopyJob>
#include <KJobWidgets>
#include <KMessageBox>
#include <KRun>
#include <KUrlLabel>
#include "kexthighscore_internal.h"
#include "kexthighscore.h"
......@@ -248,7 +247,8 @@ HighscoresDialog::HighscoresDialog(int rank, QWidget *parent)
QString icon = internal->manager.gameTypeLabel(i, Manager::Icon);
HighscoresWidget *hsw = new HighscoresWidget(0);
KPageWidgetItem *pageItem = new KPageWidgetItem( hsw, title);
pageItem->setIcon( QIcon( BarIcon(icon, KIconLoader::SizeLarge) ) );
pageItem->setIcon(QIcon::fromTheme(icon).pixmap(IconSize(KIconLoader::Toolbar)));
// pageItem->setIcon( QIcon( BarIcon(icon, KIconLoader::SizeLarge) ) );
addPage( pageItem );
_pages.append(pageItem);
connect(hsw, SIGNAL(tabChanged(int)), SLOT(tabChanged(int)));
......@@ -289,7 +289,10 @@ void HighscoresDialog::slotUser2()
// kDebug(11001) ;
QUrl url = QFileDialog::getSaveFileUrl(this, tr("HighscoresDialog"), QUrl(), QString());
if ( url.isEmpty() ) return;
if ( KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this) ) {
auto job = KIO::stat(url, KIO::StatJob::SourceSide, 0);
KJobWidgets::setWindow(job, this);
job->exec();
if (!job->error()) {
KGuiItem gi = KStandardGuiItem::save();
gi.setText(i18n("Overwrite"));
int res = KMessageBox::warningContinueCancel(this,
......@@ -302,7 +305,9 @@ void HighscoresDialog::slotUser2()
QTextStream stream(&tmp);
internal->exportHighscores(stream);
stream.flush();
KIO::NetAccess::upload(tmp.fileName(), url, this);
// KIO::NetAccess::upload(tmp.fileName(), url, this);
auto copyJob = KIO::copy(QUrl::fromLocalFile(tmp.fileName()), url);
copyJob->exec();
}
//-----------------------------------------------------------------------------
......@@ -478,13 +483,13 @@ ConfigDialog::ConfigDialog(QWidget *parent)
label = new QLabel(i18n("Nickname:"), group);
groupLayout->addWidget(label, 0, 0);
_registeredName = new KLineEdit(group);
_registeredName = new QLineEdit(group);
_registeredName->setReadOnly(true);
groupLayout->addWidget(_registeredName, 0, 1);
label = new QLabel(i18n("Key:"), group);
groupLayout->addWidget(label, 1, 0);
_key = new KLineEdit(group);
_key = new QLineEdit(group);
_key->setReadOnly(true);
groupLayout->addWidget(_key, 1, 1);
......
......@@ -32,7 +32,6 @@
#include "kexthighscore.h"
class QTabWidget;
class KLineEdit;
class KUrlLabel;
namespace KExtHighscore
......@@ -175,7 +174,7 @@ class ConfigDialog : public QDialog
bool _saved;
QCheckBox *_WWHEnabled;
QLineEdit *_nickname, *_comment;
KLineEdit *_key, *_registeredName;
QLineEdit *_key, *_registeredName;
QPushButton *_removeButton;
QDialogButtonBox *buttonBox;
......
......@@ -23,19 +23,20 @@
#include <sys/types.h>
#include <unistd.h>
#include <QCryptographicHash>
#include <QDomDocument>
#include <QFile>
#include <QLayout>
#include <qdom.h>
//Added by qt3to4:
#include <QTemporaryFile>
#include <QTextStream>
#include <QVector>
#include <QCryptographicHash>
#include <kuser.h>
#include <kio/netaccess.h>
#include <kio/job.h>
#include <kmessagebox.h>
#include <kcodecs.h>
#include <KIO/FileCopyJob>
#include <KIO/SimpleJob>
#include <KJobWidgets>
#include <KMessageBox>
#include <KUser>
#include "kexthighscore.h"
#include "kexthighscore_gui.h"
#include "kemailsettings.h"
......@@ -629,25 +630,25 @@ bool ManagerPrivate::doQuery(const QUrl &url, QWidget *parent,
{
KIO::http_update_cache(url, true, QDateTime::fromTime_t(0)); // remove cache !
QString tmpFile;
if ( !KIO::NetAccess::download(url, tmpFile, parent) ) {
QString details = i18n("Server URL: %1", url.host());
QTemporaryFile tmpFile;
if ( !tmpFile.open() ) {
QString details = i18n("Unable to open temporary file.");
KMessageBox::detailedSorry(parent, i18n(UNABLE_TO_CONTACT), details);
return false;
}
QFile file(tmpFile);
if ( !file.open(QIODevice::ReadOnly) ) {
KIO::NetAccess::removeTempFile(tmpFile);
QString details = i18n("Unable to open temporary file.");
auto copyJob = KIO::file_copy(url, QUrl::fromLocalFile(tmpFile.fileName()));
KJobWidgets::setWindow(copyJob, parent);
copyJob->exec();
if( copyJob->error() ) {
QString details = i18n("Server URL: %1", url.host());
KMessageBox::detailedSorry(parent, i18n(UNABLE_TO_CONTACT), details);
return false;
}
QTextStream t(&file);
QTextStream t(&tmpFile);
QString content = t.readAll().trimmed();
file.close();
KIO::NetAccess::removeTempFile(tmpFile);
tmpFile.close();
QDomDocument doc;
if ( doc.setContent(content) ) {
......
......@@ -88,7 +88,7 @@
</widget>
</item>
<item>
<widget class="KLineEdit" name="blackName">
<widget class="QLineEdit" name="blackName">
<property name="text">
<string notr="true">username</string>
</property>
......@@ -105,7 +105,7 @@
</widget>
</item>
<item>
<widget class="KComboBox" name="blackSkill"/>
<widget class="QComboBox" name="blackSkill"/>
</item>
</layout>
</item>
......@@ -214,7 +214,7 @@
</widget>
</item>
<item>
<widget class="KLineEdit" name="whiteName">
<widget class="QLineEdit" name="whiteName">
<property name="text">
<string notr="true">username</string>
</property>
......@@ -231,7 +231,7 @@
</widget>
</item>
<item>
<widget class="KComboBox" name="whiteSkill"/>
<widget class="QComboBox" name="whiteSkill"/>
</item>
</layout>
</item>
......@@ -239,18 +239,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>blackHuman</tabstop>
<tabstop>blackAI</tabstop>
......
Markdown is supported
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