From 162431d793ad7622fb3ec8c78e39bfdd61592386 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 28 Jul 2017 11:37:28 +0200 Subject: [PATCH] remove resourceinstance resourceinstance wasn't compiled anymore, never ported to kf5 so is safe to just remove it --- .../plasmaextracomponents/CMakeLists.txt | 1 - .../resourceinstance.cpp | 138 ------------------ .../plasmaextracomponents/resourceinstance.h | 91 ------------ 3 files changed, 230 deletions(-) delete mode 100644 src/declarativeimports/plasmaextracomponents/resourceinstance.cpp delete mode 100644 src/declarativeimports/plasmaextracomponents/resourceinstance.h diff --git a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt index a4c452095..bd53462c9 100644 --- a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt @@ -7,7 +7,6 @@ set(plasmaextracomponents_SRCS appbackgroundprovider.cpp - #resourceinstance.cpp plasmaextracomponentsplugin.cpp fallbackcomponent.cpp ) diff --git a/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp b/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp deleted file mode 100644 index 65acd84fe..000000000 --- a/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ - -#include "resourceinstance.h" - -#include -#include -#include - -#include -#include - -ResourceInstance::ResourceInstance(QQuickItem *parent) - : QQuickItem(parent) -{ - m_syncTimer = new QTimer(this); - m_syncTimer->setSingleShot(true); - connect(m_syncTimer, SIGNAL(timeout()), this, SLOT(syncWid())); -} - -ResourceInstance::~ResourceInstance() -{ - -} - -void ResourceInstance::syncWid() -{ - QWindow *w = window(); - if (!w) { - return; - } - - WId wid = w->winId(); - if (!m_resourceInstance || m_resourceInstance->winId() != wid) { - delete m_resourceInstance; - - // qDebug() << "Creating a new instance of the resource" << m_uri << "window id" << wid; - m_resourceInstance = new KActivities::ResourceInstance(wid, m_uri, m_mimetype, m_title); - } else { - - if (m_uri.scheme().startsWith(QLatin1String("http")) && !m_uri.hasQuery() && m_uri.path().endsWith('/')) { - const QString &oldPath = m_uri.path(); - m_uri.setPath(oldPath.left(oldPath.length() - 1)); - - // qDebug() << "Old and new path" << oldPath << m_uri; - - } else { - m_resourceInstance->setUri(m_uri); - } - - // qDebug() << "Setting" << m_uri << m_mimetype << "to window" << wid; - - m_resourceInstance->setMimetype(m_mimetype); - m_resourceInstance->setTitle(m_title); - } -} - -QUrl ResourceInstance::uri() const -{ - return m_uri; -} - -void ResourceInstance::setUri(const QUrl &uri) -{ - if (m_uri == uri) { - return; - } - - m_uri = uri; - m_syncTimer->start(100); -} - -QString ResourceInstance::mimetype() const -{ - return m_mimetype; -} - -void ResourceInstance::setMimetype(const QString &mimetype) -{ - if (m_mimetype == mimetype) { - return; - } - m_mimetype = mimetype; - m_syncTimer->start(100); -} - -QString ResourceInstance::title() const -{ - return m_title; -} - -void ResourceInstance::setTitle(const QString &title) -{ - if (m_title == title) { - return; - } - m_title = title; - m_syncTimer->start(100); -} - -void ResourceInstance::notifyModified() -{ - //ensure the resource instance exists - syncWid(); - m_resourceInstance->notifyModified(); -} - -void ResourceInstance::notifyFocusedIn() -{ - //ensure the resource instance exists - syncWid(); - m_resourceInstance->notifyFocusedIn(); -} - -void ResourceInstance::notifyFocusedOut() -{ - //ensure the resource instance exists - syncWid(); - m_resourceInstance->notifyFocusedOut(); -} - - diff --git a/src/declarativeimports/plasmaextracomponents/resourceinstance.h b/src/declarativeimports/plasmaextracomponents/resourceinstance.h deleted file mode 100644 index c6c3f52f4..000000000 --- a/src/declarativeimports/plasmaextracomponents/resourceinstance.h +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * Copyright 2011 Marco Martin * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Library 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 Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * - ***************************************************************************/ -#ifndef RESOURCEINSTANCE_H -#define RESOURCEINSTANCE_H - -#include -#include - -namespace KActivities -{ -class ResourceInstance; -} - -class QTimer; - -class ResourceInstance : public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(QUrl uri READ uri WRITE setUri NOTIFY uriChanged) - Q_PROPERTY(QString mimetype READ mimetype WRITE setMimetype NOTIFY mimetypeChanged) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) - //Q_PROPERTY(OpenReason openReason READ openReason) - -public: - ResourceInstance(QQuickItem *parent = 0); - ~ResourceInstance(); - - QUrl uri() const; - void setUri(const QUrl &uri); - - QString mimetype() const; - void setMimetype(const QString &mimetype); - - QString title() const; - void setTitle(const QString &title); - -protected Q_SLOTS: - void syncWid(); - -Q_SIGNALS: - void uriChanged(); - void mimetypeChanged(); - void titleChanged(); - -public Q_SLOTS: - /** - * Call this method to notify the system that you modified - * (the contents of) the resource - */ - void notifyModified(); - - /** - * Call this method to notify the system that the resource - * has the focus in your application - * @note You only need to call this in MDI applications - */ - void notifyFocusedIn(); - - /** - * Call this method to notify the system that the resource - * lost the focus in your application - * @note You only need to call this in MDI applications - */ - void notifyFocusedOut(); - -private: - KActivities::ResourceInstance *m_resourceInstance; - QUrl m_uri; - QString m_mimetype; - QString m_title; - QTimer *m_syncTimer; -}; - -#endif