mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kdeplasma-addons: drop dock manager support in icontasks applet
DockManager project is no longer supported, for reference: https://launchpad.net/dockmanager Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3621d10a53
commit
73323a4cf2
18 changed files with 3 additions and 2098 deletions
|
@ -6,10 +6,6 @@ set(tasks_SRCS
|
|||
taskgroupitem.cpp
|
||||
applauncheritem.cpp
|
||||
jobmanager.cpp
|
||||
dockmanager.cpp
|
||||
dockitem.cpp
|
||||
dockhelper.cpp
|
||||
dockconfig.cpp
|
||||
mediabuttons.cpp
|
||||
unity.cpp
|
||||
unityitem.cpp
|
||||
|
@ -23,21 +19,8 @@ set(tasks_SRCS
|
|||
tooltips/dialogshadows_p.h
|
||||
appearanceconfig.ui
|
||||
behaviourconfig.ui
|
||||
dockconfig.ui
|
||||
)
|
||||
|
||||
# Generate DBUS XML files, would like to use
|
||||
# qt4_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/dockmanager.h net.launchpad.DockManager.xml)
|
||||
# qt4_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/dockitem.h net.launchpad.DockItem.xml)
|
||||
# ...but this does not work, as we also depend on the xml files in qt4_add_dbus_adaptor :-(
|
||||
# So, need to manually create via:
|
||||
#
|
||||
# qdbuscpp2xml -M -P -S dockmanager.h -o net.launchpad.DockManager.xml
|
||||
# qdbuscpp2xml -M -P -S dockitem.h -o net.launchpad.DockItem.xml
|
||||
|
||||
qt4_add_dbus_adaptor(tasks_SRCS net.launchpad.DockManager.xml dockmanager.h DockManager)
|
||||
qt4_add_dbus_adaptor(tasks_SRCS net.launchpad.DockItem.xml dockitem.h DockItem)
|
||||
|
||||
qt4_add_dbus_interface(tasks_SRCS org.mpris.MediaPlayer2.Player.xml playerv2interface)
|
||||
|
||||
set_source_files_properties(org.freedesktop.MediaPlayer.player.xml PROPERTIES INCLUDE "dbusstatus.h")
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// Own
|
||||
#include "abstracttaskitem.h"
|
||||
#include "dockitem.h"
|
||||
#include "dockmanager.h"
|
||||
#include "unity.h"
|
||||
#include "jobmanager.h"
|
||||
#include "mediabuttons.h"
|
||||
|
@ -331,7 +329,6 @@ AbstractTaskItem::AbstractTaskItem(QGraphicsWidget *parent, Tasks *applet)
|
|||
m_backgroundFadeAnim(0),
|
||||
m_alpha(1),
|
||||
m_backgroundPrefix("normal"),
|
||||
m_dockItem(0),
|
||||
m_unityItem(0),
|
||||
m_activateTimerId(0),
|
||||
m_updateGeometryTimerId(0),
|
||||
|
@ -464,12 +461,8 @@ QString AbstractTaskItem::text() const
|
|||
return QString();
|
||||
}
|
||||
|
||||
QIcon AbstractTaskItem::icon(bool useDockManager) const
|
||||
QIcon AbstractTaskItem::icon() const
|
||||
{
|
||||
if (useDockManager && m_dockItem && !m_dockItem->icon().isNull()) {
|
||||
return m_dockItem->icon();
|
||||
}
|
||||
|
||||
if (m_abstractItem) {
|
||||
if (m_applet->launcherIcons() && m_icon.isNull()) {
|
||||
KUrl launcherUrl(m_abstractItem->launcherUrl());
|
||||
|
@ -967,14 +960,6 @@ void AbstractTaskItem::updateProgress(int v, InfoSource source)
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractTaskItem::dockItemUpdated()
|
||||
{
|
||||
if (m_dockItem) {
|
||||
updateProgress(m_dockItem->progress(), IS_DockManager);
|
||||
queueUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTaskItem::unityItemUpdated()
|
||||
{
|
||||
if (m_unityItem) {
|
||||
|
@ -1195,22 +1180,6 @@ void AbstractTaskItem::drawShine(QPainter *painter, const QStyleOptionGraphicsIt
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractTaskItem::addOverlay(QPixmap &pix)
|
||||
{
|
||||
if (m_dockItem && !m_dockItem->overlayIcon().isNull()) {
|
||||
int overlaySize=(int)(qMin(16.0, qMin(pix.width(), pix.height())/3.0)+0.5);
|
||||
overlaySize=((overlaySize/4)*4)+(overlaySize%4 ? 4 : 0);
|
||||
if(overlaySize>4) {
|
||||
QPixmap overlay = m_dockItem->overlayIcon().pixmap(QSize(overlaySize, overlaySize));
|
||||
if(!overlay.isNull()) {
|
||||
QPainter overlayPainter(&pix);
|
||||
QPoint pos = Qt::RightToLeft == layoutDirection() ? QPoint(pix.width()-overlay.width()+1, 0) : QPoint(0, 0);
|
||||
overlayPainter.drawPixmap(pos, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTaskItem::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *)
|
||||
|
@ -1416,7 +1385,7 @@ void AbstractTaskItem::drawTask(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
kDebug() << bool(option->state & QStyle::State_MouseOver) << m_backgroundFadeAnim <<
|
||||
(m_backgroundFadeAnim ? m_backgroundFadeAnim->state() : QAbstractAnimation::Stopped);*/
|
||||
const bool fadingBg = m_backgroundFadeAnim && m_backgroundFadeAnim->state() == QAbstractAnimation::Running;
|
||||
QIcon icn(icon(true));
|
||||
QIcon icn(icon());
|
||||
QSize iSize = iconR.toRect().size();
|
||||
QPixmap result = icn.pixmap(iSize);
|
||||
|
||||
|
@ -1429,8 +1398,6 @@ void AbstractTaskItem::drawTask(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
}
|
||||
}
|
||||
|
||||
addOverlay(result);
|
||||
|
||||
if ((!fadingBg && !(option->state & QStyle::State_MouseOver)) ||
|
||||
(m_oldBackgroundPrefix != "hover" && m_backgroundPrefix != "hover")) {
|
||||
// QIcon::paint does some alignment work and can lead to funny
|
||||
|
@ -1528,8 +1495,6 @@ void AbstractTaskItem::drawTask(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
|
||||
if (m_unityItem && m_unityItem->countVisible()) {
|
||||
drawBadge(painter, iconR, QString().setNum(m_unityItem->count()));
|
||||
} else if (m_dockItem && !m_dockItem->badge().isEmpty()) {
|
||||
drawBadge(painter, iconR, m_dockItem->badge());
|
||||
}
|
||||
|
||||
if (!showText && JobManager::self()->isEnabled() && m_currentProgress >= 0) {
|
||||
|
@ -1614,31 +1579,19 @@ QList<QAction *> AbstractTaskItem::getAppMenu()
|
|||
appMenu.append(unityActions);
|
||||
}
|
||||
|
||||
if (m_dockItem && !addedUnityItems) {
|
||||
QList<QAction *> dockActions = m_dockItem->menu();
|
||||
if (addedDocs && !dockActions.isEmpty()) {
|
||||
theSepAction.setSeparator(true);
|
||||
appMenu.append(&theSepAction);
|
||||
}
|
||||
appMenu.append(dockActions);
|
||||
}
|
||||
|
||||
return appMenu;
|
||||
}
|
||||
|
||||
void AbstractTaskItem::registerWithHelpers()
|
||||
{
|
||||
JobManager::self()->registerTask(this);
|
||||
DockManager::self()->registerTask(this);
|
||||
Unity::self()->registerTask(this);
|
||||
}
|
||||
|
||||
void AbstractTaskItem::unregisterFromHelpers()
|
||||
{
|
||||
JobManager::self()->unregisterTask(this);
|
||||
DockManager::self()->unregisterTask(this);
|
||||
Unity::self()->unregisterTask(this);
|
||||
m_dockItem = 0;
|
||||
m_unityItem = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
class Tasks;
|
||||
class TaskGroupItem;
|
||||
class LayoutWidget;
|
||||
class DockItem;
|
||||
class UnityItem;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +63,6 @@ public:
|
|||
enum InfoSource {
|
||||
IS_None,
|
||||
IS_Job,
|
||||
IS_DockManager,
|
||||
IS_Unity
|
||||
};
|
||||
|
||||
|
@ -119,7 +117,7 @@ public:
|
|||
virtual QString text() const;
|
||||
|
||||
/** Returns the current icon for this task. */
|
||||
QIcon icon(bool useDockManager = false) const;
|
||||
QIcon icon() const;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
|
@ -165,11 +163,7 @@ public:
|
|||
virtual KUrl launcherUrl() const = 0;
|
||||
virtual QString windowClass() const = 0;
|
||||
void updateProgress(int v, InfoSource source = IS_Job);
|
||||
void dockItemUpdated();
|
||||
void unityItemUpdated();
|
||||
void setDockItem(DockItem *i) {
|
||||
m_dockItem = i;
|
||||
}
|
||||
void setUnityItem(UnityItem *i) {
|
||||
m_unityItem = i;
|
||||
}
|
||||
|
@ -213,7 +207,6 @@ protected:
|
|||
void drawIndicators(QPainter *painter, const QRectF &rect);
|
||||
void drawColoredBackground(QPainter *painter, const QStyleOptionGraphicsItem *option);
|
||||
void drawShine(QPainter *painter, const QStyleOptionGraphicsItem *option);
|
||||
void addOverlay(QPixmap &pix);
|
||||
|
||||
/** Draws the background for the task item. */
|
||||
virtual void drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option);
|
||||
|
@ -273,7 +266,6 @@ protected:
|
|||
qreal m_alpha;
|
||||
QString m_oldBackgroundPrefix;
|
||||
QString m_backgroundPrefix;
|
||||
DockItem *m_dockItem;
|
||||
UnityItem *m_unityItem;
|
||||
|
||||
private:
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "applauncheritem.h"
|
||||
#include "taskgroupitem.h"
|
||||
#include "jobmanager.h"
|
||||
#include "dockmanager.h"
|
||||
#include "dockitem.h"
|
||||
#include "mediabuttons.h"
|
||||
#include "unity.h"
|
||||
|
||||
|
|
|
@ -1,596 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "dockconfig.h"
|
||||
#include "dockmanager.h"
|
||||
#include <KConfigDialog>
|
||||
#include <KStandardDirs>
|
||||
#include <KConfigGroup>
|
||||
#include <KConfig>
|
||||
#include <KLocale>
|
||||
#include <KIcon>
|
||||
#include <KMessageBox>
|
||||
#include <KFileDialog>
|
||||
#include <KTar>
|
||||
#include <KTempDir>
|
||||
#include <KIO/NetAccess>
|
||||
#include <KPushButton>
|
||||
#include <kdeversion.h>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QListWidget>
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtGui/QPainter>
|
||||
#include <sys/stat.h>
|
||||
|
||||
enum ESelection {
|
||||
SelUsable,
|
||||
SelEnabled,
|
||||
SelDisabled,
|
||||
SelAll
|
||||
};
|
||||
|
||||
enum Role {
|
||||
RoleUser = Qt::UserRole,
|
||||
RoleAvailable,
|
||||
RoleDir,
|
||||
RoleScript,
|
||||
RoleComment,
|
||||
RoleApp,
|
||||
RoleDBus
|
||||
};
|
||||
|
||||
DockConfig::DockConfig(KConfigDialog *p)
|
||||
{
|
||||
p->addPage(this, i18n("Dock Manager"), "preferences-system-windows");
|
||||
|
||||
ui.setupUi(this);
|
||||
DockConfigItemDelegate *delegate = new DockConfigItemDelegate(ui.view, this);
|
||||
ui.view->setItemDelegate(delegate);
|
||||
ui.view->sortItems(Qt::AscendingOrder);
|
||||
|
||||
QStringList dirs = DockManager::self()->dirs();
|
||||
QString home = QDir::homePath();
|
||||
|
||||
foreach (QString dir, dirs) {
|
||||
QStringList metas = QDir(QString(dir + "/metadata")).entryList(QStringList() << "*.info");
|
||||
|
||||
foreach (QString m, metas) {
|
||||
Entry e;
|
||||
e.user = dir.startsWith(home);
|
||||
e.script = m.left(m.length() - 5);
|
||||
e.dir = dir;
|
||||
|
||||
QString script = dir + "/scripts/" + e.script;
|
||||
if (QFile::exists(script)) {
|
||||
KConfig cfg(dir + "/metadata/" + m, KConfig::NoGlobals);
|
||||
|
||||
if (cfg.hasGroup("DockmanagerHelper")) {
|
||||
KConfigGroup grp(&cfg, "DockmanagerHelper");
|
||||
e.appName = grp.readEntry("AppName", QString());
|
||||
e.dbusName = grp.readEntry("DBusName", QString());
|
||||
e.description = grp.readEntry("Description", QString());
|
||||
e.name = grp.readEntry("Name", QString());
|
||||
if (!e.name.isEmpty() && !e.description.isEmpty()) {
|
||||
e.icon = grp.readEntry("Icon", QString());
|
||||
e.available = e.appName.isEmpty() || !KStandardDirs::findExe(e.appName).isEmpty();
|
||||
e.enabled = DockManager::self()->enabledHelpers().contains(script);
|
||||
createItem(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui.addButton->setIcon(KIcon("list-add"));
|
||||
ui.removeButton->setIcon(KIcon("list-remove"));
|
||||
ui.enable->setChecked(DockManager::self()->isEnabled());
|
||||
ui.view->setEnabled(ui.enable->isChecked());
|
||||
ui.removeButton->setEnabled(false);
|
||||
ui.addButton->setEnabled(DockManager::self()->isEnabled());
|
||||
|
||||
connect(ui.view, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged()));
|
||||
connect(ui.addButton, SIGNAL(clicked(bool)), SLOT(add()));
|
||||
connect(ui.removeButton, SIGNAL(clicked(bool)), SLOT(del()));
|
||||
connect(ui.enable, SIGNAL(toggled(bool)), SLOT(enableWidgets(bool)));
|
||||
connect(ui.enable, SIGNAL(toggled(bool)), p, SLOT(settingsModified()));
|
||||
connect(delegate, SIGNAL(changed()), this, SIGNAL(settingsModified()));
|
||||
connect(this, SIGNAL(settingsModified()), p, SLOT(settingsModified()));
|
||||
}
|
||||
|
||||
DockConfig::~DockConfig()
|
||||
{
|
||||
// Delete the item delegate, otherwise we get lots of the following printed to the screen:
|
||||
// KWidgetItemDelegateEventListener::eventFilter: User of KWidgetItemDelegate should not delete widgets created by createItemWidgets!
|
||||
QAbstractItemDelegate *delegate = ui.view->itemDelegate();
|
||||
if (delegate) {
|
||||
delete delegate;
|
||||
}
|
||||
}
|
||||
|
||||
bool DockConfig::isEnabled()
|
||||
{
|
||||
return ui.enable->isChecked();
|
||||
}
|
||||
|
||||
QSet<QString> DockConfig::enabledHelpers()
|
||||
{
|
||||
QSet<QString> h;
|
||||
QAbstractItemModel *model = ui.view->model();
|
||||
|
||||
for (int row = 0; row < model->rowCount(); ++row) {
|
||||
QModelIndex idx = model->index(row, 0);
|
||||
|
||||
if (model->data(idx, Qt::CheckStateRole).toBool()) {
|
||||
h.insert(model->data(idx, RoleDir).toString() + "/scripts/" + model->data(idx, RoleScript).toString());
|
||||
}
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
void DockConfig::selectionChanged()
|
||||
{
|
||||
QList<QListWidgetItem*> items = ui.view->selectedItems();
|
||||
QListWidgetItem *item = items.count() ? items.first() : 0L;
|
||||
|
||||
ui.removeButton->setEnabled(ui.enable->isChecked() && item && item->data(RoleUser).toBool());
|
||||
}
|
||||
|
||||
void DockConfig::add()
|
||||
{
|
||||
KFileDialog *dlg = new KFileDialog(KUrl(), QLatin1String("application/x-bzip-compressed-tar application/x-compressed-tar application/x-tar"), this);
|
||||
dlg->setOperationMode(KFileDialog::Opening);
|
||||
dlg->setMode(KFile::File | KFile::LocalOnly | KFile::ExistingOnly);
|
||||
dlg->setCaption(i18n("Open"));
|
||||
dlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dlg->setWindowModality(Qt::WindowModal);
|
||||
connect(dlg, SIGNAL(accepted()), SLOT(fileSelected()));
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void DockConfig::fileSelected()
|
||||
{
|
||||
KFileDialog *dlg = qobject_cast<KFileDialog*>(sender());
|
||||
KUrl url = dlg ? dlg->selectedUrl() : KUrl();
|
||||
|
||||
if (url.isValid()) {
|
||||
QString fileName;
|
||||
|
||||
if (url.isLocalFile()) {
|
||||
fileName = url.toLocalFile();
|
||||
} else {
|
||||
if (!KIO::NetAccess::download(url, fileName, this)) {
|
||||
KMessageBox::error(this, i18n("Sorry, failed to download\n%1", url.prettyUrl()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Uncompress...
|
||||
KTar tar(fileName);
|
||||
|
||||
if (tar.open(QIODevice::ReadOnly)) {
|
||||
const KArchiveDirectory *dir = tar.directory();
|
||||
|
||||
if (dir) {
|
||||
const KArchiveEntry *meta = 0,
|
||||
*script = 0;
|
||||
foreach (QString entry, dir->entries()) {
|
||||
if ("scripts" == entry) {
|
||||
const KArchiveEntry *d = dir->entry(entry);
|
||||
if (d && d->isDirectory()) {
|
||||
foreach (QString f, ((KArchiveDirectory *)d)->entries()) {
|
||||
if (f.endsWith(".py")) {
|
||||
script = ((KArchiveDirectory *)d)->entry(f);
|
||||
break;
|
||||
} else {
|
||||
script = ((KArchiveDirectory *)d)->entry(f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if ("metadata" == entry) {
|
||||
const KArchiveEntry *d = dir->entry(entry);
|
||||
if (d && d->isDirectory()) {
|
||||
foreach (QString f, ((KArchiveDirectory *)d)->entries()) {
|
||||
if (f.endsWith(".info")) {
|
||||
meta = ((KArchiveDirectory *)d)->entry(f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script && meta) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script && meta && meta->name() == (script->name() + ".info")) {
|
||||
Entry e;
|
||||
QString destDir = QString(KGlobal::dirs()->localxdgdatadir() + "/dockmanager").replace("//", "/");
|
||||
QString error;
|
||||
KTempDir tempDir;
|
||||
|
||||
tempDir.setAutoRemove(true);
|
||||
e.user = true;
|
||||
e.script = script->name();
|
||||
e.dir = destDir;
|
||||
|
||||
// Check contents of meta data *before* attempting to install...
|
||||
((KArchiveFile *)meta)->copyTo(tempDir.name());
|
||||
KConfig cfg(tempDir.name() + meta->name(), KConfig::NoGlobals);
|
||||
|
||||
if (cfg.hasGroup("DockmanagerHelper")) {
|
||||
KConfigGroup grp(&cfg, "DockmanagerHelper");
|
||||
e.appName = grp.readEntry("AppName", QString());
|
||||
e.dbusName = grp.readEntry("DBusName", QString());
|
||||
e.description = grp.readEntry("Description", QString());
|
||||
e.name = grp.readEntry("Name", QString());
|
||||
if (!e.name.isEmpty() && !e.description.isEmpty()) {
|
||||
e.icon = grp.readEntry("Icon", QString());
|
||||
e.available = e.appName.isEmpty() || !KStandardDirs::findExe(e.appName).isEmpty();
|
||||
e.enabled = DockManager::self()->enabledHelpers().contains(destDir + "/scripts/" + script->name());
|
||||
} else {
|
||||
error = i18n("<p>Contents of metadata file are invalid.<ul>");
|
||||
if (e.name.isEmpty()) {
|
||||
error += i18n("<li><i>Name</i> field is missing.</li>");
|
||||
}
|
||||
if (e.description.isEmpty()) {
|
||||
error += i18n("<li><i>Description</i> field is missing.</li>");
|
||||
}
|
||||
error += QLatin1String("</ul></p>");
|
||||
}
|
||||
} else {
|
||||
error = i18n("<p>Metadata file does not contain <i>DockmanagerHelper</i> group.</p>");
|
||||
}
|
||||
|
||||
if (!error.isEmpty()) {
|
||||
KMessageBox::detailedError(this, i18n("Invalid DockManager plugin."), error);
|
||||
} else if ((!QFile::exists(destDir + "/metadata/" + meta->name()) &&
|
||||
!QFile::exists(destDir + "/scripts/" + script->name())) ||
|
||||
KMessageBox::Yes == KMessageBox::warningYesNo(this, i18n("<p>A Plugin named <b>%1</b> already exists.</p>"
|
||||
"<p>Overwrite?</p>",
|
||||
script->name()),
|
||||
i18n("Overwrite?"))) {
|
||||
bool abortInstall = false;
|
||||
|
||||
if (QFile::exists(destDir + "/metadata/" + meta->name()) && !QFile::remove(destDir + "/metadata/" + meta->name())) {
|
||||
KMessageBox::error(this, i18n("<p>Sorry, failed to remove previous plugin metadata file.</p>"
|
||||
"<p><i>%1</i></p>", destDir + "/metadata/" + meta->name()));
|
||||
abortInstall = true;
|
||||
}
|
||||
if (!abortInstall && QFile::exists(destDir + "/scripts/" + script->name()) && !QFile::remove(destDir + "/scripts/" + script->name())) {
|
||||
KMessageBox::error(this, i18n("<p>Sorry, failed to remove previous plugin metadata file.</p>"
|
||||
"<p><i>%1</i></p>", destDir + "/scripts/" + script->name()));
|
||||
abortInstall = true;
|
||||
}
|
||||
if (!abortInstall && (!(QDir(destDir + "/scripts/").exists() || KStandardDirs::makeDir(destDir + "/scripts/")))) {
|
||||
KMessageBox::error(this, i18n("<p>Sorry, failed to create scripts folder.</p>"
|
||||
"<p><i>%1</i></p>", destDir + "/scripts/"));
|
||||
abortInstall = true;
|
||||
}
|
||||
if (!abortInstall && (!(QDir(destDir + "/metadata/").exists() || KStandardDirs::makeDir(destDir + "/metadata/")))) {
|
||||
KMessageBox::error(this, i18n("<p>Sorry, failed to create metadata folder.</p>"
|
||||
"<p><i>%1</i></p>", destDir + "/metadata/"));
|
||||
abortInstall = true;
|
||||
}
|
||||
if (!abortInstall) {
|
||||
((KArchiveFile *)script)->copyTo(destDir + "/scripts/");
|
||||
if (!QFile::exists(destDir + "/scripts/" + script->name())) {
|
||||
KMessageBox::error(this, i18n("Sorry, failed to install script file."));
|
||||
abortInstall = true;
|
||||
}
|
||||
}
|
||||
if (!abortInstall) {
|
||||
((KArchiveFile *)meta)->copyTo(destDir + "/metadata/");
|
||||
if (!QFile::exists(destDir + "/metadata/" + meta->name())) {
|
||||
KMessageBox::error(this, i18n("Sorry, failed to install metadata file."));
|
||||
abortInstall = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!abortInstall) {
|
||||
// Make sure script is executable...
|
||||
// Clear any umask before setting file perms
|
||||
mode_t oldMask(umask(0000));
|
||||
::chmod(QFile::encodeName(destDir + "/scripts/" + script->name()).constData(), 0755);
|
||||
// Reset umask
|
||||
::umask(oldMask);
|
||||
|
||||
QListWidgetItem *item = createItem(e);
|
||||
foreach (QListWidgetItem * i, ui.view->selectedItems()) {
|
||||
i->setSelected(false);
|
||||
}
|
||||
item->setSelected(true);
|
||||
ui.view->scrollToItem(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QString error = QLatin1String("<p><ul>");
|
||||
if (!script) {
|
||||
error += i18n("<li>Script file is missing.</li>");
|
||||
}
|
||||
if (!meta) {
|
||||
error += i18n("<li>Metadata file is missing.</li>");
|
||||
}
|
||||
error += QLatin1String("</ul></p>");
|
||||
KMessageBox::detailedError(this, i18n("Invalid DockManager plugin."), error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!url.isLocalFile()) {
|
||||
KIO::NetAccess::removeTempFile(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfig::del()
|
||||
{
|
||||
QList<QListWidgetItem*> items = ui.view->selectedItems();
|
||||
QListWidgetItem *item = items.count() ? items.first() : 0L;
|
||||
|
||||
if (item && item->data(RoleUser).toBool() &&
|
||||
KMessageBox::Yes == KMessageBox::warningYesNo(this, i18n("<p>Are you sure you wish to delete <b>%1</b></p><p><i>(%2)</i></p>",
|
||||
item->text(), item->data(RoleScript).toString()),
|
||||
i18n("Remove Script"))) {
|
||||
QString dir = item->data(RoleDir).toString(),
|
||||
script = item->data(RoleScript).toString();
|
||||
if (QFile::remove(dir + "/scripts/" + script) && QFile::remove(dir + "/metadata/" + script + ".info")) {
|
||||
int row = ui.view->row(item);
|
||||
QListWidgetItem *other = ui.view->item(row + 1);
|
||||
|
||||
if (!other && row > 0) {
|
||||
other = ui.view->item(row - 1);
|
||||
}
|
||||
delete item;
|
||||
if (other) {
|
||||
other->setSelected(true);
|
||||
}
|
||||
emit settingsModified();
|
||||
} else {
|
||||
KMessageBox::error(this, i18n("<p>Failed to delete the script file.</p><p><i>%1</i></p>", dir + "/scripts/" + script));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfig::enableWidgets(bool e)
|
||||
{
|
||||
if (e) {
|
||||
QList<QListWidgetItem*> items = ui.view->selectedItems();
|
||||
QListWidgetItem *item = items.count() ? items.first() : 0L;
|
||||
|
||||
ui.removeButton->setEnabled(item && item->data(RoleUser).toBool());
|
||||
} else {
|
||||
ui.removeButton->setEnabled(false);
|
||||
}
|
||||
ui.addButton->setEnabled(e);
|
||||
ui.view->setEnabled(e);
|
||||
}
|
||||
|
||||
QListWidgetItem * DockConfig::createItem(const Entry &e)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(ui.view);
|
||||
item->setText(e.name);
|
||||
item->setData(RoleComment, e.description);
|
||||
item->setData(Qt::DecorationRole, e.icon);
|
||||
item->setCheckState(e.available && e.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(RoleUser, e.user);
|
||||
item->setData(RoleAvailable, e.available);
|
||||
item->setData(RoleDir, e.dir);
|
||||
item->setData(RoleScript, e.script);
|
||||
item->setData(RoleApp, e.appName);
|
||||
item->setData(RoleDBus, e.dbusName);
|
||||
return item;
|
||||
}
|
||||
|
||||
static const int constMargin = 5;
|
||||
|
||||
DockConfigItemDelegate::DockConfigItemDelegate(QAbstractItemView *itemView, QObject *parent)
|
||||
: KWidgetItemDelegate(itemView, parent)
|
||||
, checkBox(new QCheckBox)
|
||||
, pushButton(new KPushButton)
|
||||
{
|
||||
pushButton->setIcon(KIcon("configure")); // only for getting size matters
|
||||
}
|
||||
|
||||
DockConfigItemDelegate::~DockConfigItemDelegate()
|
||||
{
|
||||
delete checkBox;
|
||||
delete pushButton;
|
||||
}
|
||||
|
||||
int DockConfigItemDelegate::dependantLayoutValue(int value, int width, int totalWidth) const
|
||||
{
|
||||
if (itemView()->layoutDirection() == Qt::LeftToRight) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return totalWidth - width - value;
|
||||
}
|
||||
|
||||
void DockConfigItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int xOffset = checkBox->sizeHint().width();
|
||||
bool disabled = !itemView()->isEnabled() || !index.model()->data(index, RoleAvailable).toBool();
|
||||
|
||||
painter->save();
|
||||
|
||||
QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
|
||||
|
||||
int iconSize = option.rect.height() - constMargin * 2;
|
||||
QPixmap pixmap = KIconLoader::global()->loadIcon(index.model()->data(index, Qt::DecorationRole).toString(),
|
||||
KIconLoader::Desktop, iconSize, disabled ? KIconLoader::DisabledState : KIconLoader::DefaultState);
|
||||
painter->drawPixmap(QRect(dependantLayoutValue(constMargin + option.rect.left() + xOffset, iconSize, option.rect.width()), constMargin + option.rect.top(), iconSize, iconSize),
|
||||
pixmap, QRect(0, 0, iconSize, iconSize));
|
||||
|
||||
|
||||
QRect contentsRect(dependantLayoutValue(constMargin * 2 + iconSize + option.rect.left() + xOffset, option.rect.width() - constMargin * 3 - iconSize - xOffset, option.rect.width()),
|
||||
constMargin + option.rect.top(), option.rect.width() - constMargin * 3 - iconSize - xOffset, option.rect.height() - constMargin * 2);
|
||||
int lessHorizontalSpace = constMargin * 2 + pushButton->sizeHint().width();
|
||||
|
||||
contentsRect.setWidth(contentsRect.width() - lessHorizontalSpace);
|
||||
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
painter->setPen(option.palette.highlightedText().color());
|
||||
}
|
||||
|
||||
if (itemView()->layoutDirection() == Qt::RightToLeft) {
|
||||
contentsRect.translate(lessHorizontalSpace, 0);
|
||||
}
|
||||
|
||||
painter->save();
|
||||
if (disabled) {
|
||||
QPalette pal(option.palette);
|
||||
pal.setCurrentColorGroup(QPalette::Disabled);
|
||||
painter->setPen(pal.text().color());
|
||||
}
|
||||
|
||||
painter->save();
|
||||
QFont font = titleFont(option.font);
|
||||
bool system = !index.model()->data(index, RoleUser).toBool();
|
||||
|
||||
font.setItalic(system);
|
||||
|
||||
QFontMetrics fmTitle(font);
|
||||
painter->setFont(font);
|
||||
painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignTop, fmTitle.elidedText(index.model()->data(index, Qt::DisplayRole).toString(), Qt::ElideRight, contentsRect.width()));
|
||||
painter->restore();
|
||||
|
||||
font = painter->font();
|
||||
font.setItalic(system);
|
||||
painter->setFont(font);
|
||||
painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignBottom, option.fontMetrics.elidedText(index.model()->data(index, RoleComment).toString(), Qt::ElideRight, contentsRect.width()));
|
||||
|
||||
painter->restore();
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QSize DockConfigItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QFont font = titleFont(option.font);
|
||||
QFontMetrics fmTitle(font);
|
||||
|
||||
return QSize(fmTitle.width(index.model()->data(index, Qt::DisplayRole).toString()) + KIconLoader::SizeMedium + constMargin * 5 + pushButton->sizeHint().width(),
|
||||
qMax(KIconLoader::SizeMedium + constMargin * 2, fmTitle.height() + option.fontMetrics.height() + constMargin * 2));
|
||||
}
|
||||
|
||||
QList<QWidget*> DockConfigItemDelegate::createItemWidgets() const
|
||||
{
|
||||
QList<QWidget*> widgetList;
|
||||
|
||||
QCheckBox *enabledCheckBox = new QCheckBox;
|
||||
connect(enabledCheckBox, SIGNAL(clicked(bool)), this, SLOT(itemToggled(bool)));
|
||||
|
||||
KPushButton *aboutPushButton = new KPushButton;
|
||||
aboutPushButton->setIcon(KIcon("dialog-information"));
|
||||
connect(aboutPushButton, SIGNAL(clicked(bool)), this, SLOT(aboutClicked()));
|
||||
|
||||
setBlockedEventTypes(enabledCheckBox, QList<QEvent::Type>() << QEvent::MouseButtonPress
|
||||
<< QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick
|
||||
<< QEvent::KeyPress << QEvent::KeyRelease);
|
||||
|
||||
setBlockedEventTypes(aboutPushButton, QList<QEvent::Type>() << QEvent::MouseButtonPress
|
||||
<< QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick
|
||||
<< QEvent::KeyPress << QEvent::KeyRelease);
|
||||
|
||||
widgetList << enabledCheckBox << aboutPushButton;
|
||||
|
||||
return widgetList;
|
||||
}
|
||||
|
||||
void DockConfigItemDelegate::updateItemWidgets(const QList<QWidget*> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
|
||||
{
|
||||
QCheckBox *checkBox = static_cast<QCheckBox*>(widgets[0]);
|
||||
checkBox->resize(checkBox->sizeHint());
|
||||
checkBox->move(dependantLayoutValue(constMargin, checkBox->sizeHint().width(), option.rect.width()), option.rect.height() / 2 - checkBox->sizeHint().height() / 2);
|
||||
|
||||
KPushButton *aboutPushButton = static_cast<KPushButton*>(widgets[1]);
|
||||
QSize aboutPushButtonSizeHint = aboutPushButton->sizeHint();
|
||||
aboutPushButton->resize(aboutPushButtonSizeHint);
|
||||
aboutPushButton->move(dependantLayoutValue(option.rect.width() - constMargin - aboutPushButtonSizeHint.width(), aboutPushButtonSizeHint.width(), option.rect.width()),
|
||||
option.rect.height() / 2 - aboutPushButtonSizeHint.height() / 2);
|
||||
|
||||
if (!index.isValid() || !index.internalPointer()) {
|
||||
checkBox->setVisible(false);
|
||||
aboutPushButton->setVisible(false);
|
||||
} else {
|
||||
checkBox->setChecked(index.model()->data(index, Qt::CheckStateRole).toBool());
|
||||
checkBox->setEnabled(index.model()->data(index, RoleAvailable).toBool());
|
||||
}
|
||||
}
|
||||
|
||||
QFont DockConfigItemDelegate::titleFont(const QFont &baseFont) const
|
||||
{
|
||||
QFont retFont(baseFont);
|
||||
retFont.setBold(true);
|
||||
|
||||
return retFont;
|
||||
}
|
||||
|
||||
void DockConfigItemDelegate::itemToggled(bool e)
|
||||
{
|
||||
const QModelIndex index = focusedIndex();
|
||||
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const_cast<QAbstractItemModel*>(focusedIndex().model())->setData(index, e, Qt::CheckStateRole);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void DockConfigItemDelegate::aboutClicked()
|
||||
{
|
||||
const QModelIndex index = focusedIndex();
|
||||
|
||||
if (!index.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QAbstractItemModel *model = index.model();
|
||||
QString appName(model->data(index, RoleApp).toString());
|
||||
QString dbusName(model->data(index, RoleDBus).toString());
|
||||
|
||||
KMessageBox::information(itemView(),
|
||||
QString("%1<hr style=\"height: 1px;border: 0px\" />").arg(model->data(index, RoleComment).toString()) +
|
||||
QString("<table>") +
|
||||
i18n("<tr><td align=\"right\">Script File:</td><td>%1</td></tr>", model->data(index, RoleScript).toString()) +
|
||||
i18n("<tr><td align=\"right\">Location:</td><td>%1</td></tr>", model->data(index, RoleDir).toString()) +
|
||||
(appName.isEmpty() ? QString() : i18n("<tr><td align=\"right\">Application:</td><td>%1</td></tr>", appName)) +
|
||||
(dbusName.isEmpty() ? QString() : i18n("<tr><td align=\"right\">D-Bus:</td><td>%1</td></tr>", dbusName)) +
|
||||
QString("</table>"),
|
||||
model->data(index, Qt::DisplayRole).toString()
|
||||
,QString(), KMessageBox::WindowModal
|
||||
);
|
||||
}
|
||||
|
||||
#include "moc_dockconfig.cpp"
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __DOCKCONFIG_H__
|
||||
#define __DOCKCONFIG_H__
|
||||
|
||||
#include "ui_dockconfig.h"
|
||||
#include <KWidgetItemDelegate>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QSet>
|
||||
|
||||
class KConfigDialog;
|
||||
class KPushButton;
|
||||
#include <QCheckBox>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
class DockConfigItemDelegate : public KWidgetItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
DockConfigItemDelegate(QAbstractItemView *itemView, QObject *parent = 0);
|
||||
virtual ~DockConfigItemDelegate();
|
||||
|
||||
int dependantLayoutValue(int value, int width, int totalWidth) const;
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
QList<QWidget*> createItemWidgets() const;
|
||||
void updateItemWidgets(const QList<QWidget*> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const;
|
||||
QFont titleFont(const QFont &baseFont) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void itemToggled(bool e);
|
||||
void aboutClicked();
|
||||
|
||||
private:
|
||||
QCheckBox *checkBox;
|
||||
KPushButton *pushButton;
|
||||
};
|
||||
|
||||
class DockConfig : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
struct Entry {
|
||||
QString dir;
|
||||
QString script;
|
||||
QString name;
|
||||
QString description;
|
||||
QString icon;
|
||||
bool available;
|
||||
bool enabled;
|
||||
bool user;
|
||||
QString appName;
|
||||
QString dbusName;
|
||||
};
|
||||
|
||||
public:
|
||||
DockConfig(KConfigDialog *p);
|
||||
virtual ~DockConfig();
|
||||
|
||||
bool isEnabled();
|
||||
QSet<QString> enabledHelpers();
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsModified();
|
||||
|
||||
public Q_SLOTS:
|
||||
void selectionChanged();
|
||||
void add();
|
||||
void fileSelected();
|
||||
void del();
|
||||
void enableWidgets(bool e);
|
||||
|
||||
private:
|
||||
QListWidgetItem * createItem(const Entry &e);
|
||||
|
||||
private:
|
||||
Ui::DockConfig ui;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,62 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DockConfig</class>
|
||||
<widget class="QWidget" name="DockConfig">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>399</width>
|
||||
<height>209</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="enable">
|
||||
<property name="text">
|
||||
<string>Enable DockManager Plugins</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="3">
|
||||
<widget class="QListWidget" name="view">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "dockhelper.h"
|
||||
#include "dockmanager.h"
|
||||
#include <KConfig>
|
||||
#include <KConfigGroup>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtDBus/QDBusServiceWatcher>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <KDebug>
|
||||
#include <KStandardDirs>
|
||||
|
||||
DockHelper::DockHelper(const QString &dir, const QString &fn)
|
||||
: m_fileName(fn)
|
||||
, m_dir(dir)
|
||||
, m_valid(false)
|
||||
, m_proc(0)
|
||||
{
|
||||
|
||||
if (QFile::exists(m_dir + "/metadata/" + m_fileName + ".info") && QFile::exists(m_dir + "/scripts/" + m_fileName)) {
|
||||
KConfig cfg(m_dir + "/metadata/" + m_fileName + ".info", KConfig::NoGlobals);
|
||||
|
||||
if (cfg.hasGroup("DockmanagerHelper")) {
|
||||
KConfigGroup grp(&cfg, "DockmanagerHelper");
|
||||
QString appName = grp.readEntry("AppName", QString());
|
||||
m_dBusName = grp.readEntry("DBusName", QString());
|
||||
m_valid = appName.isEmpty() || !KStandardDirs::findExe(appName).isEmpty();
|
||||
|
||||
if (m_valid) {
|
||||
if (m_dBusName.isEmpty()) {
|
||||
start();
|
||||
} else {
|
||||
QDBusServiceWatcher *watcher = new QDBusServiceWatcher(m_dBusName,
|
||||
QDBusConnection::sessionBus(),
|
||||
QDBusServiceWatcher::WatchForOwnerChange, this);
|
||||
connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceOwnerChanged(QString, QString, QString)));
|
||||
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered(m_dBusName);
|
||||
if (reply.isValid() && reply.value()) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DockHelper::~DockHelper()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void DockHelper::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
Q_UNUSED(oldOwner)
|
||||
|
||||
if (newOwner.isEmpty()) {
|
||||
stop();
|
||||
} else {
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
void DockHelper::start()
|
||||
{
|
||||
if (m_valid && !m_proc) {
|
||||
m_proc = new QProcess(this);
|
||||
m_proc->start(m_dir + "/scripts/" + m_fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void DockHelper::stop()
|
||||
{
|
||||
if (m_proc) {
|
||||
m_proc->close();
|
||||
m_proc->deleteLater();
|
||||
m_proc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_dockhelper.cpp"
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __DOCKHELPER_H__
|
||||
#define __DOCKHELPER_H__
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
class DockHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DockHelper(const QString &dir, const QString &fn);
|
||||
virtual ~DockHelper();
|
||||
|
||||
operator bool() const {
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
const QString & fileName() const {
|
||||
return m_fileName;
|
||||
}
|
||||
const QString & dirName() const {
|
||||
return m_dir;
|
||||
}
|
||||
Q_PID pid() const {
|
||||
return m_proc ? m_proc->pid() : 0;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
QString m_dir;
|
||||
QString m_app;
|
||||
QString m_dBusName;
|
||||
bool m_valid;
|
||||
QProcess *m_proc;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,269 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "dockitem.h"
|
||||
#include "dockitemadaptor.h"
|
||||
#include "dockmanager.h"
|
||||
#include "abstracttaskitem.h"
|
||||
#include <KDesktopFile>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
static qulonglong itemCount = 0;
|
||||
|
||||
static QIcon getIcon(const QString &file, const QString &name=QString())
|
||||
{
|
||||
if (!file.isEmpty()) {
|
||||
if (QFile::exists(file)) {
|
||||
return QIcon(file);
|
||||
} else if (QIcon::hasThemeIcon(file)) {
|
||||
return QIcon::fromTheme(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
|
||||
return QIcon::fromTheme(name);
|
||||
}
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
DockItem::DockItem(const KUrl &desktopFile)
|
||||
: m_url(desktopFile)
|
||||
, m_timer(0)
|
||||
, m_progress(-1)
|
||||
, m_menuIdCount(0)
|
||||
{
|
||||
new DockItemAdaptor(this);
|
||||
m_path = QLatin1String("/net/launchpad/DockManager/Item") + QString().setNum(itemCount++);
|
||||
QDBusConnection::sessionBus().registerObject(m_path, this);
|
||||
}
|
||||
|
||||
DockItem::~DockItem()
|
||||
{
|
||||
foreach (AbstractTaskItem * i, m_tasks) {
|
||||
i->setDockItem(0);
|
||||
}
|
||||
|
||||
QDBusConnection::sessionBus().unregisterObject(m_path, QDBusConnection::UnregisterTree);
|
||||
}
|
||||
|
||||
QString DockItem::DesktopFile() const
|
||||
{
|
||||
return m_url.toLocalFile();
|
||||
}
|
||||
|
||||
QString DockItem::Uri() const
|
||||
{
|
||||
return m_url.url();
|
||||
}
|
||||
|
||||
QString DockItem::name() const
|
||||
{
|
||||
if (m_name.isEmpty() && m_url.isLocalFile() && KDesktopFile::isDesktopFile(m_url.toLocalFile())) {
|
||||
m_name = KDesktopFile(m_url.toLocalFile()).readName();
|
||||
}
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QList<QAction *> DockItem::menu() const
|
||||
{
|
||||
QList<QAction *> acts;
|
||||
QSet<QString> insertedMenus;
|
||||
|
||||
foreach (QAction * act, m_menu.values()) {
|
||||
QString title = act->property("container-title").toString();
|
||||
if (!title.isEmpty() && m_actionMenus.contains(title)) {
|
||||
if (!insertedMenus.contains(title)) {
|
||||
insertedMenus.insert(title);
|
||||
acts.append(m_actionMenus[title]->menuAction());
|
||||
}
|
||||
} else {
|
||||
acts.append(act);
|
||||
}
|
||||
}
|
||||
return acts;
|
||||
}
|
||||
|
||||
unsigned int DockItem::AddMenuItem(QMap<QString, QVariant> hints)
|
||||
{
|
||||
if (calledFromDBus()) {
|
||||
DockManager::self()->itemService(this, message().service());
|
||||
}
|
||||
|
||||
QString label,
|
||||
iconName,
|
||||
iconFile,
|
||||
container;
|
||||
|
||||
/*if (hints.contains("uri")) {
|
||||
} else*/ {
|
||||
label = hints["label"].toString();
|
||||
iconName = hints["icon-name"].toString();
|
||||
iconFile = hints["icon-file"].toString();
|
||||
container = hints["container-title"].toString();
|
||||
}
|
||||
|
||||
unsigned int id = m_menuIdCount++;
|
||||
QIcon icon = getIcon(iconFile, iconName);
|
||||
QAction *action = icon.isNull()
|
||||
? new QAction(label, this)
|
||||
: new QAction(icon, label, this);
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
||||
action->setData(id);
|
||||
action->setProperty("container-title", container);
|
||||
if (!m_actionMenus.contains(container)) {
|
||||
m_actionMenus.insert(container, new QMenu(container, 0));
|
||||
}
|
||||
m_actionMenus[container]->addAction(action);
|
||||
m_menu.insert(id, action);
|
||||
return id;
|
||||
}
|
||||
|
||||
void DockItem::RemoveMenuItem(unsigned int id)
|
||||
{
|
||||
if (calledFromDBus()) {
|
||||
DockManager::self()->itemService(this, message().service());
|
||||
}
|
||||
|
||||
if (m_menu.contains(id)) {
|
||||
QAction *act = m_menu[id];
|
||||
QString title = act->property("container-title").toString();
|
||||
if (!title.isEmpty() && m_actionMenus.contains(title)) {
|
||||
m_actionMenus[title]->removeAction(act);
|
||||
if (m_actionMenus[title]->actions().isEmpty()) {
|
||||
m_actionMenus[title]->deleteLater();
|
||||
m_actionMenus.remove(title);
|
||||
}
|
||||
}
|
||||
disconnect(act, SIGNAL(triggered()), this, SLOT(menuActivated()));
|
||||
m_menu.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::menuActivated()
|
||||
{
|
||||
QObject *s = sender();
|
||||
if (s && qobject_cast<QAction *>(s)) {
|
||||
QAction *item = static_cast<QAction *>(s);
|
||||
emit MenuItemActivated(item->data().toUInt());
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::UpdateDockItem(QMap<QString, QVariant> hints)
|
||||
{
|
||||
if (calledFromDBus()) {
|
||||
DockManager::self()->itemService(this, message().service());
|
||||
}
|
||||
|
||||
QMap<QString, QVariant>::ConstIterator it(hints.constBegin()),
|
||||
end(hints.constEnd());
|
||||
int updated = 0;
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (it.key() == "badge") {
|
||||
QString badge = it.value().toString();
|
||||
if (badge != m_badge) {
|
||||
m_badge = badge;
|
||||
updated++;
|
||||
}
|
||||
} else if (it.key() == "progress") {
|
||||
int prog = it.value().toInt();
|
||||
if (prog != m_progress) {
|
||||
m_progress = prog;
|
||||
updated++;
|
||||
}
|
||||
} else if (it.key() == "icon-file") {
|
||||
m_icon = getIcon(it.value().toString());
|
||||
updated++;
|
||||
} else if (it.key() == "x-kde-overlay") {
|
||||
m_overlayIcon = getIcon(it.value().toString());
|
||||
updated++;
|
||||
}
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
foreach (AbstractTaskItem * i, m_tasks) {
|
||||
i->dockItemUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::registerTask(AbstractTaskItem *item)
|
||||
{
|
||||
m_tasks.insert(item);
|
||||
item->setDockItem(this);
|
||||
if (!m_badge.isEmpty() || !m_icon.isNull() || !m_overlayIcon.isNull() || (m_progress >= 0 && m_progress <= 100)) {
|
||||
item->dockItemUpdated();
|
||||
}
|
||||
if (m_timer) {
|
||||
m_timer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::unregisterTask(AbstractTaskItem *item)
|
||||
{
|
||||
m_tasks.remove(item);
|
||||
|
||||
if (0 == m_tasks.count()) {
|
||||
// No current tasks, so set off timer. If nothing registers then we are no longer used...
|
||||
if (!m_timer) {
|
||||
m_timer = new QTimer(this);
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(check()));
|
||||
}
|
||||
m_timer->start(500);
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::reset()
|
||||
{
|
||||
bool updated = !m_badge.isEmpty() || !m_icon.isNull() || !m_overlayIcon.isNull() || (m_progress >= 0 && m_progress <= 100);
|
||||
|
||||
m_badge = QString();
|
||||
m_icon = QIcon();
|
||||
m_progress = -1;
|
||||
|
||||
foreach (QAction * mnu, m_menu.values()) {
|
||||
mnu->deleteLater();
|
||||
}
|
||||
|
||||
m_menu.clear();
|
||||
|
||||
if (updated) {
|
||||
foreach (AbstractTaskItem * i, m_tasks) {
|
||||
i->dockItemUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockItem::check()
|
||||
{
|
||||
if (0 == m_tasks.count()) {
|
||||
DockManager::self()->remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_dockitem.cpp"
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __DOCKITEM_H__
|
||||
#define __DOCKITEM_H__
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <KUrl>
|
||||
|
||||
class AbstractTaskItem;
|
||||
#include <QAction>
|
||||
#include <QTimer>
|
||||
#include <QMenu>
|
||||
|
||||
class DockItem : public QObject, protected QDBusContext
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "net.launchpad.DockItem")
|
||||
Q_PROPERTY(QString DesktopFile READ DesktopFile)
|
||||
Q_PROPERTY(QString Uri READ Uri)
|
||||
|
||||
public:
|
||||
|
||||
DockItem(const KUrl &desktopFile);
|
||||
~DockItem();
|
||||
|
||||
QString DesktopFile() const;
|
||||
QString Uri() const;
|
||||
const QString & path() const {
|
||||
return m_path;
|
||||
}
|
||||
QString name() const;
|
||||
const KUrl & url() const {
|
||||
return m_url;
|
||||
}
|
||||
const QIcon & icon() const {
|
||||
return m_icon;
|
||||
}
|
||||
const QIcon & overlayIcon() const {
|
||||
return m_overlayIcon;
|
||||
}
|
||||
const QString & badge() const {
|
||||
return m_badge;
|
||||
}
|
||||
int progress() const {
|
||||
return m_progress;
|
||||
}
|
||||
QList<QAction *> menu() const;
|
||||
|
||||
void registerTask(AbstractTaskItem *item);
|
||||
void unregisterTask(AbstractTaskItem *item);
|
||||
void reset();
|
||||
|
||||
public Q_SLOTS:
|
||||
Q_SCRIPTABLE unsigned int AddMenuItem(QMap<QString, QVariant> hints);
|
||||
void RemoveMenuItem(unsigned int id);
|
||||
void UpdateDockItem(QMap<QString, QVariant> hints);
|
||||
|
||||
private Q_SLOTS:
|
||||
void menuActivated();
|
||||
void check();
|
||||
|
||||
Q_SIGNALS:
|
||||
void MenuItemActivated(unsigned int id);
|
||||
|
||||
private:
|
||||
KUrl m_url;
|
||||
QString m_path;
|
||||
mutable QString m_name;
|
||||
QSet<AbstractTaskItem *> m_tasks;
|
||||
QMap<unsigned int, QAction *> m_menu;
|
||||
QTimer *m_timer;
|
||||
QString m_remoteService;
|
||||
QMap<QString, QMenu *> m_actionMenus;
|
||||
|
||||
QString m_badge;
|
||||
QIcon m_icon;
|
||||
QIcon m_overlayIcon;
|
||||
int m_progress;
|
||||
unsigned int m_menuIdCount;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,537 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "dockmanager.h"
|
||||
#include "dockmanageradaptor.h"
|
||||
#include "dockitem.h"
|
||||
#include "dockhelper.h"
|
||||
#include "dockconfig.h"
|
||||
#include "tasks.h"
|
||||
#include "abstracttaskitem.h"
|
||||
#include "windowtaskitem.h"
|
||||
#include <KGlobal>
|
||||
#include <KStandardDirs>
|
||||
#include <KDirWatch>
|
||||
#include <KConfigDialog>
|
||||
#include <KDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtDBus/QDBusServiceWatcher>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
static const QString constDbusService = "net.launchpad.DockManager";
|
||||
static const QString constDbusObject = "/net/launchpad/DockManager";
|
||||
|
||||
static QString appFromPid(uint pid)
|
||||
{
|
||||
QFile f(QString("/proc/%1/cmdline").arg(pid));
|
||||
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QByteArray bytes = f.read(1024);
|
||||
|
||||
if (bytes.length() > 2) {
|
||||
return QString(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
K_GLOBAL_STATIC(DockManager, dockMgr)
|
||||
|
||||
DockManager * DockManager::self()
|
||||
{
|
||||
return dockMgr;
|
||||
}
|
||||
|
||||
DockManager::DockManager()
|
||||
: m_enabled(false)
|
||||
, m_connected(false)
|
||||
, m_timer(0)
|
||||
, m_config(0)
|
||||
, m_watcher(0)
|
||||
{
|
||||
new DockManagerAdaptor(this);
|
||||
}
|
||||
|
||||
void DockManager::setEnabled(bool en)
|
||||
{
|
||||
if (en != m_enabled) {
|
||||
m_enabled = en;
|
||||
if (m_enabled) {
|
||||
if (QDBusConnection::sessionBus().registerService(constDbusService)) {
|
||||
if (QDBusConnection::sessionBus().registerObject(constDbusObject, this)) {
|
||||
if (stopDaemon()) {
|
||||
m_connected = true;
|
||||
reloadItems();
|
||||
QTimer::singleShot(500, this, SLOT(updateHelpers()));
|
||||
QStringList dirList = dirs();
|
||||
foreach (QString dir, dirList) {
|
||||
KDirWatch::self()->addDir(dir + "/scripts");
|
||||
KDirWatch::self()->addDir(dir + "/metadata");
|
||||
}
|
||||
connect(KDirWatch::self(), SIGNAL(dirty(const QString&)), this, SLOT(updateHelpersDelayed()));
|
||||
} else {
|
||||
kDebug() << "Cannot start dock mamanger interface, failed to terminate dockamanger-daemon";
|
||||
}
|
||||
} else {
|
||||
kDebug() << "Failed to register dock mamanger object";
|
||||
}
|
||||
} else {
|
||||
kDebug() << "Failed to register dock mamanger service";
|
||||
}
|
||||
} else {
|
||||
if (m_connected) {
|
||||
QDBusConnection::sessionBus().unregisterService(constDbusService);
|
||||
QDBusConnection::sessionBus().unregisterObject(constDbusObject, QDBusConnection::UnregisterTree);
|
||||
// Allow dockmanager-daemon to run...
|
||||
QDBusConnection::sessionBus().unregisterService(constDbusService + ".Daemon");
|
||||
|
||||
QStringList dirList = dirs();
|
||||
foreach (QString dir, dirList) {
|
||||
KDirWatch::self()->removeDir(dir + "/scripts");
|
||||
KDirWatch::self()->removeDir(dir + "/metadata");
|
||||
}
|
||||
disconnect(KDirWatch::self(), SIGNAL(dirty(const QString&)), this, SLOT(updateHelpersDelayed()));
|
||||
if (m_timer) {
|
||||
m_timer->stop();
|
||||
}
|
||||
}
|
||||
foreach (DockHelper * helper, m_helpers) {
|
||||
delete helper;
|
||||
}
|
||||
m_helpers.clear();
|
||||
QMap<KUrl, DockItem *>::ConstIterator it(m_items.constBegin()),
|
||||
end(m_items.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
m_items.clear();
|
||||
m_itemService.clear();
|
||||
if (m_watcher) {
|
||||
disconnect(m_watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), this, SLOT(serviceOwnerChanged(QString, QString, QString)));
|
||||
m_watcher->deleteLater();
|
||||
m_watcher = 0;
|
||||
}
|
||||
// **Don't clear tasks** these will be neeaded if re-enable...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Thread : public QThread {
|
||||
public:
|
||||
static void msleep(unsigned long ms) {
|
||||
QThread::msleep(ms);
|
||||
}
|
||||
};
|
||||
|
||||
bool DockManager::stopDaemon()
|
||||
{
|
||||
QDBusReply<uint> reply = QDBusConnection::sessionBus().interface()->servicePid(constDbusService + ".Daemon");
|
||||
|
||||
if (reply.isValid()) {
|
||||
uint pid = reply.value();
|
||||
|
||||
if (pid > 0) {
|
||||
if (appFromPid(pid).endsWith("dockmanager-daemon")) {
|
||||
kDebug() << "Stopping dockmanager-daemon, pid" << pid;
|
||||
if (::kill(pid, SIGTERM)) {
|
||||
return false;
|
||||
} else {
|
||||
Thread::msleep(250);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now register the service for ourselces, to prevent it starting...
|
||||
QDBusConnection::sessionBus().registerService("net.launchpad.DockManager.Daemon");
|
||||
return true;
|
||||
}
|
||||
|
||||
void DockManager::reloadItems()
|
||||
{
|
||||
if (!m_connected || !m_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMap<KUrl, DockItem *> existing = m_items;
|
||||
QMap<AbstractTaskItem *, KUrl>::ConstIterator taskIt(m_tasks.constBegin()),
|
||||
taskEnd(m_tasks.constEnd());
|
||||
|
||||
for (; taskIt != taskEnd; ++taskIt) {
|
||||
if (m_items.contains(taskIt.value())) {
|
||||
existing.remove(taskIt.value());
|
||||
} else {
|
||||
DockItem *item = new DockItem(taskIt.value());
|
||||
m_items.insert(taskIt.value(), item);
|
||||
emit ItemAdded(QDBusObjectPath(item->path()));
|
||||
item->registerTask(taskIt.key());
|
||||
}
|
||||
}
|
||||
|
||||
QMap<KUrl, DockItem *>::ConstIterator it(existing.constBegin()),
|
||||
end(existing.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
QStringList services = m_itemService.keys(it.value());
|
||||
foreach (QString srv, services) {
|
||||
if (m_watcher) {
|
||||
m_watcher->removeWatchedService(srv);
|
||||
}
|
||||
m_itemService.remove(srv);
|
||||
}
|
||||
emit ItemRemoved(QDBusObjectPath(it.value()->path()));
|
||||
delete it.value();
|
||||
m_items.remove(it.key());
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::registerTask(AbstractTaskItem *item)
|
||||
{
|
||||
if (!m_tasks.contains(item)) {
|
||||
KUrl url = item->launcherUrl();
|
||||
|
||||
if (url.isValid()) {
|
||||
m_tasks.insert(item, url);
|
||||
|
||||
if (m_connected) {
|
||||
if (!m_items.contains(url)) {
|
||||
DockItem *item = new DockItem(url);
|
||||
m_items.insert(url, item);
|
||||
emit ItemAdded(QDBusObjectPath(item->path()));
|
||||
}
|
||||
|
||||
m_items[url]->registerTask(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::unregisterTask(AbstractTaskItem *item)
|
||||
{
|
||||
if (m_tasks.contains(item)) {
|
||||
KUrl url = m_tasks[item];
|
||||
|
||||
if (m_connected) {
|
||||
// Remove the DockItem if this task was not associated with a launcher...
|
||||
if (url.isValid() && m_items.contains(url)) {
|
||||
m_items[url]->unregisterTask(item);
|
||||
}
|
||||
}
|
||||
m_tasks.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::remove(DockItem *item)
|
||||
{
|
||||
if (item) {
|
||||
emit ItemRemoved(QDBusObjectPath(item->path()));
|
||||
if (m_items.contains(item->url())) {
|
||||
m_items.remove(item->url());
|
||||
}
|
||||
item->deleteLater();
|
||||
if (m_watcher) {
|
||||
foreach (QString srv, m_itemService.keys(item)) {
|
||||
m_watcher->removeWatchedService(srv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::itemService(DockItem *item, const QString &serviceName)
|
||||
{
|
||||
if (m_watcher && m_watcher->watchedServices().contains(serviceName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusReply<uint> reply = QDBusConnection::sessionBus().interface()->servicePid(serviceName);
|
||||
uint servicePid = reply.isValid() ? reply.value() : 0;
|
||||
bool watchService = false;
|
||||
|
||||
if (0 != servicePid) {
|
||||
foreach (DockHelper * helper, m_helpers) {
|
||||
if (helper->pid() == servicePid) {
|
||||
watchService = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!watchService) { // .desktop
|
||||
return;
|
||||
}
|
||||
if (m_watcher) {
|
||||
QStringList old = m_itemService.keys(item);
|
||||
if (old.count()) {
|
||||
foreach (QString srv, old) {
|
||||
m_watcher->removeWatchedService(srv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_watcher) {
|
||||
m_watcher = new QDBusServiceWatcher(this);
|
||||
m_watcher->setConnection(QDBusConnection::sessionBus());
|
||||
m_watcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange);
|
||||
connect(m_watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), this, SLOT(serviceOwnerChanged(QString, QString, QString)));
|
||||
}
|
||||
|
||||
m_watcher->addWatchedService(serviceName);
|
||||
m_itemService[serviceName] = item;
|
||||
}
|
||||
|
||||
QStringList DockManager::GetCapabilities()
|
||||
{
|
||||
return QStringList()
|
||||
// << "dock-item-message"
|
||||
// << "dock-item-tooltip"
|
||||
<< "dock-item-badge"
|
||||
<< "dock-item-progress"
|
||||
// << "dock-item-visible"
|
||||
<< "dock-item-icon-file"
|
||||
// << "dock-item-attention"
|
||||
// << "dock-item-waiting"
|
||||
<< "x-kde-dock-item-overlay"
|
||||
<< "menu-item-with-label"
|
||||
// << "menu-item-with-uri"
|
||||
<< "menu-item-icon-name"
|
||||
<< "menu-item-icon-file"
|
||||
<< "menu-item-container-title";
|
||||
}
|
||||
|
||||
QDBusObjectPath DockManager::GetItemByXid(qlonglong xid)
|
||||
{
|
||||
QMap<AbstractTaskItem *, KUrl>::ConstIterator it(m_tasks.constBegin()),
|
||||
end(m_tasks.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (TaskManager::TaskItemType == it.key()->abstractItem()->itemType()) {
|
||||
WindowTaskItem *item = static_cast<WindowTaskItem *>(it.key());
|
||||
if (item->windowTask() && item->windowTask()->window() == xid) {
|
||||
if (m_items.contains(it.value())) {
|
||||
return QDBusObjectPath(m_items[it.value()]->path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QDBusObjectPath();
|
||||
}
|
||||
|
||||
QList<QDBusObjectPath> DockManager::GetItems()
|
||||
{
|
||||
QList<QDBusObjectPath> items;
|
||||
|
||||
QMap<KUrl, DockItem *>::ConstIterator it(m_items.constBegin()),
|
||||
end(m_items.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
items.append(QDBusObjectPath((*it)->path()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
QList<QDBusObjectPath> DockManager::GetItemsByDesktopFile(const QString &desktopFile)
|
||||
{
|
||||
QList<QDBusObjectPath> items;
|
||||
|
||||
QMap<KUrl, DockItem *>::ConstIterator it(m_items.constBegin()),
|
||||
end(m_items.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if ((*it)->DesktopFile() == desktopFile) {
|
||||
items.append(QDBusObjectPath((*it)->path()));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
QList<QDBusObjectPath> DockManager::GetItemsByName(QString name)
|
||||
{
|
||||
QList<QDBusObjectPath> items;
|
||||
|
||||
QMap<KUrl, DockItem *>::ConstIterator it(m_items.constBegin()),
|
||||
end(m_items.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if ((*it)->name() == name) {
|
||||
items.append(QDBusObjectPath((*it)->path()));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
QList<QDBusObjectPath> DockManager::GetItemsByPid(int pid)
|
||||
{
|
||||
QList<QDBusObjectPath> items;
|
||||
|
||||
QMap<AbstractTaskItem *, KUrl>::ConstIterator it(m_tasks.constBegin()),
|
||||
end(m_tasks.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (TaskManager::TaskItemType == it.key()->abstractItem()->itemType()) {
|
||||
WindowTaskItem *item = static_cast<WindowTaskItem *>(it.key());
|
||||
|
||||
if (item->windowTask() && item->windowTask()->pid() == pid) {
|
||||
if (m_items.contains(it.value())) {
|
||||
items.append(QDBusObjectPath(m_items[it.value()]->path()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
QStringList DockManager::dirs() const
|
||||
{
|
||||
return QStringList() << QString(KGlobal::dirs()->localxdgdatadir() + "/dockmanager").replace("//", "/")
|
||||
<< "/usr/local/share/dockmanager"
|
||||
<< "/usr/share/dockmanager";
|
||||
}
|
||||
|
||||
void DockManager::addConfigWidget(KConfigDialog *parent)
|
||||
{
|
||||
if (!m_config) {
|
||||
m_config = new DockConfig(parent);
|
||||
connect(parent, SIGNAL(cancelClicked()), this, SLOT(removeConfigWidget()));
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::readConfig(KConfigGroup &cg)
|
||||
{
|
||||
KConfigGroup dm(&cg, "DockManager");
|
||||
|
||||
QSet<QString> prevHelpers = m_enabledHelpers;
|
||||
m_enabledHelpers = dm.readEntry("EnabledHelpers", QStringList()).toSet();
|
||||
setEnabled(dm.readEntry("Enabled", true));
|
||||
|
||||
if (m_enabled && prevHelpers != m_enabledHelpers) {
|
||||
updateHelpers();
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::writeConfig(KConfigGroup &cg)
|
||||
{
|
||||
if (m_config) {
|
||||
KConfigGroup dm(&cg, "DockManager");
|
||||
QSet<QString> prevHelpers = m_enabledHelpers;
|
||||
|
||||
m_enabledHelpers = m_config->enabledHelpers();
|
||||
setEnabled(m_config->isEnabled());
|
||||
dm.writeEntry("Enabled", m_enabled);
|
||||
dm.writeEntry("EnabledHelpers", m_enabledHelpers.toList());
|
||||
|
||||
if (m_enabled && prevHelpers != m_enabledHelpers) {
|
||||
updateHelpers();
|
||||
}
|
||||
removeConfigWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::removeConfigWidget()
|
||||
{
|
||||
// Don't delete m_config, as its now owned ny the config dialog...
|
||||
m_config = 0;
|
||||
}
|
||||
|
||||
void DockManager::updateHelpersDelayed()
|
||||
{
|
||||
if (!m_timer) {
|
||||
m_timer = new QTimer(this);
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateHelpers()));
|
||||
}
|
||||
m_timer->start(500);
|
||||
}
|
||||
|
||||
void DockManager::updateHelpers()
|
||||
{
|
||||
if (m_timer) {
|
||||
m_timer->stop();
|
||||
}
|
||||
|
||||
if (!m_enabled || !m_connected) {
|
||||
return;
|
||||
}
|
||||
QStringList dirList = dirs();
|
||||
QMap<QString, DockHelper *> previousHelpers;
|
||||
QList<DockHelper *> newHelpers;
|
||||
|
||||
foreach (DockHelper * helper, m_helpers) {
|
||||
previousHelpers[helper->dirName() + "/scripts/" + helper->fileName()] = helper;
|
||||
}
|
||||
|
||||
foreach (QString dir, dirList) {
|
||||
QDir d(dir + "/metadata");
|
||||
QStringList metas = QDir(QString(dir + "/metadata")).entryList(QStringList() << "*.info");
|
||||
|
||||
foreach (QString m, metas) {
|
||||
QString name = m.left(m.length() - 5);
|
||||
QString script = dir + "/scripts/" + name;
|
||||
if (previousHelpers.contains(script)) {
|
||||
if (m_enabledHelpers.contains(script)) {
|
||||
previousHelpers.remove(script);
|
||||
}
|
||||
} else if (m_enabledHelpers.contains(script)) {
|
||||
DockHelper *helper = new DockHelper(dir, name);
|
||||
|
||||
if (*helper) {
|
||||
newHelpers.append(helper);
|
||||
} else {
|
||||
delete helper;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QMap<QString, DockHelper *>::ConstIterator it(previousHelpers.constBegin()),
|
||||
end(previousHelpers.constEnd());
|
||||
|
||||
for (; it != end; ++it) {
|
||||
it.value()->stop();
|
||||
it.value()->deleteLater();
|
||||
m_helpers.removeAll(it.value());
|
||||
}
|
||||
|
||||
foreach (DockHelper * helper, newHelpers) {
|
||||
m_helpers.append(helper);
|
||||
}
|
||||
}
|
||||
|
||||
void DockManager::serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
|
||||
{
|
||||
Q_UNUSED(oldOwner)
|
||||
|
||||
if (newOwner.isEmpty() && m_itemService.contains(name)) {
|
||||
DockItem *item = m_itemService[name];
|
||||
if (item) {
|
||||
item->reset();
|
||||
}
|
||||
m_itemService.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_dockmanager.cpp"
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Icon Task Manager
|
||||
*
|
||||
* Copyright 2011 Craig Drummond <craig@kde.org>
|
||||
*
|
||||
* ----
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __DOCKMANAGER_H__
|
||||
#define __DOCKMANAGER_H__
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <KUrl>
|
||||
|
||||
class DockItem;
|
||||
class DockHelper;
|
||||
class DockConfig;
|
||||
class AbstractTaskItem;
|
||||
class KConfigDialog;
|
||||
class KConfigGroup;
|
||||
#include <QTimer>
|
||||
#include <QDBusServiceWatcher>
|
||||
|
||||
class DockManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "net.launchpad.DockManager")
|
||||
|
||||
public:
|
||||
static DockManager * self();
|
||||
|
||||
DockManager();
|
||||
|
||||
void setEnabled(bool en);
|
||||
bool isEnabled() const {
|
||||
return m_enabled;
|
||||
}
|
||||
void reloadItems();
|
||||
void registerTask(AbstractTaskItem *item);
|
||||
void unregisterTask(AbstractTaskItem *item);
|
||||
void remove(DockItem *item);
|
||||
void itemService(DockItem *item, const QString &serviceName);
|
||||
QStringList dirs() const;
|
||||
const QSet<QString> enabledHelpers() const {
|
||||
return m_enabledHelpers;
|
||||
}
|
||||
|
||||
void addConfigWidget(KConfigDialog *parent);
|
||||
void readConfig(KConfigGroup &cg);
|
||||
void writeConfig(KConfigGroup &cg);
|
||||
|
||||
private:
|
||||
bool stopDaemon();
|
||||
|
||||
public Q_SLOTS:
|
||||
void removeConfigWidget();
|
||||
|
||||
Q_SCRIPTABLE QStringList GetCapabilities();
|
||||
Q_SCRIPTABLE QDBusObjectPath GetItemByXid(qlonglong xid);
|
||||
Q_SCRIPTABLE QList<QDBusObjectPath> GetItems();
|
||||
Q_SCRIPTABLE QList<QDBusObjectPath> GetItemsByDesktopFile(const QString &desktopFile);
|
||||
Q_SCRIPTABLE QList<QDBusObjectPath> GetItemsByName(QString name);
|
||||
Q_SCRIPTABLE QList<QDBusObjectPath> GetItemsByPid(int pid);
|
||||
|
||||
Q_SIGNALS:
|
||||
void ItemAdded(const QDBusObjectPath &path);
|
||||
void ItemRemoved(const QDBusObjectPath &path);
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateHelpers();
|
||||
void updateHelpersDelayed();
|
||||
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
|
||||
|
||||
private:
|
||||
bool m_enabled;
|
||||
bool m_connected;
|
||||
QMap<KUrl, DockItem *> m_items;
|
||||
QMap<QString, DockItem *> m_itemService;
|
||||
QMap<AbstractTaskItem *, KUrl> m_tasks;
|
||||
QList<DockHelper *> m_helpers;
|
||||
QSet<QString> m_enabledHelpers;
|
||||
QTimer *m_timer;
|
||||
DockConfig *m_config;
|
||||
QDBusServiceWatcher *m_watcher;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="net.launchpad.DockItem">
|
||||
<property name="DesktopFile" type="s" access="read"/>
|
||||
<property name="Uri" type="s" access="read"/>
|
||||
<signal name="MenuItemActivated">
|
||||
<arg name="id" type="u" direction="out"/>
|
||||
</signal>
|
||||
<method name="AddMenuItem">
|
||||
<arg type="u" direction="out"/>
|
||||
<arg name="hints" type="a{sv}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
</method>
|
||||
<method name="RemoveMenuItem">
|
||||
<arg name="id" type="u" direction="in"/>
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||
</method>
|
||||
<method name="UpdateDockItem">
|
||||
<arg name="hints" type="a{sv}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="net.launchpad.DockManager">
|
||||
<signal name="ItemAdded">
|
||||
<arg name="path" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="ItemRemoved">
|
||||
<arg name="path" type="o" direction="out"/>
|
||||
</signal>
|
||||
<method name="GetCapabilities">
|
||||
<arg type="as" direction="out"/>
|
||||
</method>
|
||||
<method name="GetItemByXid">
|
||||
<arg type="o" direction="out"/>
|
||||
<arg name="xid" type="x" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItems">
|
||||
<arg type="ao" direction="out"/>
|
||||
</method>
|
||||
<method name="GetItemsByDesktopFile">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="desktopFile" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItemsByName">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="name" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="GetItemsByPid">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="pid" type="i" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
|
@ -21,8 +21,6 @@
|
|||
// Own
|
||||
#include "taskgroupitem.h"
|
||||
#include "jobmanager.h"
|
||||
#include "dockmanager.h"
|
||||
#include "dockitem.h"
|
||||
#include "mediabuttons.h"
|
||||
#include "unity.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "windowtaskitem.h"
|
||||
#include "taskgroupitem.h"
|
||||
#include "jobmanager.h"
|
||||
#include "dockmanager.h"
|
||||
#include "mediabuttons.h"
|
||||
#include "unity.h"
|
||||
#include "recentdocuments.h"
|
||||
|
@ -154,7 +153,6 @@ Tasks::Tasks(QObject* parent, const QVariantList &arguments)
|
|||
Tasks::~Tasks()
|
||||
{
|
||||
JobManager::self()->setEnabled(false);
|
||||
DockManager::self()->setEnabled(false);
|
||||
MediaButtons::self()->setEnabled(false);
|
||||
Unity::self()->setEnabled(false);
|
||||
RecentDocuments::self()->setEnabled(false);
|
||||
|
@ -335,8 +333,6 @@ void Tasks::configChanged()
|
|||
IconTasks::ToolTipManager::self()->setPreviewSize(previewSize);
|
||||
}
|
||||
|
||||
DockManager::self()->readConfig(cg);
|
||||
|
||||
// If we have not already read the launchers, then try now...
|
||||
// ...this is mainly required for plasmoidviewer...
|
||||
if (0 == m_groupManager->launcherCount()) {
|
||||
|
@ -642,7 +638,6 @@ void Tasks::createConfigurationInterface(KConfigDialog *parent)
|
|||
updateShowSeparator();
|
||||
toolTipsModified();
|
||||
styleModified();
|
||||
DockManager::self()->addConfigWidget(parent);
|
||||
m_groupManager->createConfigurationInterface(parent);
|
||||
parent->resize(640, 480);
|
||||
}
|
||||
|
@ -672,7 +667,6 @@ void Tasks::configAccepted()
|
|||
cg.writeEntry("iconScale", m_appUi.iconScale->value());
|
||||
cg.writeEntry("toolTips", m_appUi.toolTips->itemData(m_appUi.toolTips->currentIndex()).toInt());
|
||||
cg.writeEntry("highlightWindows", m_appUi.highlightWindows->checkState() == Qt::Checked);
|
||||
DockManager::self()->writeConfig(cg);
|
||||
|
||||
emit configNeedsSaving();
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "taskgroupitem.h"
|
||||
#include "taskitemlayout.h"
|
||||
#include "jobmanager.h"
|
||||
#include "dockmanager.h"
|
||||
#include "dockitem.h"
|
||||
#include "mediabuttons.h"
|
||||
#include "unity.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue