Git commit f18065df9b91c72a813291f43707513e99bb72e8 by Michael Palimaka. Committed on 22/03/2013 at 15:34. Pushed by palimaka into branch 'master'.
Remove support for Google Gadgets. REVIEW: 109607 M +0 -7 CMakeLists.txt M +0 -1 cmake/modules/CMakeLists.txt D +0 -30 cmake/modules/FindGooglegadgets.cmake M +1 -1 doc/plasma-desktop/index.docbook M +0 -1 plasma/design/plasmoids M +1 -1 plasma/design/security M +0 -4 plasma/generic/scriptengines/CMakeLists.txt D +0 -50 plasma/generic/scriptengines/google_gadgets/CMakeLists.txt D +0 -2 plasma/generic/scriptengines/google_gadgets/Messages.sh D +0 -12 plasma/generic/scriptengines/google_gadgets/README D +0 -2 plasma/generic/scriptengines/google_gadgets/config.txt.tmpl D +0 -58 plasma/generic/scriptengines/google_gadgets/floating_decorator.cpp D +0 -40 plasma/generic/scriptengines/google_gadgets/floating_decorator.h D +0 -186 plasma/generic/scriptengines/google_gadgets/ggl_applet_script.cpp D +0 -92 plasma/generic/scriptengines/google_gadgets/ggl_applet_script.h D +0 -41 plasma/generic/scriptengines/google_gadgets/ggl_extensions.h D +0 -256 plasma/generic/scriptengines/google_gadgets/ggl_package.cpp D +0 -40 plasma/generic/scriptengines/google_gadgets/ggl_package.h D +0 -120 plasma/generic/scriptengines/google_gadgets/panel_decorator.cpp D +0 -40 plasma/generic/scriptengines/google_gadgets/panel_decorator.h D +0 -18 plasma/generic/scriptengines/google_gadgets/plasma-applet-ggl.desktop.tmpl D +0 -157 plasma/generic/scriptengines/google_gadgets/plasma-packagestructure-googlegadgets.desktop D +0 -159 plasma/generic/scriptengines/google_gadgets/plasma-scriptengine-googlegadgets.desktop D +0 -301 plasma/generic/scriptengines/google_gadgets/plasma_host.cpp D +0 -52 plasma/generic/scriptengines/google_gadgets/plasma_host.h D +0 -204 plasma/generic/scriptengines/google_gadgets/plasma_view_host.cpp D +0 -95 plasma/generic/scriptengines/google_gadgets/plasma_view_host.h D +0 -201 plasma/generic/scriptengines/google_gadgets/plasma_view_host_internal.h D +0 -52 plasma/generic/scriptengines/google_gadgets/popout_decorator.cpp D +0 -40 plasma/generic/scriptengines/google_gadgets/popout_decorator.h http://commits.kde.org/kde-workspace/f18065df9b91c72a813291f43707513e99bb72e8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 06b779b..e451ab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,13 +131,6 @@ set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configurat PURPOSE "Needed to build font configuration and installation tools" ) -macro_optional_find_package(Googlegadgets 0.11.0) -set_package_properties(Googlegadgets PROPERTIES DESCRIPTION "Google Gadgets library" - URL "http://code.google.com/p/google-gadgets-for-linux" - TYPE OPTIONAL - PURPOSE "Needed to build plasma scriptengine for google gadgets" - ) - #### Python support ( plasma scriptengines ) #### macro_optional_find_package(PythonLibrary) set_package_properties(PythonLibrary PROPERTIES DESCRIPTION "Python scripting language" diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 8d3d581..117b3a5 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -4,7 +4,6 @@ # install e.g. FindLibKNotification-1.cmake set(cmakeFiles FindCkConnector.cmake FindDBus.cmake - FindGooglegadgets.cmake FindLibXKlavier.cmake FindOpenGLES.cmake FindPAM.cmake diff --git a/cmake/modules/FindGooglegadgets.cmake b/cmake/modules/FindGooglegadgets.cmake deleted file mode 100644 index 9d35dbd..0000000 --- a/cmake/modules/FindGooglegadgets.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# - Try to find Googlegadgets -# Once done this will define -# -# GOOGLEGADGETS_FOUND - system has Googlegadgets -# GOOGLEGADGETS_INCLUDE_DIRS - the Googlegadgets include directory -# GOOGLEGADGETS_LIBRARIES - Link these to use Googlegadgets -# GOOGLEGADGETS_CFLAGS_OTHER - Compiler switches required for using Googlegadgets -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - - -if ( GOOGLEGADGETS_INCLUDE_DIRS ) - # in cache already - SET(Googlegadgets_FIND_QUIETLY TRUE) -endif ( GOOGLEGADGETS_INCLUDE_DIRS ) - -# use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -if( NOT WIN32 ) - INCLUDE(FindPkgConfig) - PKG_CHECK_MODULES(GOOGLEGADGETS QUIET libggadget-1.0>=0.11.0 libggadget-qt-1.0>=0.11.0) -endif( NOT WIN32 ) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Googlegadgets DEFAULT_MSG GOOGLEGADGETS_LIBRARIES GOOGLEGADGETS_INCLUDE_DIRS) - -# show the GOOGLEGADGETS_INCLUDE_DIR and GOOGLEGADGETS_LIBRARIES variables only in the advanced view -MARK_AS_ADVANCED(GOOGLEGADGETS_INCLUDE_DIRS GOOGLEGADGETS_LIBRARIES) - diff --git a/doc/plasma-desktop/index.docbook b/doc/plasma-desktop/index.docbook index 8d32813..520d104 100644 --- a/doc/plasma-desktop/index.docbook +++ b/doc/plasma-desktop/index.docbook @@ -302,7 +302,7 @@ or desktop. You add &plasma; widgets by simply dragging them where you want them </screenshot> The <guibutton>Get New Widgets</guibutton> button allows you to add widgets -you've previously downloaded; and download new &plasma; widgets or google gadgets. +you've previously downloaded and download new &plasma; widgets. Currently it supports native &plasmagik; packages and some &Mac; OS X dashboard widgets. Widgets you install this way can then be accessed just like regular, preinstalled widgets. diff --git a/plasma/design/plasmoids b/plasma/design/plasmoids index ac73ea5..d44564f 100644 --- a/plasma/design/plasmoids +++ b/plasma/design/plasmoids @@ -9,7 +9,6 @@ The API of a widget is defined by the host "ScriptEngine", with the exception of * SuperKaramba's karambas * Enlightenment 17 edje content -* Google Gadgets * MacOS dashboard widgets (though not all) These are loaded via host AppletScriptEngine plugins that bridge between the widget itself and Plasma's canvas. diff --git a/plasma/design/security b/plasma/design/security index f9fb0cb..f3dee85 100644 --- a/plasma/design/security +++ b/plasma/design/security @@ -29,7 +29,7 @@ Existing constraints/features: possible problems: -the API isn't designed for constraints changing at runtime. does anyone think that's likely to matter someday? --I have no idea how this will affect alien widgets (google gadgets etc). personally I'd be fine with banning those from the screensaver until proper, full security can be implemented. +-I have no idea how this will affect alien widgets. personally I'd be fine with banning those from the screensaver until proper, full security can be implemented. trust-based security diff --git a/plasma/generic/scriptengines/CMakeLists.txt b/plasma/generic/scriptengines/CMakeLists.txt index 864e830..0c50409 100644 --- a/plasma/generic/scriptengines/CMakeLists.txt +++ b/plasma/generic/scriptengines/CMakeLists.txt @@ -7,7 +7,3 @@ endif(QT_QTWEBKIT_FOUND) if (PYTHONLIBRARY_FOUND AND NOT WIN32) macro_optional_add_subdirectory(python) endif (PYTHONLIBRARY_FOUND AND NOT WIN32) - -if(GOOGLEGADGETS_FOUND) - macro_optional_add_subdirectory(google_gadgets) -endif(GOOGLEGADGETS_FOUND) diff --git a/plasma/generic/scriptengines/google_gadgets/CMakeLists.txt b/plasma/generic/scriptengines/google_gadgets/CMakeLists.txt deleted file mode 100644 index bb6cd7f..0000000 --- a/plasma/generic/scriptengines/google_gadgets/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -project(plasma-ggl) - -if(NOT KDE4_FOUND) - find_package(KDE4 REQUIRED) - find_package(Googlegadgets REQUIRED) - - include(KDE4Defaults) - - include_directories( - ${KDE4_INCLUDES} - ) -endif(NOT KDE4_FOUND) - -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -add_definitions (${GOOGLEGADGETS_CFLAGS_OTHER}) - -include_directories( - ${GOOGLEGADGETS_INCLUDE_DIRS} - ) - -execute_process(COMMAND pkg-config --variable=ggl_resource_dir libggadget-1.0 - OUTPUT_VARIABLE gadgets_path) -string(REPLACE "\n" "" "gadgets_path" "${gadgets_path}") - -# We add our source code here -set(package_SRCS ggl_package.cpp) -set(scriptengine_SRCS - ggl_applet_script.cpp - plasma_host.cpp - plasma_view_host.cpp - panel_decorator.cpp - floating_decorator.cpp - popout_decorator.cpp - ) - -# Now make sure all files get to the right place -kde4_add_plugin(plasma_package_ggl ${package_SRCS}) -target_link_libraries(plasma_package_ggl - ${GOOGLEGADGETS_LIBRARIES} - plasma ${KDE4_KDECORE_LIBS} ) - -kde4_add_plugin(plasma_scriptengine_ggl ${scriptengine_SRCS}) -target_link_libraries(plasma_scriptengine_ggl - ${GOOGLEGADGETS_LIBRARIES} - plasma ${KDE4_KDEUI_LIBS} ) - -install(TARGETS plasma_package_ggl DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-packagestructure-googlegadgets.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(TARGETS plasma_scriptengine_ggl DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES plasma-scriptengine-googlegadgets.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/plasma/generic/scriptengines/google_gadgets/Messages.sh b/plasma/generic/scriptengines/google_gadgets/Messages.sh deleted file mode 100644 index ffd3b53..0000000 --- a/plasma/generic/scriptengines/google_gadgets/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT *.cpp -o $podir/plasma_appletscriptengine_googlegadget.pot diff --git a/plasma/generic/scriptengines/google_gadgets/README b/plasma/generic/scriptengines/google_gadgets/README deleted file mode 100644 index 9a3b195..0000000 --- a/plasma/generic/scriptengines/google_gadgets/README +++ /dev/null @@ -1,12 +0,0 @@ -Build: -===== - -To build this package, you need to install the HEAD version of -google-gadgets-for-linux(GGL). Please visit this url for more -information about GGL. - - http://code.google.com/p/google-gadgets-for-linux/ - -To get the lastest version of GGL, please check out the code from svn: - -svn checkout http://google-gadgets-for-linux.googlecode.com/svn/trunk/ google-gadgets-for-linux-read-only diff --git a/plasma/generic/scriptengines/google_gadgets/config.txt.tmpl b/plasma/generic/scriptengines/google_gadgets/config.txt.tmpl deleted file mode 100644 index 430c664..0000000 --- a/plasma/generic/scriptengines/google_gadgets/config.txt.tmpl +++ /dev/null @@ -1,2 +0,0 @@ - at gadget_path@ - at gadget_options_name@ diff --git a/plasma/generic/scriptengines/google_gadgets/floating_decorator.cpp b/plasma/generic/scriptengines/google_gadgets/floating_decorator.cpp deleted file mode 100644 index 05756c7..0000000 --- a/plasma/generic/scriptengines/google_gadgets/floating_decorator.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "floating_decorator.h" - -#include <QtGui/QMessageBox> - -#include <ggadget/gadget_consts.h> -#include <ggadget/gadget.h> -#include <ggadget/messages.h> -#include <ggadget/menu_interface.h> -#include <ggadget/decorated_view_host.h> -#include <ggadget/qt/qt_view_widget.h> - -#include <Plasma/Applet> - -namespace ggadget { - -FloatingDecorator::FloatingDecorator(PlasmaViewHost *host) - : MainViewDecoratorBase(host, - "plasma_floating", - false, - false, - true), - info(host->getInfo()) { - SetButtonVisible(MainViewDecoratorBase::POP_IN_OUT_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::MENU_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::CLOSE_BUTTON, false); -} - -FloatingDecorator::~FloatingDecorator() {} - -void FloatingDecorator::OnAddDecoratorMenuItems(MenuInterface *menu) { - AddCollapseExpandMenuItem(menu); - if (!IsMinimized() && !IsPoppedOut()) { - AddZoomMenuItem(menu); - } -} - -bool FloatingDecorator::ShowDecoratedView(bool modal, int flags, - Slot1<bool, int> *feedback_handler) { - info->applet->setMaximumSize(QSizeF()); - return MainViewDecoratorBase::ShowDecoratedView(modal, flags, feedback_handler); -} - -} // namespace ggadget diff --git a/plasma/generic/scriptengines/google_gadgets/floating_decorator.h b/plasma/generic/scriptengines/google_gadgets/floating_decorator.h deleted file mode 100644 index e45c4a5..0000000 --- a/plasma/generic/scriptengines/google_gadgets/floating_decorator.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_FLOATING_DECORATOR_H__ -#define GGADGET_FLOATING_DECORATOR_H__ - -#include <ggadget/main_view_decorator_base.h> -#include "plasma_view_host.h" - -namespace ggadget { - -class FloatingDecorator : public MainViewDecoratorBase { - public: - FloatingDecorator(PlasmaViewHost *host); - virtual ~FloatingDecorator(); - virtual void OnAddDecoratorMenuItems(MenuInterface *menu); - virtual bool ShowDecoratedView(bool modal, int flags, - Slot1<bool, int> *feedback_handler); - - private: - GadgetInfo *info; - DISALLOW_EVIL_CONSTRUCTORS(FloatingDecorator); -}; - -} // namespace ggadget - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.cpp b/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.cpp deleted file mode 100644 index e617a08..0000000 --- a/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "ggl_applet_script.h" - -#include <sys/time.h> -#include <time.h> - -#include <QtCore/QTimer> -#include <QtCore/QDir> -#include <QtCore/QMutex> -#include <QtCore/QMutexLocker> -#include <QtCore/QFileInfo> -#include <QtGui/QPainter> -#include <QtGui/QColor> -#include <QtGui/QGraphicsSceneMouseEvent> - -#include <KDebug> - -#include <Plasma/Applet> -#include <Plasma/Package> - -#include <ggadget/logger.h> -#include <ggadget/script_runtime_interface.h> -#include <ggadget/qt/qt_view_widget.h> -#include <ggadget/qt/qt_view_host.h> -#include <ggadget/qt/qt_menu.h> -#include <ggadget/qt/utilities.h> -#include <ggadget/qt/qt_main_loop.h> -#include <ggadget/extension_manager.h> -#include <ggadget/script_runtime_manager.h> -#include <ggadget/gadget.h> -#include <ggadget/gadget_consts.h> -#include <ggadget/system_utils.h> -#include <ggadget/host_utils.h> -#include <ggadget/view_interface.h> -#include <ggadget/view.h> -#include <ggadget/host_interface.h> -#include <ggadget/decorated_view_host.h> -#include "plasma_host.h" -#include "ggl_extensions.h" - -K_EXPORT_PLASMA_APPLETSCRIPTENGINE(googlegadget, GglAppletScript) - -class GglAppletScript::Private { - public: - QString gg_file_; - QString options_; - QMenu menu_; - QStringList errors_; - GadgetInfo info; - ~Private() { - // Must set applet to null so other components could know the applet is - // exiting. - info.applet = NULL; - delete info.host; - info.host = NULL; - delete info.gadget; - info.gadget = NULL; - } -}; - -GglAppletScript::GglAppletScript(QObject *parent, const QVariantList &args) - : Plasma::AppletScript(parent), d(new Private) { - Q_UNUSED(args); - d->info.script = this; -} - -GglAppletScript::~GglAppletScript() { - kWarning() << "GGL applet script destroied"; - delete d; -} - -bool GglAppletScript::init() { - Q_ASSERT(applet()); - Q_ASSERT(package()); - - std::string profile_dir = - ggadget::BuildFilePath(ggadget::GetHomeDirectory().c_str(), - ".google/gadgets-plasma", NULL); - - QString error; - if (!ggadget::qt::InitGGL(NULL, "ggl-plasma", profile_dir.c_str(), - kGlobalExtensions, 0, - ggadget::qt::GGL_INIT_FLAG_COLLECTOR, &error)) { - kError() << "Failed to init GGL system:" << error; - return false; - } - - QFile config_file(package()->path() + "/config.txt"); - if (!config_file.open(QIODevice::ReadOnly)) { - kError() << "Failed to open google gadget's config file at " - << package()->path(); - return false; - } - QTextStream in(&config_file); - d->gg_file_ = in.readLine(); - d->options_ = in.readLine(); - if (d->options_.isNull() || d->options_.isEmpty()) - return false; - - applet()->setAspectRatioMode(Plasma::ConstrainedSquare); - QTimer::singleShot(50, this, SLOT(loadGadget())); - return true; -} - -void GglAppletScript::loadGadget() { - d->errors_.clear(); - kDebug() << "Loading gadget " << d->gg_file_ - << "with options " << d->options_; - - d->info.location = applet()->location(); - d->info.applet = applet(); - d->info.host = new ggadget::PlasmaHost(&d->info); - d->info.gadget = d->info.host->LoadGadget(d->gg_file_.toUtf8(), - d->options_.toUtf8(), - 0, false); -} - -void GglAppletScript::paintInterface(QPainter *p, - const QStyleOptionGraphicsItem *option, - const QRect &contentsRect) { - Q_UNUSED(p); - Q_UNUSED(option); - Q_UNUSED(contentsRect); -#if 0 - QRect r = contentsRect; - p->setPen(QColor(0, 0, 255)); - p->drawLine(r.left(), r.top(), r.right(), r.bottom()); - p->drawLine(r.left(), r.bottom(), r.right(), r.top()); - p->drawRect(r); -#endif -} - -void GglAppletScript::mousePressEvent(QGraphicsSceneMouseEvent *event) { - // FIXME: AppletScript has no way to handle mousePressEvent right now - if (event->button() == Qt::RightButton) { - kDebug() << "Right button pressed"; - d->menu_.clear(); - ggadget::qt::QtMenu qt_menu(&d->menu_); - ggadget::ViewInterface *view = d->info.main_view_host->GetViewDecorator(); - if (!view->OnAddContextMenuItems(&qt_menu)) { - if (!d->menu_.isEmpty()) { - kDebug() << "Show my own menu"; - d->menu_.exec(event->screenPos()); - event->accept(); - } - } - } -} - -QList<QAction*> GglAppletScript::contextualActions() { - d->menu_.clear(); - if (d->info.main_view_host) { - ggadget::ViewInterface *view = d->info.main_view_host->GetViewDecorator(); - if (view) { - ggadget::qt::QtMenu qt_menu(&d->menu_); - view->OnAddContextMenuItems(&qt_menu); - } - } - return d->menu_.actions(); -} - -void GglAppletScript::constraintsEvent(Plasma::Constraints constraints) { - if (d->info.host) - d->info.host->onConstraintsEvent(constraints); -} - -void GglAppletScript::showConfigurationInterface() { - if (d->info.gadget) - d->info.gadget->ShowOptionsDialog(); -} - -#include "ggl_applet_script.moc" diff --git a/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.h b/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.h deleted file mode 100644 index f1564f7..0000000 --- a/plasma/generic/scriptengines/google_gadgets/ggl_applet_script.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_GGL_APPLET_SCRIPT_H__ -#define GGADGET_GGL_APPLET_SCRIPT_H__ - -#include <Plasma/AppletScript> - -namespace ggadget { - class Gadget; - class PlasmaHost; - class DecoratedViewHost; - class ViewHostInterface; - namespace qt { - class QtViewWidget; - } -} - -namespace Plasma { - class Applet; -} -class QGraphicsProxyWidget; - -class GadgetInfo { - public: - GadgetInfo() - : host(NULL), - gadget(NULL), - applet(NULL), - script(NULL), - proxy(NULL), - main_view_widget(NULL), - main_view_host(NULL), - expanded_main_view_host(NULL), - details_view_host(NULL), - options_view_host(NULL), - view_debug_mode(0), - location(Plasma::Floating) - {} - ggadget::PlasmaHost *host; - ggadget::Gadget *gadget; - Plasma::Applet *applet; - Plasma::AppletScript *script; - QGraphicsProxyWidget *proxy; - ggadget::qt::QtViewWidget *main_view_widget; - ggadget::DecoratedViewHost *main_view_host; - ggadget::ViewHostInterface *expanded_main_view_host; - ggadget::ViewHostInterface *details_view_host; - ggadget::ViewHostInterface *options_view_host; - int view_debug_mode; - Plasma::Location location; -}; - -class GglAppletScript : public Plasma::AppletScript { - Q_OBJECT - public: - GglAppletScript(QObject *parent, const QVariantList &args); - virtual ~GglAppletScript(); - - virtual bool init(); - virtual void constraintsEvent(Plasma::Constraints constraints); - virtual void paintInterface(QPainter *painter, - const QStyleOptionGraphicsItem *option, - const QRect &contentsRect); - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual QList<QAction*> contextualActions(); - - public Q_SLOTS: - virtual void showConfigurationInterface(); - - private Q_SLOTS: - void loadGadget(); - - private: - class Private; - Private *const d; -}; - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/ggl_extensions.h b/plasma/generic/scriptengines/google_gadgets/ggl_extensions.h deleted file mode 100644 index e1ecb28..0000000 --- a/plasma/generic/scriptengines/google_gadgets/ggl_extensions.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_GGL_EXTENSIONS_H -#define GGADGET_GGL_EXTENSIONS_H - -// Extensions that should be loaded by ggl system -static const char *kGlobalExtensions[] = { - "default-framework", - "libxml2-xml-parser", - "dbus-script-class", - "default-options", - "qtwebkit-browser-element", - "qt-system-framework", - "qt-edit-element", -// "phonon-audio-framework", - "gst-audio-framework", - "gst-video-element", - "linux-system-framework", - "qt-xml-http-request", - "google-gadget-manager", - "analytics-usage-collector", - "smjs-script-runtime", - "qt-script-runtime", - NULL -}; - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/ggl_package.cpp b/plasma/generic/scriptengines/google_gadgets/ggl_package.cpp deleted file mode 100644 index 081a9d2..0000000 --- a/plasma/generic/scriptengines/google_gadgets/ggl_package.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "ggl_package.h" - -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtGui/QFontDatabase> -#include <QtGui/QMessageBox> -#include <kconfiggroup.h> -#include <kdebug.h> -#include <kstandarddirs.h> -#include <ggadget/gadget.h> -#include <ggadget/gadget_consts.h> -#include <ggadget/host_interface.h> -#include <ggadget/string_utils.h> -#include <ggadget/gadget_manager_interface.h> -#include <ggadget/file_manager_interface.h> -#include <ggadget/system_utils.h> -#include <ggadget/scoped_ptr.h> -#include <ggadget/view.h> -#include <ggadget/messages.h> -#include <ggadget/permissions.h> -#include <ggadget/qt/qt_view_host.h> -#include <ggadget/qt/utilities.h> -#include "ggl_extensions.h" - -using namespace ggadget; - -K_EXPORT_PLASMA_PACKAGESTRUCTURE(googlegadget, GglPackage) - -class GadgetBrowserViewHost : public qt::QtViewHost { - public: - GadgetBrowserViewHost(GglPackage *package, Type type) - : QtViewHost(type, 1.0, FLAG_RECORD_STATES, 0, NULL), - package_(package) {} - - virtual void CloseView() { - package_->gadgetBrowserClosed(); - } - GglPackage *package_; -}; - -class GadgetBrowserHost : public ggadget::HostInterface { - public: - GadgetBrowserHost(GglPackage *package) - : gadget_manager_(NULL), - package_(package), - connection_(NULL) { - kDebug() << "Create GadgetBrowserHost:" << this; - std::string profile_dir = - ggadget::BuildFilePath(ggadget::GetHomeDirectory().c_str(), - ".google/gadgets-plasma", NULL); - - QString error; - if (!ggadget::qt::InitGGL(NULL, "ggl-plasma", profile_dir.c_str(), - kGlobalExtensions, 0, - ggadget::qt::GGL_INIT_FLAG_COLLECTOR, &error)) { - kError() << "Failed to init GGL system:" << error; - return; - } - gadget_manager_ = GetGadgetManager(); - connection_ = gadget_manager_->ConnectOnNewGadgetInstance( - NewSlot(this, &GadgetBrowserHost::newGadgetInstanceCallback)); - } - - ~GadgetBrowserHost() { - kDebug() << "Destroy GadgetBrowserHost:" << this; - connection_->Disconnect(); - } - - static QString extractGadgetIcon(const std::string& gadget_path, - const QString& dest_dir) { - ggadget::StringMap map; - - if (!ggadget::Gadget::GetGadgetManifest(gadget_path.c_str(), &map)) - return QString(); - - std::string icon = map[ggadget::kManifestIcon]; - if (icon.empty()) return QString(); - - ggadget::scoped_ptr<ggadget::FileManagerInterface> fm( - ggadget::Gadget::GetGadgetFileManagerForLocale(gadget_path.c_str(), - NULL)); - - if (!fm.get()) return QString(); - - std::string data; - fm->ReadFile(icon.c_str(), &data); - if (data.empty()) return QString(); - - QPixmap pixmap; - if (pixmap.loadFromData(reinterpret_cast<const uchar *>(data.c_str()), - static_cast<int>(data.length()))) { - QString dest = dest_dir + "/icon.png"; - if (pixmap.save(dest, "png")) - return dest; - } - return QString(); - } - - bool installPlasmaApplet(int id) { - std::string author, download_url, title, description; - if (!gadget_manager_->GetGadgetInstanceInfo(id, "", &author, &download_url, - &title, &description)) - return false; - std::string path = gadget_manager_->GetGadgetInstancePath(id).c_str(); - std::string options = gadget_manager_->GetGadgetInstanceOptionsName(id); - QString pkg_name = QString("ggl_%1").arg(id); - - // Create package - QString plasmods_dir = - KStandardDirs::locateLocal("data", "plasma/plasmoids/"); - QDir root(plasmods_dir); - if (!root.cd(pkg_name) && - (!root.mkpath(pkg_name) || !root.cd(pkg_name))) { - LOGE("Failed to create package %s", - QString(root.path() + "/" + pkg_name).toUtf8().data()); - return false; - } - { - QFile file(root.path() + "/config.txt"); - file.open(QIODevice::WriteOnly); - QTextStream out(&file); - out << QString::fromUtf8(path.c_str()) << "\n"; - out << QString::fromUtf8(options.c_str()) << "\n"; - } - - // Register package - Plasma::PackageMetadata data; - data.setPluginName(pkg_name); - data.setType("Service"); - data.setAuthor(QString::fromUtf8(author.c_str())); - data.setImplementationApi("googlegadgets"); - data.setName(QString::fromUtf8(title.c_str())); - data.setDescription(QString::fromUtf8(description.c_str())); - - // Extract the icon - QString icon = extractGadgetIcon(path, root.path()); - - Plasma::Package::registerPackage(data, icon); - return true; - } - - bool newGadgetInstanceCallback(int id) { - if (ggadget::qt::ConfirmGadget(gadget_manager_, id)) { - return installPlasmaApplet(id); - } else { - QMessageBox::information( - NULL, - QString::fromUtf8(GM_("GOOGLE_GADGETS")), - QString::fromUtf8( - StringPrintf( - GM_("GADGET_LOAD_FAILURE"), - gadget_manager_->GetGadgetInstancePath(id).c_str()).c_str())); - return false; - } - } - - virtual ViewHostInterface *NewViewHost(Gadget *gadget, - ViewHostInterface::Type type) { - Q_UNUSED(gadget); - return new GadgetBrowserViewHost(package_, type); - } - - virtual Gadget *LoadGadget(const char *path, const char *options_name, - int instance_id, bool show_debug_console) { - Q_UNUSED(path); - Q_UNUSED(options_name); - Q_UNUSED(instance_id); - Q_UNUSED(show_debug_console); - return 0; - } - - virtual void RemoveGadget(Gadget *gadget, bool save_data) { - Q_UNUSED(save_data); - gadget_manager_->RemoveGadgetInstance(gadget->GetInstanceID()); - } - - virtual bool LoadFont(const char *filename) { - return QFontDatabase::addApplicationFont(filename) != -1; - } - - virtual void Run() {} - virtual void ShowGadgetAboutDialog(Gadget*) { } - virtual void ShowGadgetDebugConsole(Gadget*) {} - virtual int GetDefaultFontSize() { return ggadget::kDefaultFontSize; } - virtual bool OpenURL(const Gadget *, const char *) { return false; } - - GadgetManagerInterface *gadget_manager_; - GglPackage *package_; - Connection *connection_; -}; - -GglPackage::GglPackage(QObject *parent, const QVariantList &args) - : Plasma::PackageStructure(parent), host_(NULL) { - Q_UNUSED(args); - - setDefaultMimetypes(QStringList() << "application/zip" - << "application/x-googlegadget" ); -} - -GglPackage::~GglPackage() { - delete host_; -} - -bool GglPackage::installPackage(const QString &archive_path, - const QString &package_root) { - Q_UNUSED(package_root); - ASSERT(!host_); - host_ = new GadgetBrowserHost(this); - if (!host_ || !host_->gadget_manager_) { - delete host_; - host_ = NULL; - return false; - } - - int result = host_->gadget_manager_->NewGadgetInstanceFromFile( - archive_path.toUtf8().data()); - - delete host_; - host_ = NULL; - - if (result == -1) - return false; - else - return true; -} - -void GglPackage::createNewWidgetBrowser(QWidget *parent) { - ASSERT(!host_); - host_ = new GadgetBrowserHost(this); - if (!host_ || !host_->gadget_manager_) { - gadgetBrowserClosed(); // Actually, it's never opened - return; - } - GetGadgetManager()->ShowGadgetBrowserDialog(host_); -} - -void GglPackage::gadgetBrowserClosed() { - delete host_; - host_ = NULL; - emit newWidgetBrowserFinished(); -} diff --git a/plasma/generic/scriptengines/google_gadgets/ggl_package.h b/plasma/generic/scriptengines/google_gadgets/ggl_package.h deleted file mode 100644 index 062e29c..0000000 --- a/plasma/generic/scriptengines/google_gadgets/ggl_package.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_PACKAGE_H -#define GGADGET_PACKAGE_H - -#include <Plasma/Package> -#include <Plasma/PackageStructure> -#include <Plasma/PackageMetadata> -class GadgetBrowserHost; -class GglPackage : public Plasma::PackageStructure { - Q_OBJECT - public: - GglPackage(QObject *parent, const QVariantList &args); - - virtual ~GglPackage(); - virtual bool installPackage(const QString &archivePath, - const QString &packageRoot); - virtual void createNewWidgetBrowser(QWidget *parent = 0); - - void gadgetBrowserClosed(); - - private: - GadgetBrowserHost *host_; -}; - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/panel_decorator.cpp b/plasma/generic/scriptengines/google_gadgets/panel_decorator.cpp deleted file mode 100644 index 16896ae..0000000 --- a/plasma/generic/scriptengines/google_gadgets/panel_decorator.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "panel_decorator.h" - -#include <QtGui/QMessageBox> - -#include <ggadget/gadget_consts.h> -#include <ggadget/gadget.h> -#include <ggadget/messages.h> -#include <ggadget/menu_interface.h> -#include <ggadget/decorated_view_host.h> -#include <ggadget/qt/qt_view_widget.h> - -#include <Plasma/Applet> - -namespace ggadget { - -class PanelDecorator::Private { - public: - Private(GadgetInfo *info, bool vertical) - : owner_(NULL), info_(info), vertical_(vertical) { - } - - void onAddDecoratorMenuItems(MenuInterface *menu) { - int priority = MenuInterface::MENU_ITEM_PRI_DECORATOR; - if (vertical_) { - owner_->AddCollapseExpandMenuItem(menu); - } - -#ifndef NDEBUG - menu->AddItem( - "Debug", 0, 0, - NewSlot(this, &Private::showDebugInfo), priority); -#endif - } - -#ifndef NDEBUG - void showDebugInfo(const char*) { - QString msg = "Applet size:(%1, %2)\n" - "Widget size:(%3, %4)\n" - "Decorator size:(%5, %6)\n" - "View size:(%7, %8)\n" - "Aspect:(%9)"; - qt::QtViewWidget *widget = static_cast<qt::QtViewWidget*>( - info_->main_view_host->GetNativeWidget()); - ViewInterface *decorator = info_->main_view_host->GetViewDecorator(); - ViewInterface *view = info_->main_view_host->GetView(); - QMessageBox::information(NULL, - "Debug", - msg.arg(info_->applet->size().width()) - .arg(info_->applet->size().height()) - .arg(widget->size().width()) - .arg(widget->size().height()) - .arg(decorator->GetWidth()) - .arg(decorator->GetHeight()) - .arg(view->GetWidth()) - .arg(view->GetHeight()) - .arg(info_->applet->aspectRatioMode())); - } -#endif - - PanelDecorator *owner_; - GadgetInfo *info_; - bool vertical_; -}; - -PanelDecorator::PanelDecorator(PlasmaViewHost *host, bool vertical) - : DockedMainViewDecorator(host), - d(new Private(host->getInfo(), vertical)) { - SetButtonVisible(MainViewDecoratorBase::POP_IN_OUT_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::MENU_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::CLOSE_BUTTON, false); - SetVertical(vertical); - d->owner_ = this; -} - -PanelDecorator::~PanelDecorator() { - delete d; -} - -void PanelDecorator::OnAddDecoratorMenuItems(MenuInterface *menu) { - d->onAddDecoratorMenuItems(menu); -} - -void PanelDecorator::SetVertical(bool vertical) { - if (vertical) { - SetOptionPrefix("plasma_vpanel"); - SetAllowYMargin(false); - SetAllowXMargin(true); - SetWidth(d->info_->applet->size().width()); - } else { - SetOptionPrefix("plasma_hpanel"); - SetAllowYMargin(true); - SetAllowXMargin(false); - - // Gadget on horizontal panel is minimized, caption-hidden. - SetMinimized(true); - SetMinimizedIconVisible(true); - SetMinimizedCaptionVisible(false); - - SetWidth(38); - - SetResizeBorderVisible(0); - } -} - -} // namespace ggadget diff --git a/plasma/generic/scriptengines/google_gadgets/panel_decorator.h b/plasma/generic/scriptengines/google_gadgets/panel_decorator.h deleted file mode 100644 index e82d43d..0000000 --- a/plasma/generic/scriptengines/google_gadgets/panel_decorator.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_PANEL_DECORATOR_H__ -#define GGADGET_PANEL_DECORATOR_H__ - -#include <ggadget/docked_main_view_decorator.h> -#include "plasma_view_host.h" - -namespace ggadget { - -class PanelDecorator : public DockedMainViewDecorator { - public: - PanelDecorator(PlasmaViewHost *host, bool vertical); - virtual ~PanelDecorator(); - virtual void OnAddDecoratorMenuItems(MenuInterface *menu); - - private: - class Private; - Private *d; - void SetVertical(bool vertical); - DISALLOW_EVIL_CONSTRUCTORS(PanelDecorator); -}; - -} // namespace ggadget - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/plasma-applet-ggl.desktop.tmpl b/plasma/generic/scriptengines/google_gadgets/plasma-applet-ggl.desktop.tmpl deleted file mode 100644 index 3ca7fce..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma-applet-ggl.desktop.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=@gadget_readable_name@ -Comment=@gadget_comment@ -X-KDE-PluginInfo-Name=@gadget_name@ -X-KDE-PluginInfo-Author=Google -Icon=google-gadgets -Type=Service -X-KDE-Plasmagik-ApplicationName= -X-KDE-Plasmagik-RequiredVersion= -X-KDE-PluginInfo-Category= -X-KDE-PluginInfo-Email= -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-PluginInfo-License= -X-KDE-PluginInfo-Version= -X-KDE-PluginInfo-Website= -X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment -X-Plasma-API=googlegadgets diff --git a/plasma/generic/scriptengines/google_gadgets/plasma-packagestructure-googlegadgets.desktop b/plasma/generic/scriptengines/google_gadgets/plasma-packagestructure-googlegadgets.desktop deleted file mode 100644 index c0436d7..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma-packagestructure-googlegadgets.desktop +++ /dev/null @@ -1,157 +0,0 @@ -[Desktop Entry] -Name=Google Gadgets -Name[ar]=????? ???? -Name[ast]=Gadgets de Google -Name[be at latin]=Gad?ety ?Google? -Name[bg]=?????? ?? Google -Name[bn]=????? ?????????? -Name[bn_IN]=Google Gadgets -Name[bs]=Guglove spravice -Name[ca]=Google Gadgets -Name[ca at valencia]=Google Gadgets -Name[cs]=Google Gadgets -Name[csb]=Gad?et? z Google -Name[da]=Google Gadgets -Name[de]=Google Gadgets (Miniprogramme) -Name[el]=????????? Google -Name[en_GB]=Google Gadgets -Name[eo]=Akcesora?o de Google -Name[es]=Gadgets de Google -Name[et]=Google Gadgets -Name[eu]=Google Gadgets -Name[fi]=Google-sovelmat -Name[fr]=Gadgets Google -Name[fy]=Google Gadgets -Name[ga]=Giuirl?id? Google -Name[gl]=Gadgets de Google -Name[gu]=???? ??????? -Name[he]=????????? ?? ???? -Name[hi]=???? ??????? -Name[hne]=???? ???? -Name[hr]=Google gadgeti -Name[hu]=Google Gadgets -Name[ia]=Gadgets de Google -Name[id]=Google Gadgets -Name[is]=Google d?t -Name[it]=Gadget di Google -Name[ja]=Google ????? -Name[kk]=Google ????????? -Name[km]=???????????????????? -Name[kn]=????? ????????????? -Name[ko]=Google ?? -Name[ku]=N??ey?n Google -Name[lt]=Google valdikliai -Name[lv]=Google s?kr?ki -Name[mk]=Google Gadgets -Name[ml]=??????? ????????????? -Name[mr]=Google ????? -Name[nb]=Google-greier -Name[nds]=Google-L?ttprogrammen -Name[nl]=Google-gadgets -Name[nn]=Google-tenester -Name[or]=Google ????? -Name[pa]=Google ?????? -Name[pl]=Gad?ety Google -Name[pt]=Google Gadgets -Name[pt_BR]=Gadgets do Google -Name[ro]=Google Gadgets -Name[ru]=??????? Google -Name[si]=????? ??????? -Name[sk]=Google Gadgets -Name[sl]=Google Gadgets -Name[sr]=??????? ???????? -Name[sr at ijekavian]=??????? ???????? -Name[sr at ijekavianlatin]=Googleove spravice -Name[sr at latin]=Googleove spravice -Name[sv]=Googlegrejer -Name[ta]=Google Gadgets -Name[te]=?????? ?????????? -Name[tg]=??????????? Google -Name[th]=????????????????? -Name[tr]=Google Ara?lar? -Name[ug]=Google Gadgets -Name[uk]=??????? Google -Name[wa]=Tchitchetes Google -Name[x-test]=xxGoogle Gadgetsxx -Name[zh_CN]=Google ??? -Name[zh_TW]=Google??? -Comment=Google Desktop Gadget -Comment[ar]=????? ??? ?????? ?? ???? -Comment[ast]=Gadget d'escritoriu de Google -Comment[be at latin]=Gad?et rabo?aha sta?a ?Google? -Comment[bg]=???????? ?????? ?? Google -Comment[bn]=???? ??????? ??????? -Comment[bs]=Guglove spravice za povr? -Comment[ca]=Google Gadget d'escriptori -Comment[ca at valencia]=Google Gadget d'escriptori -Comment[cs]=Google Desktop Gadget -Comment[csb]=Gad?et? p?ltu Google -Comment[da]=Gadgets til skrivebordet fra Google -Comment[de]=Google-Arbeitsfl?chen-Miniprogramm -Comment[el]=????????? Google ?????????? ???????? -Comment[en_GB]=Google Desktop Gadget -Comment[eo]=Akcesora?o de Google por Labortablo -Comment[es]=Gadget de escritorio de Google -Comment[et]=Google'i t??lauavidin -Comment[eu]=Google-ren mahaigaineko gadget-a -Comment[fi]=Google-ty?p?yt?sovelmat -Comment[fr]=Gadget de bureau Google -Comment[fy]=Google Burobl?d Gadget -Comment[ga]=Giuirl?id Deisce Google -Comment[gl]=Gadget de Google para o escritorio -Comment[gu]=???? ???????? ????? -Comment[he]=??????? ?? Google Desktop -Comment[hi]=???? ???????? ????? -Comment[hne]=???? ???????? ???? -Comment[hr]=Google gadget radne povr?ine -Comment[hu]=Google asztali elemek -Comment[ia]=Gadget de scriptorio de Google -Comment[id]=Google Desktop Gadget -Comment[is]=Google skj?bor?sd?t -Comment[it]=Gadget di Google Desktop -Comment[ja]=Google ??????????? -Comment[kk]=Google ????? ?????? -Comment[km]=??????????????????????? -Comment[kn]=????? ??????? ?????????? -Comment[ko]=Google ???? ?? -Comment[lt]=Google darbastalio valdiklis -Comment[lv]=Google darbvirsmas s?kr?ks -Comment[ml]=??????? ?????? ????????? -Comment[mr]=Google ???????? ????? -Comment[nb]=Google skrivebordsdings -Comment[nds]=Schriefdischl?ttprogramm vun Google -Comment[nl]=Google-bureaubladgadget -Comment[nn]=Google-skrivebordsteneste -Comment[or]=Google ???????? ????? -Comment[pa]=???? ??????? ?????? -Comment[pl]=Gad?et Google na pulpicie -Comment[pt]='Gadget' do Google Desktop -Comment[pt_BR]=Gadget do Google Desktop -Comment[ro]=Gadget de birou Google -Comment[ru]=?????? Google ??? ???????? ????? -Comment[si]=????? ????? ??????? -Comment[sk]=Google Desktop Gadget -Comment[sl]=Gradnik Google Gadget -Comment[sr]=??????? ???????? ?? ????? -Comment[sr at ijekavian]=??????? ???????? ?? ????? -Comment[sr at ijekavianlatin]=Googleove spravice za povr? -Comment[sr at latin]=Googleove spravice za povr? -Comment[sv]=Google skrivbordsgrejer -Comment[ta]=Google Desktop Gadget -Comment[te]=?????? ??????? ???? ???????? -Comment[tg]=??????????? ???? ????? Google -Comment[th]=????????????????????????????? -Comment[tr]=Google Masa?st? Arac? -Comment[ug]=????? ??????????? Gadget -Comment[uk]=?????? ????????? Google -Comment[wa]=Tchitchete Google pol sicribanne -Comment[x-test]=xxGoogle Desktop Gadgetxx -Comment[zh_CN]=Google ????? -Comment[zh_TW]=Google????? -Type=Service -Icon=google-gadgets -X-KDE-PluginInfo-Name=googlegadgets -X-KDE-ServiceTypes=Plasma/PackageStructure -X-KDE-Library=plasma_package_ggl -X-Plasma-PackageFileFilter=*.gg -X-Plasma-ProvidesWidgetBrowser=true diff --git a/plasma/generic/scriptengines/google_gadgets/plasma-scriptengine-googlegadgets.desktop b/plasma/generic/scriptengines/google_gadgets/plasma-scriptengine-googlegadgets.desktop deleted file mode 100644 index 1633cce..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma-scriptengine-googlegadgets.desktop +++ /dev/null @@ -1,159 +0,0 @@ -[Desktop Entry] -Name=GoogleGadgets -Name[ar]=????? ???? -Name[ast]=GoogleGadgets -Name[be at latin]=GoogleGadgets -Name[bg]=?????? ?? Google -Name[bn]=GoogleGadgets -Name[bn_IN]=GoogleGadgets -Name[bs]=Guglove spravice -Name[ca]=GoogleGadgets -Name[ca at valencia]=GoogleGadgets -Name[cs]=GoogleGadgets -Name[csb]=GoogleGadgets -Name[da]=GoogleGadgets -Name[de]=Google Gadgets (Miniprogramme) -Name[el]=????????? Google -Name[en_GB]=GoogleGadgets -Name[eo]=GoogleAkcesora?oj -Name[es]=GoogleGadgets -Name[et]=GoogleGadgets -Name[eu]=GoogleGadgets -Name[fi]=GoogleGadgets -Name[fr]=GoogleGadgets -Name[fy]=GoogleGadgets -Name[ga]=GoogleGadgets -Name[gl]=GoogleGadgets -Name[gu]=??????????? -Name[he]=GoogleGadgets -Name[hi]=????-???? -Name[hne]=???????? -Name[hr]=Google gadgeti -Name[hu]=Google Gadgets -Name[ia]=Gadgets de Google -Name[id]=GoogleGadgets -Name[is]=GoogleGadgets d?t -Name[it]=Gadget di Google -Name[ja]=Google ????? -Name[kk]=GoogleGadgets -Name[km]=???????????????? -Name[kn]=????? ????????????? -Name[ko]=GoogleGadgets -Name[ku]=N??ey?nGoogle -Name[lt]=GoogleValdikliai -Name[lv]=GoogleGadgets -Name[mk]=GoogleGadgets -Name[ml]=???????????????????? -Name[mr]=Google????? -Name[nb]=GoogleGadgets -Name[nds]=Google-L?ttprogrammen -Name[nl]=GoogleGadgets -Name[nn]=Google-tenester -Name[or]=GoogleGadgets -Name[pa]=Google-?????? -Name[pl]=Gad?ety Google -Name[pt]=GoogleGadgets -Name[pt_BR]=GoogleGadgets -Name[ro]=GoogleGadgets -Name[ru]=??????? Google -Name[si]=GoogleGadgets -Name[sk]=GoogleGadgets -Name[sl]=GoogleGadgets -Name[sr]=??????? ???????? -Name[sr at ijekavian]=??????? ???????? -Name[sr at ijekavianlatin]=Googleove spravice -Name[sr at latin]=Googleove spravice -Name[sv]=Googlegrejer -Name[ta]=GoogleGadgets -Name[te]=??????? ?????????? -Name[tg]=??????????? Google -Name[th]=????????????????? -Name[tr]=Google Ara?lar? -Name[ug]=GoogleGadgets -Name[uk]=GoogleGadgets -Name[wa]=GoogleGadgets -Name[x-test]=xxGoogleGadgetsxx -Name[zh_CN]=Google ??? -Name[zh_TW]=Google??? -Comment=Google Desktop Gadgets -Comment[ar]=????? ??? ?????? ?? ???? -Comment[ast]=Gadgets d'escritoriu de Google -Comment[be at latin]=Gad?ety rabo?aha sta?a ?Google? -Comment[bg]=???????? ?????? ?? Google -Comment[bn]=???? ??????? ??????? -Comment[bs]=Guglove spravice za povr? -Comment[ca]=Google Gadgets d'escriptori -Comment[ca at valencia]=Google Gadgets d'escriptori -Comment[cs]=Google Desktop Gadgets -Comment[csb]=Gad?et? p?ltu Google -Comment[da]=Gadgets til skrivebordet fra Google -Comment[de]=Google-Arbeitsfl?chen-Miniprogramme -Comment[el]=????????? Google ?????????? ???????? -Comment[en_GB]=Google Desktop Gadgets -Comment[eo]=Akcesora?o de Gugla labortablo -Comment[es]=Gadgets de escritorio de Google -Comment[et]=Google'i t??lauavidinad -Comment[eu]=Google-ren mahaigaineko gadget-ak -Comment[fi]=Google-ty?p?yt?sovelmat -Comment[fr]=Gadgets de bureau Google -Comment[fy]=Google Burobl?d Gadgets -Comment[ga]=Giuirl?id? Deisce Google -Comment[gl]=Gadgets de Google para o escritorio -Comment[gu]=???? ???????? ??????? -Comment[he]=????????? ?? Google Desktop -Comment[hi]=???? ???????? ????? -Comment[hne]=???? ???????? ???? -Comment[hr]=Google gadgeti radne povr?ine -Comment[hu]=Google asztali elemek -Comment[ia]=Gadgets de scriptorio de Google -Comment[id]=Google Desktop Gadgets -Comment[is]=Google skj?bor?sd?t -Comment[it]=Gadget di Google Desktop -Comment[ja]=Google ??????????? -Comment[kk]=Google ????? ????????? -Comment[km]=?????????????????????? -Comment[kn]=????? ??????? ????????????? -Comment[ko]=Google ???? ?? -Comment[lt]=Google darbastalio prietais?lis -Comment[lv]=Google darbvirsmas s?kr?ki -Comment[ml]=??????? ?????? ????????????? -Comment[mr]=Google ???????? ????? -Comment[nb]=Google skrivebordsdingser -Comment[nds]=Schriefdisch-L?ttprogrammen vun Google -Comment[nl]=Google-bureaubladgadgets -Comment[nn]=Google-skrivebordstenester -Comment[or]=Google ???????? ??????????? -Comment[pa]=???? ??????? ?????? -Comment[pl]=Gad?ety Google na pulpicie -Comment[pt]='Gadgets' do Google Desktop -Comment[pt_BR]=Gadgets do Google Desktop -Comment[ro]=Gadgeturi de birou Google -Comment[ru]=??????? Google ??? ???????? ????? -Comment[si]=????? ????? ??????? -Comment[sk]=Google Desktop Gadgets -Comment[sl]=Gradniki Google Gadgets -Comment[sr]=??????? ???????? ?? ????? -Comment[sr at ijekavian]=??????? ???????? ?? ????? -Comment[sr at ijekavianlatin]=Googleove spravice za povr? -Comment[sr at latin]=Googleove spravice za povr? -Comment[sv]=Google skrivbordsgrejer -Comment[ta]=Google Desktop Gadgets -Comment[te]=?????? ??????? ???? ??????? -Comment[tg]=??????????? ???? ????? Google -Comment[th]=????????????????????????????? -Comment[tr]=Google Masa?st? Ara?lar? -Comment[ug]=????? ??????????? Gadget -Comment[uk]=??????? ????????? Google -Comment[wa]=Tchitchetes Google pol sicribanne -Comment[x-test]=xxGoogle Desktop Gadgetsxx -Comment[zh_CN]=Google ????? -Comment[zh_TW]=Google????? -X-KDE-ServiceTypes=Plasma/ScriptEngine -Type=Service -Icon=google-gadgets -X-KDE-Library=plasma_scriptengine_ggl -X-EngineName=googlegadgets -X-Plasma-API=googlegadgets -X-Plasma-ComponentTypes=Applet -X-Plasma-PackageFormat=googlegadgets -X-KDE-PluginInfo-Name=googlegadgets diff --git a/plasma/generic/scriptengines/google_gadgets/plasma_host.cpp b/plasma/generic/scriptengines/google_gadgets/plasma_host.cpp deleted file mode 100644 index 3134a47..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma_host.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "plasma_host.h" - -#include <string> -#include <QGraphicsWidget> -#include <QGraphicsProxyWidget> -#include <QtGui/QFontDatabase> -#include <ggadget/common.h> -#include <ggadget/logger.h> -#include <ggadget/qt/qt_view_host.h> -#include <ggadget/script_runtime_manager.h> -#include <ggadget/gadget_consts.h> -#include <ggadget/decorated_view_host.h> -#include <ggadget/docked_main_view_decorator.h> -#include <ggadget/details_view_decorator.h> -#include <ggadget/permissions.h> -#include <ggadget/qt/utilities.h> -#include <ggadget/qt/qt_view_host.h> -#include <ggadget/gadget.h> - -#include <KDebug> - -#include <Plasma/Applet> -#include <Plasma/ToolTipManager> -#include "plasma_view_host.h" -#include "panel_decorator.h" -#include "popout_decorator.h" -#include "floating_decorator.h" - -namespace ggadget { - -class PlasmaHost::Private { - public: - Private(GadgetInfo *i) - : info(i), - gadget_w_(0), - gadget_h_(0) { - global_permissions_.SetGranted(Permissions::ALL_ACCESS, true); - } - - void onCloseMainViewHandler() { - if (info->expanded_main_view_host) - onPopInHandler(); - info->gadget->RemoveMe(true); - } - - void onCloseDetailsViewHandler() { - info->gadget->CloseDetailsView(); - } - - void onClosePopOutViewHandler() { - onPopInHandler(); - } - - void onPopOutHandler() { - if (info->expanded_main_view_host != NULL) { - onPopInHandler(); - return; - } - ViewInterface *child = info->main_view_host->GetView(); - ASSERT(child); - if (child) { - PlasmaViewHost *vh = new PlasmaViewHost( - info, ViewHostInterface::VIEW_HOST_MAIN, true); - PopOutDecorator *view_decorator = new PopOutDecorator(vh); - DecoratedViewHost *dvh = new DecoratedViewHost(view_decorator); - view_decorator->ConnectOnClose( - NewSlot(this, &Private::onClosePopOutViewHandler)); - - // Send popout event to decorator first. - SimpleEvent event(Event::EVENT_POPOUT); - info->main_view_host->GetViewDecorator()->OnOtherEvent(event); - - child->SwitchViewHost(dvh); - dvh->ShowView(false, 0, NULL); - - info->expanded_main_view_host = dvh; - } - } - - void onPopInHandler() { - if (!info->expanded_main_view_host) return; - ViewInterface *child = info->expanded_main_view_host->GetView(); - ASSERT(child); - if (child) { - // Close details view - child->GetGadget()->CloseDetailsView(); - - child->SwitchViewHost(info->main_view_host); - SimpleEvent event(Event::EVENT_POPIN); - info->main_view_host->GetViewDecorator()->OnOtherEvent(event); - info->expanded_main_view_host->Destroy(); - info->expanded_main_view_host = NULL; - } - } - - DecoratedViewHost *newFloatingViewHost() { - PlasmaViewHost* vh = new PlasmaViewHost( - info, ViewHostInterface::VIEW_HOST_MAIN); - - FloatingDecorator *decorator = new FloatingDecorator(vh); - decorator->ConnectOnClose(NewSlot(this, &Private::onCloseMainViewHandler)); - decorator->ConnectOnPopOut(NewSlot(this, &Private::onPopOutHandler)); - decorator->ConnectOnPopIn(NewSlot(this, &Private::onPopInHandler)); - DecoratedViewHost *dvh = new DecoratedViewHost(decorator); - - DLOG("NewViewHost: dvh(%p), pvh(%p), vd(%p)", - dvh, vh, decorator); - return dvh; - } - - DecoratedViewHost *newPanelViewHost(bool vertical) { - PlasmaViewHost* vh = new PlasmaViewHost( - info, ViewHostInterface::VIEW_HOST_MAIN); - - PanelDecorator *decorator = new PanelDecorator(vh, vertical); - decorator->ConnectOnPopOut(NewSlot(this, &Private::onPopOutHandler)); - decorator->ConnectOnPopIn(NewSlot(this, &Private::onPopInHandler)); - DecoratedViewHost *dvh = new DecoratedViewHost(decorator); - - DLOG("NewViewHost: dvh(%p), pvh(%p), vd(%p)", - dvh, vh, decorator); - return dvh; - } - - GadgetInfo *info; - Permissions global_permissions_; - double gadget_w_, gadget_h_; -}; - -PlasmaHost::PlasmaHost(GadgetInfo *info) - : d(new Private(info)) { -} - -PlasmaHost::~PlasmaHost() { - delete d; -} - -ViewHostInterface *PlasmaHost::NewViewHost(Gadget *, - ViewHostInterface::Type type) { - if (type == ViewHostInterface::VIEW_HOST_MAIN) { - Plasma::Location loc = d->info->applet->location(); - if (loc == Plasma::Floating) { - d->info->main_view_host = d->newFloatingViewHost(); - } else { - d->info->main_view_host = d->newPanelViewHost(isVertical(loc)); - } - return d->info->main_view_host; - } else if (type == ViewHostInterface::VIEW_HOST_OPTIONS) { - ViewHostInterface* vh = new QtViewHost(type, 1.0, 0, 0, NULL); - d->info->options_view_host = vh; - return vh; - } else { - ViewHostInterface* vh = new PlasmaViewHost(d->info, type); - DetailsViewDecorator *view_decorator = new DetailsViewDecorator(vh); - DecoratedViewHost *dvh = new DecoratedViewHost(view_decorator); - view_decorator->ConnectOnClose( - NewSlot(d, &Private::onCloseDetailsViewHandler)); - d->info->details_view_host = dvh; - return dvh; - } -} - -void PlasmaHost::RemoveGadget(Gadget *gadget, bool save_data) { - // Please close me through plasma's button - Q_UNUSED(gadget); - Q_UNUSED(save_data); -} - -bool PlasmaHost::LoadFont(const char *filename) { - if (QFontDatabase::addApplicationFont(filename) != -1) - return true; - else - return false; -} - -int PlasmaHost::GetDefaultFontSize() { - return kDefaultFontSize; -} - -bool PlasmaHost::OpenURL(const ggadget::Gadget *gadget, const char *url) { - return ggadget::qt::OpenURL(gadget, url); -} - -Gadget* PlasmaHost::LoadGadget(const char *path, const char *options_name, - int instance_id, bool show_debug_console) { - Q_UNUSED(instance_id); - Q_UNUSED(show_debug_console); - - Gadget *gadget = new Gadget(this, path, options_name, 0, - d->global_permissions_, - Gadget::DEBUG_CONSOLE_DISABLED); - - if (!gadget->IsValid()) { - LOG("Failed to load gadget %s", path); - delete gadget; - return NULL; - } - - if (!gadget->ShowMainView()) { - LOG("Failed to show main view of gadget %s", path); - delete gadget; - d->info->main_view_host = NULL; - return NULL; - } - - if (gadget->HasOptionsDialog()) { - d->info->script->setHasConfigurationInterface(true); - } - - return gadget; -} - -void PlasmaHost::onConstraintsEvent(Plasma::Constraints constraints) { - if (!d->info->main_view_host) return; - - if (constraints & Plasma::FormFactorConstraint) { - // TODO: Do something to handle it right - kDebug() << "FormFactorConstraint changed:" << d->info->applet->formFactor(); - } - - if ((constraints & Plasma::LocationConstraint) && - d->info->applet->location() != d->info->location) { - // disable tip. - // It will be enabled when PanelDecorator is on horizontal panel. - Plasma::ToolTipManager::self()->unregisterWidget(d->info->applet); - - d->onPopInHandler(); - d->onCloseDetailsViewHandler(); - Plasma::Location loc = d->info->applet->location(); - - kDebug() << "LocationConstraint changed from " << d->info->location - << " to " << loc; - - DecoratedViewHost *vh; - if (loc == Plasma::Floating) { - vh = d->newFloatingViewHost(); - } else { - vh = d->newPanelViewHost(isVertical(loc)); - } - - // Send popout event here so elements like browser_element will know - // about it and they will hide themselves. - SimpleEvent event(Event::EVENT_POPOUT); - d->info->main_view_host->GetViewDecorator()->OnOtherEvent(event); - - ViewInterface *child = d->info->main_view_host->GetView(); - ViewHostInterface *old = child->SwitchViewHost(vh); - old->Destroy(); - - d->info->main_view_host = vh; - SimpleEvent event1(Event::EVENT_POPIN); - vh->GetViewDecorator()->OnOtherEvent(event1); - - // Must call it to get the aspectRatioMode of applet right. - // Maybe we can do it nicely in GGL. - vh->GetViewDecorator()->GetViewHost()->SetResizable( - vh->GetViewDecorator()->GetResizable()); - - vh->ShowView(false, 0, NULL); - d->info->location = loc; - return; - } - - if (constraints & Plasma::SizeConstraint) { - ViewInterface *view = d->info->main_view_host->GetViewDecorator(); - if (!view || !d->info->main_view_widget || !d->info->proxy) return; - - QSizeF s = d->info->applet->size(); - kDebug() << "size requested:" << s; - double w = s.width(); - double h = s.height(); - double old_w = view->GetWidth(); - double old_h = view->GetHeight(); - if (w == old_w && h == old_h) { - d->info->main_view_widget->resize(w, h); - d->info->proxy->resize(s); - return; - } - - if (view->OnSizing(&w, &h)) { - view->SetSize(w, h); - } - } -} - -} // namespace ggadget diff --git a/plasma/generic/scriptengines/google_gadgets/plasma_host.h b/plasma/generic/scriptengines/google_gadgets/plasma_host.h deleted file mode 100644 index 41b4136..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma_host.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_PLASMA_HOST_H__ -#define GGADGET_PLASMA_HOST_H__ - -#include <ggadget/host_interface.h> -#include "ggl_applet_script.h" -class Gadget; - -namespace ggadget { - -using ggadget::ViewHostInterface; - -class PlasmaHost : public ggadget::HostInterface { - public: - PlasmaHost(GadgetInfo *info); - virtual ~PlasmaHost(); - virtual ViewHostInterface *NewViewHost(Gadget *gadget, - ViewHostInterface::Type type); - virtual Gadget *LoadGadget(const char *path, const char *options_name, - int instance_id, bool show_debug_console); - virtual void RemoveGadget(Gadget *gadget, bool save_data); - virtual bool LoadFont(const char *filename); - virtual void Run() {} - virtual void ShowGadgetDebugConsole(Gadget *) {} - virtual int GetDefaultFontSize(); - virtual bool OpenURL(const Gadget *gadget, const char *url); - - void onConstraintsEvent(Plasma::Constraints constraints); - - private: - class Private; - Private *d; -}; - -} // namespace ggadget - -#endif // GGADGET_PLASMA_HOST_H__ diff --git a/plasma/generic/scriptengines/google_gadgets/plasma_view_host.cpp b/plasma/generic/scriptengines/google_gadgets/plasma_view_host.cpp deleted file mode 100644 index cd7cb07..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma_view_host.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - Copyright 2007 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#include "plasma_view_host.h" - -#include <sys/time.h> - -#include <QtGui/QGraphicsProxyWidget> -#include <QtGui/QGraphicsLinearLayout> -#include <QtGui/QToolTip> - -#include <KDebug> -#include <KInputDialog> -#include <KMessageBox> -#include <Plasma/Applet> -#include <Plasma/ToolTipContent> -#include <Plasma/ToolTipManager> - -#include <ggadget/file_manager_interface.h> -#include <ggadget/gadget_consts.h> -#include <ggadget/logger.h> -#include <ggadget/decorated_view_host.h> -#include <ggadget/options_interface.h> -#include <ggadget/script_context_interface.h> -#include <ggadget/script_runtime_interface.h> -#include <ggadget/script_runtime_manager.h> -#include <ggadget/qt/qt_graphics.h> -#include <ggadget/qt/utilities.h> - -#include "plasma_view_host_internal.h" - - -using namespace ggadget::qt; -namespace ggadget { - -PlasmaViewHost::PlasmaViewHost(GadgetInfo *info, ViewHostInterface::Type type, - bool popout) - : d(new Private(info, type, popout)) { -} - -PlasmaViewHost::~PlasmaViewHost() { - delete d; -} - -void PlasmaViewHost::Destroy() { - delete this; -} - -void PlasmaViewHost::SetView(ViewInterface *view) { - kDebug() << "PlasmaViewHost::SetView:" << this << "," << view; - d->view_ = view; -} - -void *PlasmaViewHost::GetNativeWidget() const { - return d->widget_; -} - -void PlasmaViewHost::ViewCoordToNativeWidgetCoord( - double x, double y, double *widget_x, double *widget_y) const { - double zoom = d->view_->GetGraphics()->GetZoom(); - if (widget_x) *widget_x = x * zoom; - if (widget_y) *widget_y = y * zoom; -} - -void PlasmaViewHost::NativeWidgetCoordToViewCoord( - double x, double y, double *view_x, double *view_y) const { - double zoom = d->view_->GetGraphics()->GetZoom(); - if (zoom == 0) return; - if (view_x) *view_x = x / zoom; - if (view_y) *view_y = y / zoom; -} - -void PlasmaViewHost::QueueDraw() { - d->queueDraw(); -} - -void PlasmaViewHost::QueueResize() { - d->queueResize(); -} - -void PlasmaViewHost::SetResizable(ViewInterface::ResizableMode mode) { - if (d->type_ != ViewHostInterface::VIEW_HOST_MAIN || - d->is_popout_ || - !d->info->applet) - return; - if (mode == ViewInterface::RESIZABLE_TRUE) - d->info->applet->setAspectRatioMode(Plasma::IgnoreAspectRatio); - else - d->info->applet->setAspectRatioMode(Plasma::KeepAspectRatio); - kDebug() << "SetResizable:" << mode << d->info->applet->aspectRatioMode(); -} - -static void UpdateTooltip(Plasma::Applet *applet, const QString &text) { - if (isHorizontal(applet->location())) { - Plasma::ToolTipContent data; - data.setMainText(text); - Plasma::ToolTipManager::self()->setContent(applet, data); - } -} - -void PlasmaViewHost::SetCaption(const std::string &caption) { - d->caption_ = QString::fromUtf8(caption.c_str()); - if (d->parent_widget_) { - d->parent_widget_->setWindowTitle(d->caption_); - } else { - UpdateTooltip(d->info->applet, d->caption_); - } -} - -void PlasmaViewHost::SetCursor(ggadget::ViewInterface::CursorType type) { - Qt::CursorShape shape = ggadget::qt::GetQtCursorShape(type); - // Up to Qt4.4.3, There is a bug in handling cursor when - // QGraphicsProxyWidget is involved. - d->info->applet->setCursor(shape); - if (d->widget_) - d->widget_->setCursor(shape); -} - -void PlasmaViewHost::ShowTooltip(const std::string &tooltip) { - QToolTip::showText(QCursor::pos(), QString::fromUtf8(tooltip.c_str())); -} - -void PlasmaViewHost::ShowTooltipAtPosition(const std::string &tooltip, - double x, double y) { - double widget_x = 0, widget_y = 0; - ViewCoordToNativeWidgetCoord(x, y, &widget_x, &widget_y); - QToolTip::showText(QPoint(widget_x, widget_y), - QString::fromUtf8(tooltip.c_str())); -} - -bool PlasmaViewHost::ShowView(bool modal, int flags, - Slot1<bool, int> *feedback_handler) { - if (d->showView(modal, flags, feedback_handler)) { - if (d->parent_widget_) { - d->parent_widget_->setWindowTitle(d->caption_); - } else { - UpdateTooltip(d->info->applet, d->caption_); - } - return true; - } - return false; -} - -void PlasmaViewHost::CloseView() { - d->closeView(); -} - -bool PlasmaViewHost::ShowContextMenu(int button) { - return d->showContextMenu(button); -} - -void PlasmaViewHost::Alert(const ViewInterface *view, const char *message) { - KMessageBox::information(NULL,message, - view->GetCaption().c_str()); -} - -ViewHostInterface::ConfirmResponse PlasmaViewHost::Confirm( - const ViewInterface *view, const char *message, bool) { - int ret = KMessageBox::questionYesNo(NULL, - message, - view->GetCaption().c_str() ); - return ret == KMessageBox::Yes ? CONFIRM_YES : CONFIRM_NO; -} - -std::string PlasmaViewHost::Prompt(const ViewInterface *view, - const char *message, - const char *default_value) { - QString s = KInputDialog::getText(view->GetCaption().c_str(), - message, - default_value); - return s.toUtf8().data(); -} - -ViewHostInterface::Type PlasmaViewHost::GetType() const { - return d->type_; -} - -ViewInterface *PlasmaViewHost::GetView() const { - return d->view_; -} - -int PlasmaViewHost::GetDebugMode() const { - return d->info->view_debug_mode; -} - -GadgetInfo *PlasmaViewHost::getInfo() { - return d->info; -} - -} // namespace ggadget -#include "plasma_view_host_internal.moc" diff --git a/plasma/generic/scriptengines/google_gadgets/plasma_view_host.h b/plasma/generic/scriptengines/google_gadgets/plasma_view_host.h deleted file mode 100644 index 8c6f3ab..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma_view_host.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright 2007 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_PLASMA_VIEW_HOST_H__ -#define GGADGET_PLASMA_VIEW_HOST_H__ - -#include <set> - -#include <QtGui/QGraphicsWidget> - -#include <ggadget/view_interface.h> -#include <ggadget/graphics_interface.h> -#include <ggadget/view_host_interface.h> -#include <ggadget/qt/qt_graphics.h> -#include <ggadget/qt/qt_view_widget.h> -#include "plasma_host.h" - -namespace ggadget { - -using namespace ggadget::qt; - -inline bool isHorizontal(Plasma::Location loc) { - return loc == Plasma::TopEdge || loc == Plasma::BottomEdge; -} - -inline bool isVertical(Plasma::Location loc) { - return loc == Plasma::LeftEdge || loc == Plasma::RightEdge; -} - -class PlasmaViewHost : public ViewHostInterface { - public: - PlasmaViewHost(GadgetInfo *info, ViewHostInterface::Type type, bool popout = false); - virtual ~PlasmaViewHost(); - - virtual Type GetType() const; - virtual void Destroy(); - virtual void SetView(ViewInterface *view); - virtual ViewInterface *GetView() const; - virtual GraphicsInterface *NewGraphics() const { - return new QtGraphics(1.0); - } - virtual void *GetNativeWidget() const; - virtual void ViewCoordToNativeWidgetCoord( - double x, double y, double *widget_x, double *widget_y) const; - virtual void NativeWidgetCoordToViewCoord( - double x, double y, double *view_x, double *view_y) const; - virtual void QueueDraw(); - virtual void QueueResize(); - virtual void EnableInputShapeMask(bool enable) { Q_UNUSED(enable); } - virtual void SetResizable(ViewInterface::ResizableMode mode); - virtual void SetCaption(const std::string &caption); - virtual void SetShowCaptionAlways(bool) {} - virtual void SetCursor(ggadget::ViewInterface::CursorType cursor); - virtual void ShowTooltip(const std::string &tooltip); - virtual void ShowTooltipAtPosition(const std::string &tooltip, - double x, double y); - virtual bool ShowView(bool modal, int flags, - Slot1<bool, int> *feedback_handler); - virtual void CloseView(); - virtual bool ShowContextMenu(int button); - virtual void BeginResizeDrag(int, ViewInterface::HitTest) {} - virtual void BeginMoveDrag(int) {} - - virtual void Alert(const ViewInterface *view, const char *message); - virtual ConfirmResponse Confirm(const ViewInterface *view, - const char *message, bool); - virtual std::string Prompt(const ViewInterface *view, - const char *message, - const char *default_value); - virtual int GetDebugMode() const; - - GadgetInfo *getInfo(); - - private: - class Private; - Private *d; - DISALLOW_EVIL_CONSTRUCTORS(PlasmaViewHost); -}; - -} // namespace ggadget - -#endif // GGADGET_PLASMA_VIEW_HOST_H__ diff --git a/plasma/generic/scriptengines/google_gadgets/plasma_view_host_internal.h b/plasma/generic/scriptengines/google_gadgets/plasma_view_host_internal.h deleted file mode 100644 index ed69f65..0000000 --- a/plasma/generic/scriptengines/google_gadgets/plasma_view_host_internal.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - Copyright 2008 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef HOSTS_PLASMA_VIEW_HOST_INTERNAL_H__ -#define HOSTS_PLASMA_VIEW_HOST_INTERNAL_H__ -#include <Plasma/Dialog> -#include <Plasma/Applet> -#include <ggadget/qt/qt_menu.h> -#include <ggadget/view_interface.h> -#include <ggadget/qt/utilities.h> -#include <QDialogButtonBox> -#include <QVBoxLayout> -namespace ggadget{ - -class PlasmaViewHost::Private : public QObject { - Q_OBJECT - public: - Private(GadgetInfo *i, Type type, bool popout) - : view_(NULL), - parent_widget_(NULL), - widget_(NULL), - type_(type), - info(i), - is_popout_(popout), - feedback_handler_(NULL) {} - - ~Private() { - closeView(); - delete feedback_handler_; - } - - /* Show the view in right place - * - floating and docked main view: Shown within the applet - * - popouted main view and details view: Shown in QtViewWidget - * - OptionsView isn't handled here. - */ - bool showView(bool modal, int flags, Slot1<bool, int> *feedback_handler) { - // Only OptionsView needs these two. - Q_UNUSED(modal); - Q_UNUSED(flags); - - ASSERT(view_); - if (feedback_handler_ != feedback_handler) { - delete feedback_handler_; - feedback_handler_ = feedback_handler; - } - - if (widget_) return true; - - if (type_ == ViewHostInterface::VIEW_HOST_MAIN && !is_popout_) { - // normal main view - if (info->main_view_widget == NULL) { - widget_ = new QtViewWidget(view_, 0); - widget_->setAttribute(Qt::WA_NoSystemBackground); - info->proxy = new QGraphicsProxyWidget(info->applet); - info->proxy->setWidget(widget_); - widget_->show(); - info->main_view_widget = widget_; - } else { - widget_ = info->main_view_widget; - widget_->SetView(view_); - adjustAppletSize(); - } - info->applet->setBackgroundHints(Plasma::Applet::NoBackground); - if (info->applet->location() == Plasma::Floating) { - connect(widget_, SIGNAL(moved(int, int)), - this, SLOT(onViewMoved(int, int))); - } else { - disconnect(); - } - } else { - // Popouted main view and details view - widget_ = new QtViewWidget(view_, QtViewWidget::FLAG_MOVABLE); - parent_widget_ = widget_; - SetGadgetWindowIcon(widget_, view_->GetGadget()); - if (info->expanded_main_view_host && - type_ == ViewHostInterface::VIEW_HOST_DETAILS) { - int w = view_->GetWidth(); - int h = view_->GetHeight(); - QWidget *expanded = - static_cast<QWidget*>(info->expanded_main_view_host->GetNativeWidget()); - QPoint p = ggadget::qt::GetPopupPosition(expanded->geometry(), QSize(w, h)); - widget_->move(p); - } else { - widget_->move(info->applet->popupPosition(widget_->sizeHint())); - } - widget_->show(); - } - return true; - } - - void closeView() { - kDebug() << "CloseView"; - if (parent_widget_) { - delete parent_widget_; - parent_widget_ = NULL; - widget_ = NULL; - } else { - if (info->applet && widget_) { - // widget_ is owned by applet, so if applet is null, widget_ is - // destroyed already - widget_->SetView(NULL); - } - widget_ = NULL; - } - } - - void queueDraw() { - if (parent_widget_) { - parent_widget_->update(); - } else if (info->applet) { - info->applet->update(); - } - } - - // This is called when view size has changed, caused by constraintsEvent or - // user manually resizes gadget. Applet and widget size will be adjusted - // according to view size. - // size changing has two sequences: - // view->applet, widget, proxy - // applet->view->widget, proxy - void adjustAppletSize() { - if (!info->main_view_host || !info->applet || !info->proxy || !widget_) { - return; - } - ViewInterface *view = info->main_view_host->GetViewDecorator(); - double w = view->GetWidth(); - double h = view->GetHeight(); - if (w <= 0 || h <= 0) return; - - kDebug() << "view size:" << w << " " << h; - kDebug() << "applet old size:" << info->applet->size(); - kDebug() << "widget old size:" << widget_->size(); - kDebug() << "proxy old size:" << info->proxy->size(); - - info->applet->resize(w, h); - info->proxy->resize(w, h); - widget_->resize(w, h); - - kDebug() << "applet new size:" << info->applet->size(); - kDebug() << "widget new size:" << widget_->size(); - kDebug() << "proxy new size:" << info->proxy->size(); - } - - void queueResize() { - if (type_ == ViewHostInterface::VIEW_HOST_MAIN && !is_popout_) { - adjustAppletSize(); - } else if (widget_) { - widget_->AdjustToViewSize(); - } - } - - bool showContextMenu(int button) { - ASSERT(view_); - Q_UNUSED(button); - context_menu_.clear(); - QtMenu qt_menu(&context_menu_); - view_->OnAddContextMenuItems(&qt_menu); - if (!context_menu_.isEmpty()) { - context_menu_.popup(QCursor::pos()); - return true; - } else { - return false; - } - } - - ViewInterface *view_; - QWidget *parent_widget_; - QtViewWidget *widget_; - ViewHostInterface::Type type_; - GadgetInfo *info; - bool is_popout_; - - Slot1<bool, int> *feedback_handler_; - QString caption_; - QMenu context_menu_; - - private slots: - void onViewMoved(int x, int y) { - if (type_ == ViewHostInterface::VIEW_HOST_MAIN && !is_popout_ && - info->applet->immutability() == Plasma::Mutable) - info->applet->moveBy(x, y); - } -}; - -} // namespace ggadget - -#endif diff --git a/plasma/generic/scriptengines/google_gadgets/popout_decorator.cpp b/plasma/generic/scriptengines/google_gadgets/popout_decorator.cpp deleted file mode 100644 index 11d6a46..0000000 --- a/plasma/generic/scriptengines/google_gadgets/popout_decorator.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright 2009 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -#include "popout_decorator.h" - -#include <QtGui/QMessageBox> - -#include <ggadget/gadget_consts.h> -#include <ggadget/gadget.h> -#include <ggadget/messages.h> -#include <ggadget/menu_interface.h> -#include <ggadget/decorated_view_host.h> -#include <ggadget/qt/qt_view_widget.h> - -#include <Plasma/Applet> - -namespace ggadget { - -PopOutDecorator::PopOutDecorator(PlasmaViewHost *host) - : FloatingMainViewDecorator(host, true), - info(host->getInfo()) { - SetOptionPrefix("plasma_popout_main_view"); - SetButtonVisible(MainViewDecoratorBase::POP_IN_OUT_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::MENU_BUTTON, false); - SetButtonVisible(MainViewDecoratorBase::CLOSE_BUTTON, false); -} - -PopOutDecorator::~PopOutDecorator() {} - -void PopOutDecorator::OnAddDecoratorMenuItems(MenuInterface *menu) { - AddZoomMenuItem(menu); -} - -bool PopOutDecorator::ShowDecoratedView(bool modal, int flags, - Slot1<bool, int> *feedback_handler) { - info->applet->setMaximumSize(QSizeF()); - return FloatingMainViewDecorator::ShowDecoratedView(modal, flags, feedback_handler); -} - -} // namespace ggadget diff --git a/plasma/generic/scriptengines/google_gadgets/popout_decorator.h b/plasma/generic/scriptengines/google_gadgets/popout_decorator.h deleted file mode 100644 index 01a5671..0000000 --- a/plasma/generic/scriptengines/google_gadgets/popout_decorator.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright 2009 Google Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef GGADGET_POPOUT_DECORATOR_H__ -#define GGADGET_POPOUT_DECORATOR_H__ - -#include <ggadget/floating_main_view_decorator.h> -#include "plasma_view_host.h" - -namespace ggadget { - -class PopOutDecorator : public FloatingMainViewDecorator { - public: - PopOutDecorator(PlasmaViewHost *host); - virtual ~PopOutDecorator(); - virtual void OnAddDecoratorMenuItems(MenuInterface *menu); - virtual bool ShowDecoratedView(bool modal, int flags, - Slot1<bool, int> *feedback_handler); - - private: - GadgetInfo *info; - DISALLOW_EVIL_CONSTRUCTORS(PopOutDecorator); -}; - -} // namespace ggadget - -#endif
