add mimetype flexibility, by storing it in a variable with getters/setters, as discussed with asiego on panel-devel

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=689194
This commit is contained in:
Leo Franchi 2007-07-17 21:13:41 +00:00
parent 70ecce2899
commit f4ca9c1aca
3 changed files with 80 additions and 53 deletions

View File

@ -1,4 +1,8 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/libs)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
# this is so <plasma/foo.h> grabs local files before "real" plasma includes
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../../
${CMAKE_CURRENT_BINARY_DIR}/../../ ) # amarokconfig.h
########### next target ###############
@ -42,60 +46,60 @@ set(plasmagik_HEADERS
package.h
)
kde4_add_library(plasma SHARED ${plasma_LIB_SRCS})
kde4_add_library(amarokplasma SHARED ${plasma_LIB_SRCS})
target_link_libraries(plasma ${KDE4_KIO_LIBS})
target_link_libraries(amarokplasma ${KDE4_KIO_LIBS})
set_target_properties(plasma PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS plasma DESTINATION ${LIB_INSTALL_DIR})
set_target_properties(amarokplasma PROPERTIES VERSION 1.0.0 SOVERSION 1)
install(TARGETS amarokplasma DESTINATION ${LIB_INSTALL_DIR})
########### install files ###############
install(FILES ${plasmagik_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/)
install(FILES
abstractrunner.h
animator.h
applet.h
corona.h
dataengine.h
dataenginemanager.h
datasource.h
phase.h
plasma.h
plasma_export.h
svg.h
theme.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma)
install(FILES
widgets/icon.h
widgets/layout.h
widgets/layoutitem.h
widgets/lineedit.h
widgets/pushbutton.h
widgets/checkbox.h
widgets/radiobutton.h
widgets/vboxlayout.h
widgets/widget.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets)
install(FILES
includes/Applet
includes/Phase
includes/Plasma
includes/AbstractRunner
includes/Theme
includes/DataEngine
includes/DataEngineManager
includes/DataSource
includes/Svg
DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma)
install(FILES
servicetypes/plasma_animator.desktop
servicetypes/plasma_applet.desktop
servicetypes/plasma_dataengine.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR})
# install(FILES ${plasmagik_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/)
#
# install(FILES
# abstractrunner.h
# animator.h
# applet.h
# corona.h
# dataengine.h
# dataenginemanager.h
# datasource.h
# phase.h
# plasma.h
# plasma_export.h
# svg.h
# theme.h
# DESTINATION ${INCLUDE_INSTALL_DIR}/plasma)
#
# install(FILES
# widgets/icon.h
# widgets/layout.h
# widgets/layoutitem.h
# widgets/lineedit.h
# widgets/pushbutton.h
# widgets/checkbox.h
# widgets/radiobutton.h
# widgets/vboxlayout.h
# widgets/widget.h
# DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets)
#
# install(FILES
# includes/Applet
# includes/Phase
# includes/Plasma
# includes/AbstractRunner
# includes/Theme
# includes/DataEngine
# includes/DataEngineManager
# includes/DataSource
# includes/Svg
# DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma)
#
# install(FILES
# servicetypes/plasma_animator.desktop
# servicetypes/plasma_applet.desktop
# servicetypes/plasma_dataengine.desktop
# DESTINATION ${SERVICETYPES_INSTALL_DIR})
#

View File

@ -51,7 +51,8 @@ public:
: immutable(false),
formFactor(Planar),
location(Floating),
layout(0)
layout(0),
mimetype("text/x-plasmoidservicename")
{
}
@ -66,6 +67,7 @@ public:
FormFactor formFactor;
Location location;
Layout* layout;
QString mimetype;
};
Corona::Corona(QObject * parent)
@ -156,6 +158,16 @@ QRectF Corona::maxSizeHint() const
return sceneRect();
}
void Corona::setAppletMimeType(const QString& type)
{
d->mimetype = type;
}
QString Corona::appletMimeType()
{
return d->mimetype;
}
Applet* Corona::addApplet(const QString& name, const QStringList& args)
{
Applet* applet = Applet::loadApplet(name, 0, args);

View File

@ -65,6 +65,17 @@ public:
**/
QRectF maxSizeHint() const;
/**
* Sets the mimetype of Drag/Drop items. Default is
* text/x-plasmoidservicename
**/
void setAppletMimeType(const QString& mimetype);
/**
* The current mime type of Drag/Drop items.
**/
QString appletMimeType();
public Q_SLOTS:
/**
* Informs the Corona as to what position it is in. This is informational