From ceea23677c61f20759ae986bd77b0d5c4d673edb Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 17 Feb 2010 00:43:50 +0000 Subject: Added old KDE3 version of kbfx git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbfx@1091549 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- plugins/plasmoids/CMakeLists.txt | 44 ++++++ plugins/plasmoids/kbfxplasmadatapluginplosmoid.cpp | 152 +++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 plugins/plasmoids/CMakeLists.txt create mode 100644 plugins/plasmoids/kbfxplasmadatapluginplosmoid.cpp (limited to 'plugins/plasmoids') diff --git a/plugins/plasmoids/CMakeLists.txt b/plugins/plasmoids/CMakeLists.txt new file mode 100644 index 0000000..abb1167 --- /dev/null +++ b/plugins/plasmoids/CMakeLists.txt @@ -0,0 +1,44 @@ +SET(libkbfxplasmadataplasmoidsrc + kbfxplasmadatapluginplosmoid.cpp + ) + +FILE(GLOB HEADERS *.h) + +IF (NOT USE_KDE4) + KDE3_AUTOMOC(${libkbfxplasmadataplasmoidsrc}) + + ADD_LIBRARY(kbfxplasmadataplasmoid SHARED ${libkbfxplasmadataplasmoidsrc} ) + SET_TARGET_PROPERTIES(kbfxplasmadataplasmoid + PROPERTIES + COMPILE_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) + # SET_TARGET_PROPERTIES(kbfxplasmadataplasmoid PROPERTIES + # SOVERSION ${LIB_MAJOR} + # VERSION ${APPLICATION_VERSION}) + TARGET_LINK_LIBRARIES(kbfxplasmadataplasmoid + kbfxdata + ${QT_AND_KDECORE_LIBS} + ${KDE3_KIO_LIBRARY} + ${KDE3_UI_LIBRARY} + ${KDE3_KHTML_LIBRARY} + ${M_LIBRARY} + ) + + KDE3_INSTALL_LIBTOOL_FILE(kbfxplasmadataplasmoid ${LIB_INSTALL_DIR}/kbfx/plugins) +ELSE (NOT USE_KDE4) + KDE4_AUTOMOC(${libkbfxplasmadataplasmoidsrc}) + + KDE4_ADD_LIBRARY(kbfxplasmadataplasmoid SHARED ${libkbfxplasmadataplasmoidsrc} ) + TARGET_LINK_LIBRARIES(kbfxplasmadataplasmoid + kbfxdata + ${KDE4_KDECORE_LIBS} + ${KDE4_KIO_LIBS} + ${KDE4_KDEUI_LIBS} + ${KDE4_KHTML_LIBS} + ${M_LIBRARY} + ) + + KDE4_INSTALL_LIBTOOL_FILE(kbfxplasmadataplasmoid ${LIB_INSTALL_DIR}/kbfx/plugins) +ENDIF (NOT USE_KDE4) + +INSTALL(TARGETS kbfxplasmadataplasmoid DESTINATION ${LIB_INSTALL_DIR}/kbfx/plugins) +INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/kbfx/plugins) diff --git a/plugins/plasmoids/kbfxplasmadatapluginplosmoid.cpp b/plugins/plasmoids/kbfxplasmadatapluginplosmoid.cpp new file mode 100644 index 0000000..998fafb --- /dev/null +++ b/plugins/plasmoids/kbfxplasmadatapluginplosmoid.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2006 + * Siraj Razick + * PhobosK + * see Also AUTHORS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This 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 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 +#include +#include +#include +#include +#include +#include +#include + + + + + + + +KbfxDataStack * +view () +{ + + KbfxDataGroup *appGroup = new KbfxDataGroup (); + KbfxDataGroupList *glist = new KbfxDataGroupList (); + KbfxDataStack *gstack = new KbfxDataStack (); + + + glist->setName ( "Browse" ); + glist->setIcon ( "plasmagik" ); + appGroup->setName ( "Plasmoids" ); + + QString path = locate ( "data", "kicker/applets/lockout.desktop" ); + path.remove ( "lockout.desktop" ); + + + + QDir d ( path ); + d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); + d.setSorting ( QDir::Size | QDir::Reversed ); + d.setNameFilter ( "*.desktop" ); + + const QFileInfoList *list = d.entryInfoList (); + QFileInfoListIterator it ( *list ); + QFileInfo *fi; + while ( ( fi = it.current () ) != 0 ) + { + + KDesktopFile *desktop = new KDesktopFile ( fi->filePath () ); + + KbfxDataSource *src = new KbfxDataSource (); + + src->setName ( desktop->readName () ); + src->setContentPath ( fi->filePath () ); + src->setIconPath ( desktop->readIcon () ); + src->setCommand ( "dcop kicker Panel addApplet " + fi->filePath () ); + appGroup->addItem ( src ); + + + ++it; + } + + + gstack->setName ( "Plasmoids" ); + + glist->addGroup ( appGroup ); + gstack->addGroupList ( glist ); + return gstack; + + +} + +QString +name () +{ + return QString ( "Plasmoids" ); +} + +QString +type () +{ + return QString ( "Stub Type" ); +} + + +uint +id () +{ + return 1; //TODO see what can be done... manybe rand()? +} + + +#include + +KbfxDataGroup * +search ( QString _keyword ) +{ + KbfxDataGroup *appGroup = new KbfxDataGroup (); + + + QString path = locate ( "data", "kicker/applets/lockout.desktop" ); + path.remove ( "lockout.desktop" ); + + + + QDir d ( path ); + d.setFilter ( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); + d.setSorting ( QDir::Size | QDir::Reversed ); + d.setNameFilter ( "*.desktop" ); + + const QFileInfoList *list = d.entryInfoList (); + QFileInfoListIterator it ( *list ); + QFileInfo *fi; + + while ( ( fi = it.current () ) != 0 ) + { + if ( fi->fileName ().contains ( _keyword ) > 0 ) + { + KDesktopFile *desktop = new KDesktopFile ( fi->filePath () ); + + KbfxDataSource *src = new KbfxDataSource (); + + src->setName ( desktop->readName () ); + src->setContentPath ( fi->filePath () ); + src->setIconPath ( desktop->readIcon () ); + src->setCommand ( "dcop kicker Panel addApplet " + fi->filePath () ); + appGroup->addItem ( src ); + } + + ++it; + } + + + return appGroup; +} -- cgit v1.2.1