kuiserver: remove unused UiServer class

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-29 12:32:36 +03:00
parent 1a9bc706c2
commit b6bfa5574f
9 changed files with 9 additions and 415 deletions

View file

@ -9,17 +9,10 @@ include(MacroDBusAddActivationService)
set(kuiserver_SRCS
main.cpp
uiserver.cpp
jobview.cpp
progresslistmodel.cpp
progresslistdelegate.cpp
requestviewcallwatcher.cpp
configdialog.ui
)
set(kuiserver_KDEINIT_PRIVATE
progresslistdelegate_p.h
uiserver_p.h
)
#<DBus Stuff>

View file

@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>configurationDialog</class>
<widget class="QWidget" name="configurationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>337</width>
<height>259</height>
</rect>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupFinishedJobs">
<property name="title">
<string>Finished Jobs</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QRadioButton" name="kcfg_radioMove">
<property name="text">
<string>Move them to a different list</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="kcfg_radioRemove">
<property name="text">
<string>Remove them</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupAppearance">
<property name="title">
<string>Appearance</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QRadioButton" name="kcfg_radioList">
<property name="text">
<string>Show all jobs in a list</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="kcfg_radioTree">
<property name="text">
<string>Show all jobs in a tree</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_checkShowSeparateWindows">
<property name="text">
<string>Show separate windows</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "uiserver.h"
#include "jobviewadaptor.h"
#include "requestviewcallwatcher.h"
#include "jobview_interface.h"

View file

@ -21,9 +21,6 @@
* Boston, MA 02110-1301, USA.
*/
#include "uiserver.h"
#include "uiserver_p.h"
#include "progresslistmodel.h"
#include <kapplication.h>

View file

@ -19,21 +19,17 @@
*/
#include "progresslistmodel.h"
#include <QDBusServiceWatcher>
#include <KDebug>
#include "jobviewserveradaptor.h"
#include "kuiserveradaptor.h"
#include "jobviewserver_interface.h"
#include "requestviewcallwatcher.h"
#include "uiserver.h"
#include <KDebug>
#include <QDBusServiceWatcher>
#include <QtDBus/qdbusabstractinterface.h>
ProgressListModel::ProgressListModel(QObject *parent)
: QAbstractItemModel(parent), QDBusContext(), m_jobId(1),
m_uiServer(0)
: QAbstractItemModel(parent), QDBusContext(), m_jobId(1)
{
m_serviceWatcher = new QDBusServiceWatcher(this);
m_serviceWatcher->setConnection(QDBusConnection::sessionBus());
@ -57,12 +53,6 @@ ProgressListModel::ProgressListModel(QObject *parent)
if (!sessionBus.registerObject(QLatin1String("/JobViewServer"), this)) {
kDebug(7024) << "failed to register object JobViewServer.";
}
/* unused
if (m_registeredServices.isEmpty() && !m_uiServer) {
m_uiServer = new UiServer(this);
}
*/
}
ProgressListModel::~ProgressListModel()
@ -73,8 +63,6 @@ ProgressListModel::~ProgressListModel()
qDeleteAll(m_jobViews);
qDeleteAll(m_registeredServices);
delete m_uiServer;
}
QModelIndex ProgressListModel::parent(const QModelIndex&) const
@ -235,14 +223,11 @@ QStringList ProgressListModel::gatherJobUrls()
void ProgressListModel::jobFinished(JobView *jobView)
{
// Job finished, delete it if we are not in self-ui mode, *and* the config option to keep finished jobs is set
//TODO: does not check for case for the config
if (!m_uiServer) {
kDebug(7024) << "removing jobview from list, it finished";
m_jobViews.removeOne(jobView);
//job dies, dest. URL's change..
emit jobUrlsChanged(gatherJobUrls());
}
// Job finished, delete it if we are not in self-ui mode, *and* the config option to keep finished jobs is set
kDebug(7024) << "removing jobview from list, it finished";
m_jobViews.removeOne(jobView);
//job dies, dest. URL's change..
emit jobUrlsChanged(gatherJobUrls());
}
void ProgressListModel::jobChanged(uint jobId)
@ -268,10 +253,6 @@ void ProgressListModel::registerService(const QString &serviceName, const QStrin
new org::kde::JobViewServer(serviceName, objectPath, sessionBus);
if (client->isValid()) {
delete m_uiServer;
m_uiServer = 0;
m_serviceWatcher->addWatchedService(serviceName);
m_registeredServices.insert(serviceName, client);
@ -309,13 +290,6 @@ void ProgressListModel::serviceUnregistered(const QString &name)
emit serviceDropped(name);
m_registeredServices.remove(name);
/* unused (FIXME)
if (m_registeredServices.isEmpty()) {
//the last service dropped, we *need* to show our GUI
m_uiServer = new UiServer(this);
}
*/
}
QList<JobView*> jobs = m_jobViewsOwners.values(name);

View file

@ -21,12 +21,9 @@
#ifndef PROGRESSLISTMODEL_H
#define PROGRESSLISTMODEL_H
#include "uiserver.h"
#include "jobview.h"
#include <QDBusContext>
#include <QDBusAbstractInterface>
#include <QDBusServiceWatcher>
@ -34,8 +31,6 @@ class ProgressListModel: public QAbstractItemModel, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.JobViewServer")
public:
explicit ProgressListModel(QObject *parent = 0);
@ -187,7 +182,6 @@ private:
*/
QHash<QString, QDBusAbstractInterface*> m_registeredServices;
UiServer *m_uiServer;
QDBusServiceWatcher *m_serviceWatcher;
};

View file

@ -1,159 +0,0 @@
/*
* This file is part of the KDE project
* Copyright (C) 2009 Shaun Reich <shaun.reich@kdemail.net>
* Copyright (C) 2006-2008 Rafael Fernández López <ereslibre@kde.org>
* Copyright (C) 2001 George Staikos <staikos@kde.org>
* Copyright (C) 2000 Matej Koss <koss@miesto.sk>
* David Faure <faure@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "uiserver.h"
#include "uiserver_p.h"
#include "progresslistmodel.h"
#include "progresslistdelegate.h"
#include <QWidget>
#include <QAction>
#include <QBoxLayout>
#include <QtGui/qevent.h>
#include <QToolBar>
#include <kconfigdialog.h>
#include <klocale.h>
#include <kicon.h>
#include <kdialog.h>
#include <ksystemtrayicon.h>
#include <kpushbutton.h>
UiServer::UiServer(ProgressListModel* model)
: KXmlGuiWindow(0), m_systemTray(0)
{
//NOTE: if enough people really hate this dialog (having centralized information and such),
//I imagine we could somehow forward it to the old dialogs, which would be displayed 1 for each job.
//Or create our own. no worries, we'll see how it plays out..
QString configure = i18n("Configure...");
toolBar = addToolBar(configure);
toolBar->setMovable(false);
toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QAction *configureAction = toolBar->addAction(configure);
configureAction->setIcon(KIcon("configure"));
configureAction->setIconText(configure);
connect(configureAction, SIGNAL(triggered(bool)), this,
SLOT(showConfigurationDialog()));
toolBar->addSeparator();
listProgress = new QListView(this);
listProgress->setAlternatingRowColors(true);
listProgress->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
listProgress->setUniformItemSizes(true);
listProgress->setSelectionMode(QAbstractItemView::NoSelection);
listProgress->setModel(model);
setCentralWidget(listProgress);
progressListDelegate = new ProgressListDelegate(this, listProgress);
progressListDelegate->setSeparatorPixels(5);
progressListDelegate->setLeftMargin(10);
progressListDelegate->setRightMargin(10);
progressListDelegate->setMinimumItemHeight(100);
progressListDelegate->setMinimumContentWidth(300);
progressListDelegate->setEditorHeight(20);
listProgress->setItemDelegate(progressListDelegate);
m_systemTray = new KSystemTrayIcon(this);
m_systemTray->setIcon(KSystemTrayIcon::loadIcon("view-process-system"));
m_systemTray->setToolTip(i18n("List of running file transfers/jobs (kuiserver)"));
m_systemTray->show();
resize(450, 450);
applySettings();
}
UiServer::~UiServer()
{
}
void UiServer::updateConfiguration()
{
Configuration::self()->writeConfig();
applySettings();
}
void UiServer::applySettings()
{
/* not used.
int finishedIndex = tabWidget->indexOf(listFinished);
if (Configuration::radioMove()) {
if (finishedIndex == -1) {
tabWidget->addTab(listFinished, i18n("Finished"));
}
} else if (finishedIndex != -1) {
tabWidget->removeTab(finishedIndex);
} */
}
void UiServer::closeEvent(QCloseEvent *event)
{
event->ignore();
hide();
}
void UiServer::showConfigurationDialog()
{
if (KConfigDialog::showDialog("configuration"))
return;
KConfigDialog *dialog = new KConfigDialog(this, "configuration",
Configuration::self());
UIConfigurationDialog *configurationUI = new UIConfigurationDialog(0);
dialog->addPage(configurationUI, i18n("Behavior"), "configure");
connect(dialog, SIGNAL(settingsChanged(const QString&)), this,
SLOT(updateConfiguration()));
dialog->button(KDialog::Help)->hide();
dialog->show();
}
/// ===========================================================
UIConfigurationDialog::UIConfigurationDialog(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
adjustSize();
}
UIConfigurationDialog::~UIConfigurationDialog()
{
}
/// ===========================================================
#include "moc_uiserver.cpp"
#include "moc_uiserver_p.cpp"

View file

@ -1,67 +0,0 @@
/*
* This file is part of the KDE project
* Copyright (C) 2009 Shaun Reich <shaun.reich@kdemail.net>
* Copyright (C) 2006-2008 Rafael Fernández López <ereslibre@kde.org>
* Copyright (C) 2000 Matej Koss <koss@miesto.sk>
* David Faure <faure@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef UISERVER_H
#define UISERVER_H
#include <QListView>
#include <kxmlguiwindow.h>
#include "jobview.h"
#include <kuiserversettings.h>
class ProgressListModel;
class ProgressListDelegate;
#include <QToolBar>
class KSystemTrayIcon;
class UiServer : public KXmlGuiWindow
{
Q_OBJECT
public:
explicit UiServer(ProgressListModel* model);
~UiServer();
public Q_SLOTS:
void updateConfiguration();
void applySettings();
protected:
virtual void closeEvent(QCloseEvent *event);
private Q_SLOTS:
void showConfigurationDialog();
private:
ProgressListDelegate *progressListDelegate;
QListView *listProgress;
QToolBar *toolBar;
KSystemTrayIcon *m_systemTray;
};
#endif // UISERVER_H

View file

@ -1,38 +0,0 @@
/*
* This file is part of the KDE project
* Copyright (C) 2007 Rafael Fernández López <ereslibre@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef UISERVER_P_H
#define UISERVER_P_H
#include <QWidget>
#include "ui_configdialog.h"
class UIConfigurationDialog
: public QWidget
, private Ui::configurationDialog
{
Q_OBJECT
public:
UIConfigurationDialog(QWidget *parent);
~UIConfigurationDialog();
};
#endif // UISERVER_P_H