generic: purge Qt support with fire

see commit in kdelibs repository

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-02-07 02:14:07 +00:00
parent 803e130853
commit ce8f93a26f
714 changed files with 181 additions and 93150 deletions

View file

@ -45,7 +45,6 @@ macro_optional_add_subdirectory(kfloppy)
macro_optional_add_subdirectory(kget)
macro_optional_add_subdirectory(kgpg)
macro_optional_add_subdirectory(kmix)
macro_optional_add_subdirectory(kolourpaint)
macro_optional_add_subdirectory(kompare)
macro_optional_add_subdirectory(krdc)
macro_optional_add_subdirectory(krfb)

View file

@ -1,6 +1,3 @@
macro_optional_find_package(QJSON)
macro_log_feature(QJSON_FOUND "qjson" "A library for processing and serializing JSON files" "http://qjson.sourceforge.net" FALSE "" "Required for compiling Ark's unit tests")
########### next target ###############
set(kerfuffle_SRCS
@ -20,31 +17,25 @@ kde4_add_kcfg_files(kerfuffle_SRCS settings.kcfgc)
add_library(kerfuffle SHARED ${kerfuffle_SRCS})
target_link_libraries(kerfuffle ${KDE4_KFILE_LIBS} ${KDE4_KPARTS_LIBS})
if (NOT WIN32)
target_link_libraries(kerfuffle ${KDE4_KPTY_LIBS})
endif (NOT WIN32)
target_link_libraries(kerfuffle
${KDE4_KFILE_LIBS}
${KDE4_KPARTS_LIBS}
${KDE4_KPTY_LIBS}
)
set_target_properties(kerfuffle PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS kerfuffle ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES kerfufflePlugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES ark.kcfg DESTINATION ${KCFG_INSTALL_DIR})
if (QJSON_FOUND AND ENABLE_TESTING)
# This is a hack to make QJSON work with both 0.7.1 (the latest stable)
# and the current master (b440550), which uses a different casing for
# the CMake variables.
# It should be removed when QJSON master becomes sane and reverts the
# casing again.
if (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR)
set(KERFUFFLE_QJSON_LIBRARIES "${QJSON_LIBRARIES}")
set(KERFUFFLE_QJSON_INCLUDE_DIR "${QJSON_INCLUDE_DIR}")
else (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR)
set(KERFUFFLE_QJSON_LIBRARIES "${qjson_LIBRARIES}")
set(KERFUFFLE_QJSON_INCLUDE_DIR "${qjson_INCLUDE_DIR}")
endif (QJSON_LIBRARIES AND QJSON_INCLUDE_DIR)
install(
FILES kerfufflePlugin.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR}
)
install(
FILES ark.kcfg
DESTINATION ${KCFG_INSTALL_DIR}
)
if (ENABLE_TESTING)
add_subdirectory(tests)
endif ()

View file

@ -1,5 +1,3 @@
include_directories(${KERFUFFLE_QJSON_INCLUDE_DIR})
set(RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(JSONINTERFACE_SOURCES
@ -16,7 +14,6 @@ macro(KERFUFFLE_UNIT_TESTS)
kerfuffle
${KDE4_KDEUI_LIBS}
${QT_QTTEST_LIBRARY}
${KERFUFFLE_QJSON_LIBRARIES}
)
endforeach(_testname)
endmacro(KERFUFFLE_UNIT_TESTS)

View file

@ -15,9 +15,6 @@ macro_log_feature(KDE4WORKSPACE_FOUND "kdebase workspace" "KDE base workspace li
macro_optional_find_package(QCA2)
macro_log_feature(QCA2_FOUND "QCA2" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0.0" "Needed for building microblog dataengine")
macro_optional_find_package(KdepimLibs)
macro_log_feature(KDEPIMLIBS_FOUND "kdepimlibs" "KDE PIM libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma plugins")
set(LIBATTICA_MIN_VERSION "0.1.1")
macro_optional_find_package(LibAttica)
macro_log_feature(LIBATTICA_FOUND "libattica" "Attica Library" "http://websvn.kde.org/trunk/kdesupport/attica/" FALSE "" "Needed for building the Open Collaboration Services plasma dataengine and applets")
@ -25,12 +22,6 @@ macro_log_feature(LIBATTICA_FOUND "libattica" "Attica Library" "http://websvn.kd
macro_optional_find_package(OpenGL)
macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3D graphics applications" "http://mesa3d.sourceforge.net" FALSE "" "STRONGLY RECOMMENDED: The 3D hardware acceleration available through the OpenGL API is used in applications ranging from graphics and modellers to screensavers and video players.")
macro_optional_find_package(QJSON)
macro_log_feature(QJSON_FOUND "QJSon" "Used for various Internet runners, for parsing API responses, and the microblog dataengine" "" FALSE "" "")
macro_optional_find_package(QtOAuth)
macro_log_feature(QTOAUTH_FOUND "QtOAuth" "QtOAuth Library - required to build the Plasma Microblog DataEngine" "https://github.com/ayoy/qoauth" FALSE "" "Needed for building Plasma Microblog DataEngine")
macro_optional_find_package(Marble)
macro_log_feature(MARBLE_FOUND "Marble" "Desktop Globe" "http://marble.kde.org" FALSE "" "RECOMMENDED: Marble is used to provide a desktop globe wallpaper for Plasma.")
@ -38,11 +29,11 @@ macro_optional_find_package(DBusMenuQt)
macro_log_feature(DBUSMENUQT_FOUND "DBusMenuQt" "DBusMenu Qt" "https://launchpad.net/libdbusmenu-qt/" FALSE "" "Needed for Unity support in IconTasks.")
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories (${KDE4_INCLUDES}
include_directories(
${KDE4_INCLUDES}
${KDE4WORKSPACE_INCLUDE_DIR}
${KDEPIMLIBS_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libs)
${CMAKE_CURRENT_SOURCE_DIR}/libs
)
add_subdirectory(libs)
add_subdirectory(applets)

View file

@ -19,12 +19,10 @@ add_subdirectory(fifteenPuzzle)
add_subdirectory(fileWatcher)
add_subdirectory(frame)
add_subdirectory(kolourpicker)
add_subdirectory(konqprofiles)
add_subdirectory(konsoleprofiles)
add_subdirectory(life)
add_subdirectory(luna)
add_subdirectory(magnifique)
add_subdirectory(microblog)
add_subdirectory(notes)
add_subdirectory(nowplaying)
if(LIBATTICA_FOUND)
@ -44,13 +42,7 @@ add_subdirectory(eyes)
add_subdirectory(unitconverter)
add_subdirectory(weatherstation)
if(QT_QTWEBKIT_FOUND)
add_subdirectory(dict)
add_subdirectory(news)
add_subdirectory(webslice)
# this one needs kdewebkit actually
add_subdirectory(rememberthemilk)
endif(QT_QTWEBKIT_FOUND)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/qalculate/cmake_modules)
macro_optional_find_package(Qalculate)
@ -59,12 +51,6 @@ if ( QALCULATE_FOUND )
add_subdirectory(qalculate)
endif( QALCULATE_FOUND )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/kdeobservatory/cmake/modules)
macro_optional_find_package(Qwt)
if ( Qwt5-Qt4_FOUND )
add_subdirectory(kdeobservatory)
endif( Qwt5-Qt4_FOUND )
if(KDE4WORKSPACE_FOUND)
add_subdirectory(lancelot)
endif(KDE4WORKSPACE_FOUND)

View file

@ -1,16 +1,22 @@
project(plasma-dict)
INCLUDE_DIRECTORIES(
${QT_QTWEBKIT_INCLUDE_DIR})
set(dict_SRCS
dict.cpp)
kde4_add_plugin(plasma_applet_dict ${dict_SRCS})
target_link_libraries(plasma_applet_dict ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS}
dict.cpp
)
install(TARGETS plasma_applet_dict DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-dict-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
kde4_add_plugin(plasma_applet_dict ${dict_SRCS})
target_link_libraries(plasma_applet_dict
${KDE4_PLASMA_LIBS}
${KDE4_KDEUI_LIBS}
)
install(
TARGETS plasma_applet_dict
DESTINATION ${PLUGIN_INSTALL_DIR}
)
install(
FILES plasma-dict-default.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)
kde4_install_icons(${ICON_INSTALL_DIR})

View file

@ -1,53 +0,0 @@
project(plasma-kdeobservatory)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
find_package(KDE4 4.18.0 REQUIRED)
include(KDE4Defaults)
include_directories(${KDE4_INCLUDES})
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
find_package(Qwt REQUIRED)
include(KDE4Defaults)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${Qwt5_INCLUDE_DIR}
)
set(kdeobservatory_SRCS
src/iviewprovider.cpp
src/kdeobservatory.cpp
src/krazyreportview.cpp
src/topdevelopersview.cpp
src/commithistoryview.cpp
src/topactiveprojectsview.cpp
src/kdeobservatoryconfigviews.cpp
src/kdeobservatoryconfiggeneral.cpp
src/kdeobservatoryconfigprojects.cpp
)
kde4_add_ui_files(kdeobservatory_SRCS
src/ui/kdeobservatoryconfigviews.ui
src/ui/kdeobservatoryconfiggeneral.ui
src/ui/kdeobservatoryconfigproject.ui
src/ui/kdeobservatoryconfigprojects.ui
)
kde4_add_plugin(plasma_applet_kdeobservatory ${kdeobservatory_SRCS})
target_link_libraries(plasma_applet_kdeobservatory
${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} ${QT_QTSQL_LIBRARY} ${Qwt5-Qt4_LIBRARY})
install(TARGETS plasma_applet_kdeobservatory
DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-kdeobservatory.desktop
DESTINATION ${SERVICES_INSTALL_DIR})
add_subdirectory(icons)

View file

@ -1,105 +0,0 @@
# Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4
#
# On Windows it makes these assumptions:
# - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path
# - the Qwt .h files are in QT_DIR\include\Qwt or in the path
# - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path
#
# Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt
# Qwt5-Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5-Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
# Qwt5-Qt4_FOUND - Qwt5 was found and uses Qt4
# Qwt5-Qt3_FOUND - Qwt5 was found and uses Qt3
# Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4)
# Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Condition is "(A OR B) AND C", CMake does not support parentheses but it evaluates left to right
IF(Qwt5-Qt4_LIBRARY OR Qwt5-Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
SET(Qwt5_FIND_QUIETLY TRUE)
ENDIF(Qwt5-Qt4_LIBRARY OR Qwt5-Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
IF( WITH_KATIE )
FIND_PACKAGE( Katie )
ENDIF()
IF( NOT KATIE_FOUND)
FIND_PACKAGE( Qt4 REQUIRED QUIET )
ENDIF()
IF( QT4_FOUND )
# Is Qwt5 installed? Look for header files
FIND_PATH( Qwt5_INCLUDE_DIR qwt_event_pattern.h PATHS ${QT_INCLUDE_DIR} PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH)
# Find Qwt version
IF( Qwt5_INCLUDE_DIR )
FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H )
STRING( REGEX MATCH "#define *QWT_VERSION *(0x05)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H})
IF( QWT_IS_VERSION_5 )
STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}")
# Find Qwt5 library linked to Qt4
FIND_LIBRARY( Qwt5-Qt4_TENTATIVE_LIBRARY NAMES qwt5-qt4 qwt-qt4 qwt5 qwt )
IF( UNIX AND NOT CYGWIN)
IF( Qwt5-Qt4_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5-Qt4_TENTATIVE_LIBRARY = ${Qwt5-Qt4_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5-Qt4_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt4_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "QtCore" Qwt5_IS_LINKED_TO_Qt4 ${Qwt-Qt4_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt4 )
SET( Qwt5-Qt4_LIBRARY ${Qwt5-Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5-Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt4 )
ENDIF( Qwt5-Qt4_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
# Assumes qwt.dll is in the Qt dir
SET( Qwt5-Qt4_LIBRARY ${Qwt5-Qt4_TENTATIVE_LIBRARY} )
SET( Qwt5-Qt4_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
# Find Qwt5 library linked to Qt3
FIND_LIBRARY( Qwt5-Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 )
IF( UNIX AND NOT CYGWIN)
IF( Qwt5-Qt3_TENTATIVE_LIBRARY )
#MESSAGE("Qwt5-Qt3_TENTATIVE_LIBRARY = ${Qwt5-Qt3_TENTATIVE_LIBRARY}")
EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5-Qt3_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt3_LIBRARIES_LINKED_TO )
STRING( REGEX MATCH "qt-mt" Qwt5_IS_LINKED_TO_Qt3 ${Qwt-Qt3_LIBRARIES_LINKED_TO})
IF( Qwt5_IS_LINKED_TO_Qt3 )
SET( Qwt5-Qt3_LIBRARY ${Qwt5-Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5-Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( Qwt5_IS_LINKED_TO_Qt3 )
ENDIF( Qwt5-Qt3_TENTATIVE_LIBRARY )
ELSE( UNIX AND NOT CYGWIN)
SET( Qwt5-Qt3_LIBRARY ${Qwt5-Qt3_TENTATIVE_LIBRARY} )
SET( Qwt5-Qt3_FOUND TRUE )
IF (NOT Qwt5_FIND_QUIETLY)
MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" )
ENDIF (NOT Qwt5_FIND_QUIETLY)
ENDIF( UNIX AND NOT CYGWIN)
ENDIF( QWT_IS_VERSION_5 )
IF( Qwt5-Qt4_FOUND OR Qwt5-Qt3_FOUND )
SET( Qwt5_FOUND TRUE )
ENDIF( Qwt5-Qt4_FOUND OR Qwt5-Qt3_FOUND )
MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5-Qt4_LIBRARY Qwt5-Qt3_LIBRARY )
ENDIF( Qwt5_INCLUDE_DIR )
IF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Qwt 5.x")
ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
ENDIF( QT4_FOUND )

View file

@ -1 +0,0 @@
kde4_install_icons(${ICON_INSTALL_DIR})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -1,114 +0,0 @@
[Desktop Entry]
Name=KDE Observatory
Name[ar]=مرقاب كدي
Name[ast]=KDE Observatory
Name[bs]=opservatorija KDEa
Name[ca]=Observatori KDE
Name[ca@valencia]=Observatori KDE
Name[cs]=KDE Observatory
Name[da]=KDE-observatorium
Name[de]=KDE-Observatorium
Name[el]=Παρατηρητήριο του KDE
Name[en_GB]=KDE Observatory
Name[es]=Observatorio de KDE
Name[et]=KDE ülevaataja
Name[eu]=KDE-ren behatokia
Name[fi]=KDE-observatorio
Name[fr]=Observatoire de KDE
Name[ga]=Réadlann KDE
Name[gl]=Observatorio de KDE
Name[hr]=KDE-ov opservatorij
Name[hu]=KDE obszervatórium
Name[it]=Osservatorio di KDE
Name[ja]=KDE
Name[kk]=KDE бақылау бекеті
Name[km]= KDE
Name[ko]=KDE
Name[lt]=KDE observatorija
Name[lv]=KDE observatorija
Name[mr]=
Name[nb]=KDE-observatorium
Name[nds]=KDE-Projektkieker
Name[nl]=KDE Sterrenwacht
Name[nn]=KDE-observatorium
Name[pa]=KDE
Name[pl]=Obserwatorium KDE
Name[pt]=Observatório do KDE
Name[pt_BR]=Observatório do KDE
Name[ro]=Observator KDE
Name[ru]=Статистика разработки KDE
Name[sk]=Observatórium KDE
Name[sl]=Opazovanje KDE-ja
Name[sr]=опсерваторија КДЕа
Name[sr@ijekavian]=опсерваторија КДЕа
Name[sr@ijekavianlatin]=opservatorija KDEa
Name[sr@latin]=opservatorija KDEa
Name[sv]=KDE-observatorium
Name[tr]=KDE Gözlem Evi
Name[uk]=Спостережний пункт KDE
Name[wa]=Observatwere KDE
Name[x-test]=xxKDE Observatoryxx
Name[zh_CN]=KDE
Name[zh_TW]=KDE
Comment=Visualize the KDE ecosystem
Comment[bs]=Vizuelizacija ekosistema KDEa
Comment[ca]=Visualitzeu l'ecosistema KDE
Comment[ca@valencia]=Visualitzeu l'ecosistema KDE
Comment[cs]=Vizualizace ekosystému KDE
Comment[da]=Visualisering af KDE's økosystem
Comment[de]=Anzeige des KDE-Ökosystems
Comment[el]=Οπτικοποίηση του οικοσυστήματος του KDE
Comment[en_GB]=Visualise the KDE ecosystem
Comment[es]=Visualizar el ecosistema de KDE
Comment[et]=KDE ökosüsteemi näitamine
Comment[eu]=KDE ekosistema erakutsi
Comment[fi]=Visualisoi KDE:n ekosysteemi
Comment[fr]=Visualisez l'écosystème de KDE
Comment[gl]=Visualice o ecosistema de KDE.
Comment[hr]=Vizualiziraj ekosustav KDE-a
Comment[hu]=Megjeleníti a KDE ökoszisztémáját
Comment[it]=Visualizza l'ecosistema di KDE
Comment[ja]=KDE
Comment[kk]=KDE экосистемасының жағдайы
Comment[km]= KDE ecosystem
Comment[ko]=KDE
Comment[lt]=Vizualizuoti KDE ekosistemą
Comment[lv]=Vizualizē KDE ekosistēmu
Comment[mr]=
Comment[nb]=Visualiser KDE-økosystemet
Comment[nds]=De Projekten op KDE ankieken
Comment[nl]=Het KDE-ecosysteem visualiseren
Comment[nn]=Visualiser KDE-økosystemet
Comment[pl]=Wyobraź sobie ekosystem KDE
Comment[pt]=Visualizar o ecossistema do KDE
Comment[pt_BR]=Visualiza o ecossistema do KDE
Comment[ro]=Vizualizează ecosistemul KDE
Comment[ru]=Визуализация работы сообщества KDE
Comment[sk]=Vizualizácia ekosystému KDE
Comment[sl]=Vizualizira KDE-jev ekosistem
Comment[sr]=Визуелизација екосистема КДЕа
Comment[sr@ijekavian]=Визуелизација екосистема КДЕа
Comment[sr@ijekavianlatin]=Vizuelizacija ekosistema KDEa
Comment[sr@latin]=Vizuelizacija ekosistema KDEa
Comment[sv]=Åskådliggör KDE:s ekosystem
Comment[tr]=KDE ekosistemini canlandır
Comment[uk]=Візуалізація екосистеми KDE
Comment[wa]=Vey l' ecosistinme da KDE
Comment[x-test]=xxVisualize the KDE ecosystemxx
Comment[zh_CN]= KDE
Comment[zh_TW]= KDE
Type=Service
Icon=kdeobservatory.png
X-KDE-ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_kdeobservatory
X-KDE-PluginInfo-Author=<a href='mailto:sandroandrade@kde.org'>Sandro S. Andrade</a> (developer)<br/><a href='mailto:leetolson@gmail.com'>Lee Olson</a> (artwork)
X-KDE-PluginInfo-Name=kdeobservatory
X-KDE-PluginInfo-Version=0.2
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Development Tools
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-Requires-FileDialog=Unused
X-Plasma-Requires-LaunchApp=Unused

View file

@ -1,4 +0,0 @@
#! /usr/bin/env bash
$EXTRACTRC `find -name \*.ui` >> rc.cpp || exit 11
$XGETTEXT *.cpp -o $podir/plasma_applet_kdeobservatory.pot
rm -f rc.cpp

View file

@ -1,153 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "commithistoryview.h"
#include <QGraphicsProxyWidget>
#include <KGlobalSettings>
#include <qwt_plot.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_curve.h>
#include <qwt_scale_widget.h>
class TimeScaleDraw : public QwtScaleDraw
{
public:
TimeScaleDraw(const QDate &minDate)
{
m_minDate = minDate;
}
virtual QwtText label(double v) const
{
QString dateFormat = KGlobal::locale()->dateFormatShort();
if (dateFormat == "%Y-%m-%d")
return QwtText(m_minDate.addDays((int)v).toString("MM/dd"));
else
return QwtText(m_minDate.addDays((int)v).toString("dd/MM"));
}
private:
QDate m_minDate;
};
CommitHistoryView::CommitHistoryView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &commitHistoryViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags)
: IViewProvider(kdeObservatory, parent, wFlags),
m_commitHistoryViewProjects(commitHistoryViewProjects),
m_projects(projects)
{
}
CommitHistoryView::~CommitHistoryView()
{
}
void CommitHistoryView::createViews()
{
deleteViews();
QHashIterator<QString, bool> i(m_commitHistoryViewProjects);
while (i.hasNext())
{
i.next();
if (i.value())
createView(i18nc("Commit history for a given project %1", "Commit History - %1", i.key()), QString("Commit History - ") + i.key());
}
}
void CommitHistoryView::updateViews(const Plasma::DataEngine::Data &data)
{
QString project = data["project"].toString();
const DateCommitList &projectCommits = data[project].value<DateCommitList>();
int count = projectCommits.count();
if (count > 0)
{
int maxCommit = 0;
QString tmpStr = projectCommits.at(0).first;
qlonglong minDate = tmpStr.remove('-').toLongLong();
double *x = new double[count];
double *y = new double[count];
int count = projectCommits.count();
int j;
for (j = 0; j < count; ++j)
{
const QPair<QString, int> &pair = projectCommits.at(j);
tmpStr = pair.first;
x[j] = j;
y[j] = pair.second;
if (y[j] > maxCommit)
maxCommit = y[j];
}
QGraphicsWidget *container = containerForView(QString("Commit History - ") + project);
if (!container) {
delete []x;
delete []y;
return;
}
QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(container);
proxy->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
QwtPlot *plot = new QwtPlot;
plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
plot->setAttribute(Qt::WA_TranslucentBackground, true);
plot->setAxisScale(QwtPlot::yLeft, 0, qRound((maxCommit/5.)+0.5)*5, qRound((maxCommit/5.)+0.5));
plot->setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw(QDate::fromString(QString::number(minDate), "yyyyMMdd")));
plot->setAxisFont(QwtPlot::yLeft, KGlobalSettings::smallestReadableFont());
plot->setAxisFont(QwtPlot::xBottom, KGlobalSettings::smallestReadableFont());
plot->setAxisLabelRotation(QwtPlot::xBottom, -15);
plot->setCanvasBackground(QColor(0, 0, 140));
QwtPlotCurve *curve = new QwtPlotCurve;
#if QWT_VERSION >= (((6) << 16) | ((0) << 8) | (0))
curve->setSamples(x, y, j);
#else
curve->setData(x, y, j);
#endif
delete []x;
delete []y;
curve->attach(plot);
QPen pen = curve->pen();
pen.setColor(QColor(255, 255, 0));
curve->setPen(pen);
plot->replot();
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::NoPen));
grid->attach(plot);
proxy->setWidget(plot);
plot->setGeometry(0, 0, container->geometry().width(), container->geometry().height());
}
}

View file

@ -1,42 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef COMMITHISTORYVIEW_HEADER
#define COMMITHISTORYVIEW_HEADER
#include "iviewprovider.h"
#include "kdeobservatory.h"
class CommitHistoryView : public IViewProvider
{
public:
CommitHistoryView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &commitHistoryViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~CommitHistoryView();
virtual void createViews();
virtual void updateViews(const Plasma::DataEngine::Data &data);
private:
const QHash<QString, bool> &m_commitHistoryViewProjects;
const QMap<QString, KdeObservatory::Project> &m_projects;
};
#endif

View file

@ -1,78 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "iviewprovider.h"
#include <QGraphicsLinearLayout>
#include <QtGui/qgraphicsitem.h>
#include <Plasma/Frame>
IViewProvider::IViewProvider(KdeObservatory *kdeObservatory, QGraphicsWidget *parent, Qt::WindowFlags wFlags)
: m_kdeObservatory(kdeObservatory),
m_parent(parent),
m_wFlags(wFlags)
{
}
IViewProvider::~IViewProvider()
{
}
void IViewProvider::createView(const QString &title, const QString &id)
{
QGraphicsWidget *view = new QGraphicsWidget(m_parent);
view->setHandlesChildEvents(true);
view->hide();
Plasma::Frame *header = new Plasma::Frame(view);
header->setText(title);
header->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QGraphicsWidget *container = new QGraphicsWidget(view);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, view);
layout->addItem(header);
layout->addItem(container);
view->setLayout(layout);
view->setGeometry(m_parent->geometry());
m_views.insert(id, view);
m_viewContainers.insert(id, container);
}
QGraphicsWidget *IViewProvider::containerForView(const QString &id)
{
return m_viewContainers[id];
}
void IViewProvider::deleteViews()
{
foreach(QGraphicsWidget *view, m_views)
view->deleteLater();
m_views.clear();
}
const QList<QGraphicsWidget *> IViewProvider::views() const
{
return m_views.values();
}

View file

@ -1,60 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef IVIEWPROVIDER_HEADER
#define IVIEWPROVIDER_HEADER
#include <QGraphicsWidget>
#include <Plasma/DataEngine>
#include <QGraphicsWidget>
namespace Plasma
{
class Frame;
}
class KdeObservatory;
class IViewProvider : public QObject
{
Q_OBJECT
public:
explicit IViewProvider(KdeObservatory *kdeObservatory, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~IViewProvider();
void createView(const QString &title, const QString &id);
QGraphicsWidget *containerForView(const QString &id);
void deleteViews();
const QList<QGraphicsWidget *> views() const;
virtual void createViews() = 0;
virtual void updateViews(const Plasma::DataEngine::Data &data) = 0;
protected:
KdeObservatory *m_kdeObservatory;
QGraphicsWidget *m_parent;
Qt::WindowFlags m_wFlags;
QMap<QString, QGraphicsWidget *> m_views;
QHash<QString, QGraphicsWidget *> m_viewContainers;
};
#endif

View file

@ -1,839 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "kdeobservatory.h"
#include <QTimer>
#include <QTimeLine>
#include <QGraphicsScene>
#include <QtGui/qlistwidget.h>
#include <QGraphicsProxyWidget>
#include <QGraphicsLinearLayout>
#include <QGraphicsItemAnimation>
#include <KConfig>
#include <KDateTime>
#include <KConfigDialog>
#include <KGlobalSettings>
#include <Plasma/Label>
#include <Plasma/Meter>
#include <Plasma/DataEngine>
#include <Plasma/PushButton>
#include <solid/networking.h>
#include "krazyreportview.h"
#include "topdevelopersview.h"
#include "commithistoryview.h"
#include "topactiveprojectsview.h"
#include "kdeobservatoryconfigviews.h"
#include "kdeobservatoryconfiggeneral.h"
#include "kdeobservatoryconfigprojects.h"
K_EXPORT_PLASMA_APPLET(kdeobservatory, KdeObservatory)
KdeObservatory::KdeObservatory(QObject *parent, const QVariantList &args)
: Plasma::PopupApplet(parent, args),
m_mainContainer(0),
m_currentView(0),
m_viewTransitionTimer(new QTimer(this)),
m_transitionTimer(new QTimeLine(500, this)),
m_engine(0),
m_service(0)
{
setBackgroundHints(DefaultBackground);
setHasConfigurationInterface(true);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
resize(300, 200);
connect(m_transitionTimer, SIGNAL(finished()), this, SLOT(timeLineFinished()));
connect(m_viewTransitionTimer, SIGNAL(timeout()), this, SLOT(moveViewRight()));
}
KdeObservatory::~KdeObservatory()
{
delete m_viewTransitionTimer;
delete m_transitionTimer;
delete m_service;
if (!hasFailedToLaunch())
{
delete m_viewProviders[i18n("Top Active Projects")];
delete m_viewProviders[i18n("Top Developers")];
delete m_viewProviders[i18n("Commit History")];
delete m_viewProviders[i18n("Krazy Report")];
}
}
void KdeObservatory::init()
{
m_engine = dataEngine("kdeobservatory");
m_service = m_engine->serviceForSource("");
connect(m_service, SIGNAL(engineReady()), SLOT(safeInit()));
connect(m_service, SIGNAL(engineError(QString,QString)), SLOT(engineError(QString,QString)));
setPopupIcon(KIcon("kdeobservatory"));
if (Solid::Networking::status() != Solid::Networking::Connected && Solid::Networking::status() != Solid::Networking::Unknown)
{
engineError("fatal", i18n("No active network connection"));
return;
}
Plasma::PopupApplet::setBusy(true);
m_service->startOperationCall(m_service->operationDescription("allProjectsInfo"));
}
QGraphicsWidget *KdeObservatory::graphicsWidget()
{
if (!m_mainContainer)
{
m_mainContainer = new QGraphicsWidget(this);
m_mainContainer->installEventFilter(this);
m_viewContainer = new QGraphicsWidget(m_mainContainer);
m_viewContainer->setAcceptHoverEvents(true);
m_viewContainer->setHandlesChildEvents(true);
m_viewContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_viewContainer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
m_right = new Plasma::PushButton(m_mainContainer);
m_right->setIcon(KIcon("go-next-view"));
m_right->setToolTip(i18n("Go to previous view"));
m_right->setMaximumSize(22, 22);
m_right->hide();
connect(m_right, SIGNAL(clicked()), this, SLOT(moveViewRightClicked()));
m_left = new Plasma::PushButton(m_mainContainer);
m_left->setIcon(KIcon("go-previous-view"));
m_left->setToolTip(i18n("Go to next view"));
m_left->setMaximumSize(22, 22);
m_left->hide();
connect(m_left, SIGNAL(clicked()), this, SLOT(moveViewLeftClicked()));
m_collectorProgress = new Plasma::Meter(m_mainContainer);
m_collectorProgress->hide();
m_collectorProgress->setMeterType(Plasma::Meter::BarMeterHorizontal);
m_collectorProgress->setMaximumHeight(22);
m_collectorProgress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_collectorProgress->setValue(0);
m_updateLabel = new Plasma::Label(m_mainContainer);
m_updateLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_updateLabel->setFont(KGlobalSettings::smallestReadableFont());
m_updateLabel->setAlignment(Qt::AlignCenter);
m_horizontalLayout = new QGraphicsLinearLayout(Qt::Horizontal);
m_horizontalLayout->addItem(m_left);
m_horizontalLayout->addItem(m_updateLabel);
m_horizontalLayout->addItem(m_right);
m_horizontalLayout->setMaximumHeight(22);
QGraphicsLinearLayout *verticalLayout = new QGraphicsLinearLayout(Qt::Vertical);
verticalLayout->addItem(m_viewContainer);
verticalLayout->addItem(m_horizontalLayout);
m_mainContainer->setLayout(verticalLayout);
m_mainContainer->setPreferredSize(300, 200);
m_mainContainer->setMinimumSize(300, 200);
}
return m_mainContainer;
}
bool KdeObservatory::eventFilter(QObject *receiver, QEvent *event)
{
if (!m_viewProviders.isEmpty() &&
dynamic_cast<QGraphicsWidget *>(receiver) == m_mainContainer &&
event->type() == QEvent::GraphicsSceneResize)
{
delete m_transitionTimer;
m_viewTransitionTimer->stop();
createViews();
updateSources();
m_viewTransitionTimer->start();
m_transitionTimer = new QTimeLine(500, this);
connect(m_transitionTimer, SIGNAL(finished()), this, SLOT(timeLineFinished()));
return true;
}
else
return Plasma::PopupApplet::eventFilter(receiver, event);
}
bool KdeObservatory::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{
Q_UNUSED(watched);
if (event->type() == QEvent::GraphicsSceneHoverEnter && m_enableAutoViewChange)
m_viewTransitionTimer->stop();
else if (event->type() == QEvent::GraphicsSceneHoverLeave && m_enableAutoViewChange)
m_viewTransitionTimer->start();
else
return Plasma::PopupApplet::sceneEventFilter(watched, event);
return true;
}
void KdeObservatory::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data)
{
// Prevent for being updated from another instance update request
if (data["appletId"].toUInt() != id())
return;
QString project = data["project"].toString();
if (sourceName != "topActiveProjects" && !data.contains(project) && !data.contains("error"))
return;
if (sourceName == "topActiveProjects")
m_viewProviders[i18n("Top Active Projects")]->updateViews(data);
else if (sourceName == "topProjectDevelopers" && !project.isEmpty())
m_viewProviders[i18n("Top Developers")]->updateViews(data);
else if (sourceName == "commitHistory" && !project.isEmpty())
m_viewProviders[i18n("Commit History")]->updateViews(data);
else if (sourceName == "krazyReport" && !project.isEmpty())
m_viewProviders[i18n("Krazy Report")]->updateViews(data);
--m_sourceCounter;
m_collectorProgress->setValue(m_collectorProgress->maximum() - m_sourceCounter);
if (m_sourceCounter == 0)
{
KDateTime currentTime = KDateTime::currentLocalDateTime();
KLocale *locale = KGlobal::locale();
m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}"));
m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat())));
setBusy(false);
updateViews();
}
}
void KdeObservatory::safeInit()
{
if (m_projects.count() == 0)
{
configChanged();
saveConfig();
createViewProviders();
createTimers();
createViews();
m_sourceCounter = 4;
m_engine->connectSource("topActiveProjects", this);
m_engine->connectSource("topProjectDevelopers", this);
m_engine->connectSource("commitHistory", this);
m_engine->connectSource("krazyReport", this);
}
updateSources();
}
void KdeObservatory::engineError(const QString &source, const QString &error)
{
kDebug() << "Source:" << source << "Error:" << error;
if (source == "fatal" && m_sourceCounter > 0)
{
m_viewTransitionTimer->stop();
foreach(QGraphicsWidget *widget, m_views)
widget->hide();
m_views.clear();
graphicsWidget();
m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(255, 0, 0);}"));
m_updateLabel->setText(error);
setBusy(false);
return;
}
--m_sourceCounter;
if (m_sourceCounter == 0)
{
KDateTime currentTime = KDateTime::currentLocalDateTime();
KLocale *locale = KGlobal::locale();
m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}"));
m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat())));
setBusy(false);
updateViews();
}
}
void KdeObservatory::createConfigurationInterface(KConfigDialog *parent)
{
m_configGeneral = new KdeObservatoryConfigGeneral(parent);
parent->addPage(m_configGeneral, i18nc("Global configuration options", "General"), "applications-development");
m_configProjects = new KdeObservatoryConfigProjects(parent);
parent->addPage(m_configProjects, i18n("Projects"), "project-development");
m_configViews = new KdeObservatoryConfigViews(parent);
m_configViews->m_projects = m_projects;
m_configViews->m_projectsInView[i18n("Top Active Projects")] = m_topActiveProjectsViewProjects;
m_configViews->m_projectsInView[i18n("Top Developers")] = m_topDevelopersViewProjects;
m_configViews->m_projectsInView[i18n("Commit History")] = m_commitHistoryViewProjects;
m_configViews->m_projectsInView[i18n("Krazy Report")] = m_krazyReportViewProjects;
m_configViews->updateView(i18n("Top Active Projects"));
parent->addPage(m_configViews, i18n("Views"), "view-presentation");
connect(m_configProjects, SIGNAL(projectAdded(QString,QString)),
m_configViews, SLOT(projectAdded(QString,QString)));
connect(m_configProjects, SIGNAL(projectRemoved(QString)),
m_configViews, SLOT(projectRemoved(QString)));
// Config - General
if (m_activityRangeType == 0)
m_configGeneral->activitiesFullHistory->setChecked(true);
else if (m_activityRangeType == 1)
m_configGeneral->activitiesInPastDays->setChecked(true);
else
m_configGeneral->activitiesInRange->setChecked(true);
m_configGeneral->commitExtent->setValue(m_commitExtent);
m_configGeneral->fromDate->setDate(QDate::fromString(m_commitFrom, "yyyyMMdd"));
m_configGeneral->toDate ->setDate(QDate::fromString(m_commitTo , "yyyyMMdd"));
m_configGeneral->enableAutoViewChange->setChecked(m_enableAutoViewChange);
m_configGeneral->viewsDelay->setTime(QTime(m_viewsDelay/3600, (m_viewsDelay/60)%60, m_viewsDelay%60));
int viewsCount = m_activeViews.count();
for (int i = 0; i < viewsCount; ++i)
{
const QPair<QString, bool> &pair = m_activeViews.at(i);
QListWidgetItem * item = m_configViews->activeViews->findItems(pair.first, Qt::MatchFixedString).first();
item->setCheckState(pair.second == true ? Qt::Checked:Qt::Unchecked);
m_configViews->activeViews->takeItem(m_configViews->activeViews->row(item));
m_configViews->activeViews->insertItem(i, item);
}
// Config - Projects
QMapIterator<QString, Project> i(m_projects);
while (i.hasNext())
{
i.next();
Project project = i.value();
m_configProjects->createTableWidgetItem(i.key(), project.commitSubject, project.krazyReport, project.krazyFilePrefix, project.icon);
m_configProjects->projects->setCurrentCell(0, 0);
}
m_configProjects->projects->setCurrentItem(m_configProjects->projects->item(0, 0));
m_configProjects->projects->resizeColumnsToContents();
m_configProjects->projects->horizontalHeader()->setStretchLastSection(true);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(cancelClicked()), m_viewTransitionTimer, SLOT(start()));
m_viewTransitionTimer->stop();
connect(m_configGeneral->activitiesFullHistory, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(m_configGeneral->activitiesInPastDays, SIGNAL(toggled()), parent, SLOT(settingsModified()));
connect(m_configGeneral->activitiesInRange , SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(m_configGeneral->commitExtent, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified()));
connect(m_configGeneral->fromDate, SIGNAL(dateChanged(QDate)), parent, SLOT(settingsModified()));
connect(m_configGeneral->toDate, SIGNAL(dateChanged(QDate)), parent, SLOT(settingsModified()));
connect(m_configGeneral->enableAutoViewChange, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(m_configGeneral->viewsDelay, SIGNAL(dateTimeChanged(QDateTime)), parent, SLOT(settingsModified()));
connect(m_configProjects, SIGNAL(projectAdded(QString,QString)), parent, SLOT(settingsModified()));
connect(m_configProjects, SIGNAL(projectRemoved(QString)), parent, SLOT(settingsModified()));
connect(m_configProjects->projects, SIGNAL(cellChanged(int,int)), parent, SLOT(settingsModified()));
connect(m_configProjects, SIGNAL(projectEdited(QString)) , parent, SLOT(settingsModified()));
connect(m_configViews->activeViews, SIGNAL(itemChanged(QListWidgetItem*)), parent, SLOT(settingsModified()));
connect(m_configViews->tlbUp, SIGNAL(clicked(bool)), parent, SLOT(settingsModified()));
connect(m_configViews->tlbDown, SIGNAL(clicked(bool)), parent, SLOT(settingsModified()));
connect(m_configViews->views, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(m_configViews->projectsInView, SIGNAL(itemChanged(QListWidgetItem*)), parent, SLOT(settingsModified()));
connect(m_configViews->psbCheckAll, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(m_configViews->psbUncheckAll, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
}
void KdeObservatory::configAccepted()
{
// General properties
m_activityRangeType = (m_configGeneral->activitiesFullHistory->isChecked()) ? 0:(m_configGeneral->activitiesInPastDays->isChecked()) ? 1:2;
m_commitExtent = m_configGeneral->commitExtent->value();
m_commitFrom = m_configGeneral->fromDate->date().toString("yyyyMMdd");
m_commitTo = m_configGeneral->toDate ->date().toString("yyyyMMdd");
m_enableAutoViewChange = (m_configGeneral->enableAutoViewChange->checkState() == Qt::Checked) ? true:false;
QTime viewsDelay = m_configGeneral->viewsDelay->time();
m_viewsDelay = viewsDelay.second() + viewsDelay.minute()*60 + viewsDelay.hour()*3600;
m_activeViews.clear();
QStringList viewNames;
QList<bool> viewActives;
for (int i = 0; i < m_configViews->activeViews->count(); ++i)
{
QListWidgetItem *item = m_configViews->activeViews->item(i);
QString viewName = item->text();
bool viewActive = (item->checkState() == Qt::Checked) ? true:false;
m_activeViews << QPair<QString, bool>(viewName, viewActive);
viewNames << viewName;
viewActives << viewActive;
}
m_viewTransitionTimer->setInterval(m_viewsDelay * 1000);
// Projects properties
QStringList projectNames;
QStringList projectCommitSubjects;
QStringList projectKrazyReports;
QStringList projectKrazyFilePrefix;
QStringList projectIcons;
m_projects.clear();
int projectsCount = m_configProjects->projects->rowCount();
for (int i = 0; i < projectsCount; ++i)
{
Project project;
project.commitSubject = m_configProjects->projects->item(i, 1)->text();
project.krazyReport = m_configProjects->projects->item(i, 2)->text();
project.krazyFilePrefix = m_configProjects->projects->item(i, 3)->text();
project.icon = m_configProjects->projects->item(i, 0)->data(Qt::UserRole).value<QString>();
m_projects[m_configProjects->projects->item(i, 0)->text()] = project;
projectNames << m_configProjects->projects->item(i, 0)->text();
projectCommitSubjects << project.commitSubject;
projectKrazyReports << project.krazyReport;
projectKrazyFilePrefix << project.krazyFilePrefix;
projectIcons << project.icon;
}
m_configViews->on_views_currentIndexChanged(i18n("Top Active Projects"));
m_topActiveProjectsViewProjects = m_configViews->m_projectsInView[i18n("Top Active Projects")];
m_topDevelopersViewProjects = m_configViews->m_projectsInView[i18n("Top Developers")];
m_commitHistoryViewProjects = m_configViews->m_projectsInView[i18n("Commit History")];
m_krazyReportViewProjects = m_configViews->m_projectsInView[i18n("Krazy Report")];
saveConfig();
m_lastViewCount = m_views.count();
createTimers();
createViews();
updateSources();
}
void KdeObservatory::moveViewRight()
{
switchViews(1);
}
void KdeObservatory::moveViewLeft()
{
switchViews(-1);
}
void KdeObservatory::moveViewRightClicked()
{
m_viewTransitionTimer->stop();
moveViewRight();
// Causes a short delay (10s) to next transition
if (m_enableAutoViewChange)
QTimer::singleShot(10000, m_viewTransitionTimer, SLOT(start()));
}
void KdeObservatory::moveViewLeftClicked()
{
m_viewTransitionTimer->stop();
moveViewLeft();
// Causes a short delay (10s) to next transition
if (m_enableAutoViewChange)
QTimer::singleShot(10000, m_viewTransitionTimer, SLOT(start()));
}
void KdeObservatory::switchViews(int delta)
{
if (m_views.count() > 0 && m_transitionTimer->state() == QTimeLine::NotRunning)
{
int previousView = m_currentView;
int newView = m_currentView + delta;
m_currentView = (newView >= 0) ? (newView % m_views.count()):(m_views.count() + newView);
QGraphicsWidget *previousViewWidget = m_views.at(previousView);
QGraphicsWidget *currentViewWidget = m_views.at(m_currentView);
currentViewWidget->setPos(currentViewWidget->geometry().width(), 0);
currentViewWidget->show();
m_transitionTimer->setFrameRange(0, 1);
m_transitionTimer->setCurveShape(QTimeLine::EaseOutCurve);
m_animationPrevious = new QGraphicsItemAnimation(this);
m_animationPrevious->setItem(previousViewWidget);
m_animationPrevious->setTimeLine(m_transitionTimer);
m_animationPrevious->setPosAt(0, QPointF(0, 0));
m_animationPrevious->setPosAt(1, -delta*QPointF(previousViewWidget->geometry().width(), 0));
m_animationNew = new QGraphicsItemAnimation(this);
m_animationNew->setItem(currentViewWidget);
m_animationNew->setTimeLine(m_transitionTimer);
m_animationNew->setPosAt(0, delta*QPointF(currentViewWidget->geometry().width(), 0));
m_animationNew->setPosAt(1, QPointF(0, 0));
m_transitionTimer->start();
}
}
void KdeObservatory::timeLineFinished()
{
delete m_animationPrevious;
delete m_animationNew;
}
void KdeObservatory::setBusy(bool value)
{
if (m_mainContainer)
{
if (value)
{
m_right->hide();
m_left->hide();
m_updateLabel->hide();
m_horizontalLayout->removeItem(m_updateLabel);
m_collectorProgress->setValue(0);
m_horizontalLayout->insertItem(1, m_collectorProgress);
m_collectorProgress->show();
}
else
{
m_collectorProgress->hide();
m_horizontalLayout->removeItem(m_collectorProgress);
m_horizontalLayout->insertItem(1, m_updateLabel);
m_updateLabel->show();
m_left->show();
m_right->show();
}
}
Plasma::PopupApplet::setBusy(value);
}
void KdeObservatory::updateSources()
{
kDebug();
setBusy(true);
QString commitFrom = "";
QString commitTo = "";
if (m_activityRangeType == 2)
{
commitFrom = m_commitFrom;
commitTo = m_commitTo;
}
else if (m_activityRangeType == 1)
{
QDate currentDate = QDate::currentDate();
commitTo = currentDate.toString("yyyyMMdd");
commitFrom = currentDate.addDays(-m_commitExtent).toString("yyyyMMdd");
}
m_sourceCounter = 0;
uint appletId = id();
QListIterator< QPair<QString, bool> > i (m_activeViews);
while (i.hasNext())
{
const QPair<QString, bool> &pair = i.next();
if (pair.first == i18n("Top Active Projects") && pair.second)
{
KConfigGroup ops = m_service->operationDescription("topActiveProjects");
ops.writeEntry("appletId", appletId);
ops.writeEntry("commitFrom", commitFrom);
ops.writeEntry("commitTo" , commitTo);
m_service->startOperationCall(ops);
++m_sourceCounter;
}
if (pair.first == i18n("Top Developers") && pair.second)
{
QHashIterator<QString, bool> i1(m_topDevelopersViewProjects);
while (i1.hasNext())
{
i1.next();
if (i1.value())
{
KConfigGroup ops = m_service->operationDescription("topProjectDevelopers");
ops.writeEntry("appletId", appletId);
ops.writeEntry("project", i1.key());
ops.writeEntry("commitFrom", commitFrom);
ops.writeEntry("commitTo" , commitTo);
m_service->startOperationCall(ops);
++m_sourceCounter;
}
}
}
if (pair.first == i18n("Commit History") && pair.second)
{
QHashIterator<QString, bool> i2(m_commitHistoryViewProjects);
while (i2.hasNext())
{
i2.next();
if (i2.value())
{
KConfigGroup ops = m_service->operationDescription("commitHistory");
ops.writeEntry("appletId", appletId);
ops.writeEntry("project", i2.key());
ops.writeEntry("commitFrom", commitFrom);
ops.writeEntry("commitTo" , commitTo);
m_service->startOperationCall(ops);
++m_sourceCounter;
}
}
}
if (pair.first == i18n("Krazy Report") && pair.second)
{
QHashIterator<QString, bool> i3(m_krazyReportViewProjects);
while (i3.hasNext())
{
i3.next();
if (i3.value() && (m_projects[i3.key()].krazyReport.contains("reports") || m_projects[i3.key()].krazyReport.contains("component=")))
{
KConfigGroup ops = m_service->operationDescription("krazyReport");
ops.writeEntry("appletId", appletId);
ops.writeEntry("project", i3.key());
ops.writeEntry("krazyReport", m_projects[i3.key()].krazyReport);
ops.writeEntry("krazyFilePrefix", m_projects[i3.key()].krazyFilePrefix);
m_service->startOperationCall(ops);
++m_sourceCounter;
}
}
}
}
m_collectorProgress->setMaximum(m_sourceCounter);
m_collectorProgress->setValue(0);
}
void KdeObservatory::createViews()
{
m_viewTransitionTimer->stop();
foreach(QGraphicsWidget *widget, m_views)
widget->hide();
m_views.clear();
QListIterator< QPair<QString, bool> > i (m_activeViews);
while (i.hasNext())
{
const QPair<QString, bool> &pair = i.next();
const QString &view = pair.first;
if (pair.second && m_viewProviders.value(view))
m_viewProviders[view]->createViews();
}
}
void KdeObservatory::updateViews()
{
m_viewTransitionTimer->stop();
foreach(QGraphicsWidget *widget, m_views)
widget->hide();
m_views.clear();
QListIterator< QPair<QString, bool> > i (m_activeViews);
while (i.hasNext())
{
const QPair<QString, bool> &pair = i.next();
const QString &view = pair.first;
if (pair.second && m_viewProviders.value(view))
m_views.append(m_viewProviders[view]->views());
}
if (m_views.count() > 0)
{
if (m_views.count() != m_lastViewCount)
m_currentView = m_views.count()-1;
moveViewRight();
if (m_enableAutoViewChange && m_views.count() > 1)
m_viewTransitionTimer->start();
}
}
void KdeObservatory::configChanged()
{
KConfigGroup configGroup = config();
// Config - General
m_activityRangeType = configGroup.readEntry("activityRangeType", 1);
m_commitExtent = configGroup.readEntry("commitExtent", 7);
m_commitFrom = configGroup.readEntry("commitFrom", QDate::currentDate().toString("yyyyMMdd"));
m_commitTo = configGroup.readEntry("commitTo" , QDate::currentDate().toString("yyyyMMdd"));
m_enableAutoViewChange = configGroup.readEntry("enableAutoViewChange", true);
m_viewsDelay = configGroup.readEntry("viewsDelay", 5);
Plasma::DataEngine::Data presetsData = m_engine->query("allProjectsInfo");
QStringList viewNames = configGroup.readEntry("viewNames", presetsData["views"].toStringList());
QList<QVariant> viewActives = configGroup.readEntry("viewActives", presetsData["viewsActive"].toList());
m_activeViews.clear();
int viewsCount = viewNames.count();
for (int i = 0; i < viewsCount; ++i)
m_activeViews.append(QPair<QString, bool>(viewNames.at(i), viewActives.at(i).toBool()));
// Config - Projects
QStringList projectNames = configGroup.readEntry("projectNames", presetsData["projectNames"].toStringList());
QStringList projectCommitSubjects = configGroup.readEntry("projectCommitSubjects", presetsData["projectCommitSubjects"].toStringList());
QStringList projectKrazyReports = configGroup.readEntry("projectKrazyReports", presetsData["projectKrazyReports"].toStringList());
QStringList projectKrazyFilePrefix = configGroup.readEntry("projectKrazyFilePrefix", presetsData["projectKrazyFilePrefixes"].toStringList());
QStringList projectIcons = configGroup.readEntry("projectIcons", presetsData["projectIcons"].toStringList());
m_projects.clear();
int projectsCount = projectNames.count();
for (int i = 0; i < projectsCount; ++i)
{
Project project;
project.commitSubject = projectCommitSubjects.at(i);
project.krazyReport = projectKrazyReports.at(i);
project.krazyFilePrefix = projectKrazyFilePrefix.at(i);
project.icon = projectIcons.at(i);
m_projects[projectNames.at(i)] = project;
}
QStringList defaultProjectNames = presetsData["projectNames"].toStringList();
QList<QVariant> automaticallyInViews = presetsData["automaticallyInViews"].toList();
// Config - Top Active Projects
QStringList topActiveProjectsViewNames = configGroup.readEntry("topActiveProjectsViewNames", defaultProjectNames);
QList<QVariant> topActiveProjectsViewActives = configGroup.readEntry("topActiveProjectsViewActives", automaticallyInViews);
m_topActiveProjectsViewProjects.clear();
int topActiveProjectsViewsCount = topActiveProjectsViewNames.count();
for (int i = 0; i < topActiveProjectsViewsCount; ++i)
m_topActiveProjectsViewProjects[topActiveProjectsViewNames.at(i)] = topActiveProjectsViewActives.at(i).toBool();
// Config - Top Developers
QStringList topDevelopersViewNames = configGroup.readEntry("topDevelopersViewNames", defaultProjectNames);
QList<QVariant> topDevelopersViewActives = configGroup.readEntry("topDevelopersViewActives", automaticallyInViews);
m_topDevelopersViewProjects.clear();
int topDevelopersViewsCount = topDevelopersViewNames.count();
for (int i = 0; i < topDevelopersViewsCount; ++i)
m_topDevelopersViewProjects[topDevelopersViewNames.at(i)] = topDevelopersViewActives.at(i).toBool();
// Config - Commit History
QStringList commitHistoryViewNames = configGroup.readEntry("commitHistoryViewNames", defaultProjectNames);
QList<QVariant> commitHistoryViewActives = configGroup.readEntry("commitHistoryViewActives", automaticallyInViews);
m_commitHistoryViewProjects.clear();
int commitHistoryViewsCount = commitHistoryViewNames.count();
for (int i = 0; i < commitHistoryViewsCount; ++i)
m_commitHistoryViewProjects[commitHistoryViewNames.at(i)] = commitHistoryViewActives.at(i).toBool();
// Config - Krazy Report
QStringList krazyReportViewNames = configGroup.readEntry("krazyReportViewNames", defaultProjectNames);
QList<QVariant> krazyReportViewActives = configGroup.readEntry("krazyReportViewActives", automaticallyInViews);
m_krazyReportViewProjects.clear();
int krazyReportViewsCount = krazyReportViewNames.count();
for (int i = 0; i < krazyReportViewsCount; ++i)
m_krazyReportViewProjects[krazyReportViewNames.at(i)] = krazyReportViewActives.at(i).toBool();
}
void KdeObservatory::saveConfig()
{
// General properties
KConfigGroup configGroup = config();
configGroup.writeEntry("activityRangeType", m_activityRangeType);
configGroup.writeEntry("commitExtent", m_commitExtent);
configGroup.writeEntry("commitFrom", m_commitFrom);
configGroup.writeEntry("commitTo" , m_commitTo);
configGroup.writeEntry("enableAutoViewChange", m_enableAutoViewChange);
configGroup.writeEntry("viewsDelay", m_viewsDelay);
QStringList viewNames;
QList<bool> viewActives;
QListIterator< QPair<QString, bool> > i1(m_activeViews);
while (i1.hasNext())
{
const QPair<QString, bool> &pair = i1.next();
viewNames << pair.first;
viewActives << pair.second;
}
configGroup.writeEntry("viewNames", viewNames);
configGroup.writeEntry("viewActives", viewActives);
// Projects properties
QStringList projectNames;
QStringList projectCommitSubjects;
QStringList projectKrazyReports;
QStringList projectKrazyFilePrefix;
QStringList projectIcons;
QMapIterator<QString, Project> i2(m_projects);
while (i2.hasNext())
{
i2.next();
const Project &project = i2.value();
projectNames << i2.key();
projectCommitSubjects << project.commitSubject;
projectKrazyReports << project.krazyReport;
projectKrazyFilePrefix << project.krazyFilePrefix;
projectIcons << project.icon;
}
configGroup.writeEntry("projectNames", projectNames);
configGroup.writeEntry("projectCommitSubjects", projectCommitSubjects);
configGroup.writeEntry("projectKrazyReports", projectKrazyReports);
configGroup.writeEntry("projectKrazyFilePrefix", projectKrazyFilePrefix);
configGroup.writeEntry("projectIcons", projectIcons);
configGroup.writeEntry("topActiveProjectsViewNames", m_topActiveProjectsViewProjects.keys());
configGroup.writeEntry("topActiveProjectsViewActives", m_topActiveProjectsViewProjects.values());
configGroup.writeEntry("topDevelopersViewNames", m_topDevelopersViewProjects.keys());
configGroup.writeEntry("topDevelopersViewActives", m_topDevelopersViewProjects.values());
configGroup.writeEntry("commitHistoryViewNames", m_commitHistoryViewProjects.keys());
configGroup.writeEntry("commitHistoryViewActives", m_commitHistoryViewProjects.values());
configGroup.writeEntry("krazyReportViewNames", m_krazyReportViewProjects.keys());
configGroup.writeEntry("krazyReportViewActives", m_krazyReportViewProjects.values());
emit configNeedsSaving();
}
void KdeObservatory::createTimers()
{
m_viewTransitionTimer->setInterval(m_viewsDelay * 1000);
}
void KdeObservatory::createViewProviders()
{
if (!m_viewContainer)
graphicsWidget();
m_viewProviders[i18n("Top Active Projects")] = new TopActiveProjectsView(this, m_topActiveProjectsViewProjects, m_projects, m_viewContainer);
m_viewProviders[i18n("Top Developers")] = new TopDevelopersView(this, m_topDevelopersViewProjects, m_projects, m_viewContainer);
m_viewProviders[i18n("Commit History")] = new CommitHistoryView(this, m_commitHistoryViewProjects, m_projects, m_viewContainer);
m_viewProviders[i18n("Krazy Report")] = new KrazyReportView(this, m_krazyReportViewProjects, m_projects, m_viewContainer);
}

View file

@ -1,170 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef KDEOBSERVATORY_HEADER
#define KDEOBSERVATORY_HEADER
#include <KConfigGroup>
#include <Plasma/PopupApplet>
#include <Plasma/DataEngine>
#include <QTimer>
#include <QTimeLine>
#include <QNetworkReply>
#include <QGraphicsLinearLayout>
#include <QGraphicsItemAnimation>
class IViewProvider;
class KdeObservatoryConfigViews;
class KdeObservatoryConfigGeneral;
class KdeObservatoryConfigProjects;
namespace Plasma
{
class Label;
class Meter;
class Engine;
class PushButton;
}
class KdeObservatory : public Plasma::PopupApplet
{
Q_OBJECT
public:
KdeObservatory(QObject *parent, const QVariantList &args);
~KdeObservatory();
void init();
virtual QGraphicsWidget* graphicsWidget();
struct Project
{
QString commitSubject;
QString krazyReport;
QString krazyFilePrefix;
QString icon;
};
protected:
bool eventFilter(QObject *receiver, QEvent *event);
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
public Q_SLOTS:
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
void configChanged();
protected Q_SLOTS:
void safeInit();
void engineError(const QString &source, const QString &error);
void setBusy(bool value);
void updateSources();
void createConfigurationInterface(KConfigDialog *parent);
void configAccepted();
void moveViewRight();
void moveViewLeft();
void moveViewRightClicked();
void moveViewLeftClicked();
void switchViews(int delta);
void timeLineFinished();
private:
void createViews();
void updateViews();
void saveConfig();
void createTimers();
void createViewProviders();
KdeObservatoryConfigGeneral *m_configGeneral;
KdeObservatoryConfigProjects *m_configProjects;
KdeObservatoryConfigViews *m_configViews;
// Config - General
int m_activityRangeType;
int m_commitExtent;
QString m_commitFrom;
QString m_commitTo;
bool m_cacheContents;
bool m_enableAutoViewChange;
int m_viewsDelay;
int m_lastViewCount;
QList< QPair<QString, bool> > m_activeViews;
// Config - Projects
QMap<QString, Project> m_projects;
// Config - Top Active Projects
QHash<QString, bool> m_topActiveProjectsViewProjects;
// Config - Top Developers
QHash<QString, bool> m_topDevelopersViewProjects;
// Config - Commit History
QHash<QString, bool> m_commitHistoryViewProjects;
// Config - Krazy
QHash<QString, bool> m_krazyReportViewProjects;
// Main Layout
QGraphicsWidget *m_mainContainer;
QGraphicsLinearLayout *m_horizontalLayout;
QGraphicsWidget *m_viewContainer;
Plasma::Meter *m_collectorProgress;
Plasma::Label *m_updateLabel;
Plasma::PushButton *m_right;
Plasma::PushButton *m_left;
// View providers and data
QMap<QString, IViewProvider *> m_viewProviders;
QList<QGraphicsWidget *> m_views;
int m_currentView;
QTimer *m_viewTransitionTimer;
QPointer<QTimeLine> m_transitionTimer;
QGraphicsItemAnimation *m_animationPrevious;
QGraphicsItemAnimation *m_animationNew;
Plasma::DataEngine *m_engine;
Plasma::Service *m_service;
int m_sourceCounter;
};
typedef QMultiMap<int, QString> RankValueMap;
typedef QMapIterator<int, QString> RankValueMapIterator;
Q_DECLARE_METATYPE(RankValueMap)
typedef QList< QPair<QString, int> > DateCommitList;
Q_DECLARE_METATYPE(DateCommitList)
// FileType TestName FileName Errors
typedef QMap< QString, QMap<QString, QMap<QString, QStringList> > > KrazyReportMap;
typedef QMapIterator< QString, QMap<QString, QMap<QString, QStringList > > > KrazyReportMapIterator;
Q_DECLARE_METATYPE(KrazyReportMap)
typedef QMap<QString, QStringList> FileTypeKrazyReportMap;
#endif

View file

@ -1,37 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "kdeobservatoryconfiggeneral.h"
KdeObservatoryConfigGeneral::KdeObservatoryConfigGeneral(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
setupUi(this);
}
KdeObservatoryConfigGeneral::~KdeObservatoryConfigGeneral()
{
}
void KdeObservatoryConfigGeneral::on_activitiesInRange_toggled(bool value)
{
fromDate->setEnabled(value);
toDate->setEnabled(value);
}

View file

@ -1,38 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef KDEOBSERVATORYCONFIGGENERAL_HEADER
#define KDEOBSERVATORYCONFIGGENERAL_HEADER
#include <QWidget>
#include "ui_kdeobservatoryconfiggeneral.h"
class KdeObservatoryConfigGeneral : public QWidget, public Ui::KdeObservatoryConfigGeneral
{
Q_OBJECT
public:
explicit KdeObservatoryConfigGeneral(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~KdeObservatoryConfigGeneral();
protected Q_SLOTS:
void on_activitiesInRange_toggled(bool value);
};
#endif

View file

@ -1,122 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "kdeobservatoryconfigprojects.h"
#include <QtGui/qstandarditemmodel.h>
#include <KDialog>
#include <KMessageBox>
#include "ui_kdeobservatoryconfigproject.h"
KdeObservatoryConfigProjects::KdeObservatoryConfigProjects(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
setupUi(this);
psbAddProject->setIcon(KIcon("list-add"));
psbRemoveProject->setIcon(KIcon("list-remove"));
psbEditProject->setIcon(KIcon("document-edit"));
}
KdeObservatoryConfigProjects::~KdeObservatoryConfigProjects()
{
}
void KdeObservatoryConfigProjects::createTableWidgetItem(const QString &projectName, const QString &commitSubject, const QString &krazyReport, const QString &krazyFilePrefix, const QString &icon)
{
QTableWidgetItem *itemProject = new QTableWidgetItem(KIcon(icon), projectName);
itemProject->setData(Qt::UserRole, icon);
QTableWidgetItem *itemCommitSubject = new QTableWidgetItem(commitSubject);
QTableWidgetItem *itemKrazyReport = new QTableWidgetItem(krazyReport);
QTableWidgetItem *itemKrazyFilePrefix = new QTableWidgetItem(krazyFilePrefix);
int rowCount = projects->rowCount();
projects->setRowCount(rowCount+1);
projects->setItem(rowCount, 0, itemProject);
projects->setItem(rowCount, 1, itemCommitSubject);
projects->setItem(rowCount, 2, itemKrazyReport);
projects->setItem(rowCount, 3, itemKrazyFilePrefix);
projects->setRowHeight(rowCount, projects->rowHeight(rowCount)*0.75);
projects->setCurrentItem(itemProject);
}
void KdeObservatoryConfigProjects::on_psbAddProject_clicked()
{
QPointer<KDialog> configProject = new KDialog(this);
configProject->setButtons(KDialog::None);
Ui::KdeObservatoryConfigProject *ui_configProject = new Ui::KdeObservatoryConfigProject;
ui_configProject->setupUi(configProject);
if (configProject->exec() == KDialog::Accepted)
{
createTableWidgetItem(ui_configProject->projectName->text(), ui_configProject->commitSubject->text(), ui_configProject->krazyReport->text(), ui_configProject->krazyFilePrefix->text(), ui_configProject->icon->icon());
projects->resizeColumnsToContents();
projects->horizontalHeader()->setStretchLastSection(true);
emit projectAdded(ui_configProject->projectName->text(), ui_configProject->icon->icon());
}
delete ui_configProject;
delete configProject;
}
void KdeObservatoryConfigProjects::on_psbRemoveProject_clicked()
{
QTableWidgetItem *currentItem;
if ((currentItem = projects->currentItem()))
if (KMessageBox::questionYesNo(this, i18n("Are you sure you want to remove project '%1'?", projects->item(currentItem->row(), 0)->text() ), i18n("Remove project")) == KMessageBox::Yes)
{
QString projectName = currentItem->text();
projects->removeRow(currentItem->row());
emit projectRemoved(projectName);
}
}
void KdeObservatoryConfigProjects::on_psbEditProject_clicked()
{
QTableWidgetItem *currentItem;
if ((currentItem = projects->currentItem()))
{
QPointer<KDialog> configProjects = new KDialog(this);
configProjects->setButtons(KDialog::None);
Ui::KdeObservatoryConfigProject *ui_configProjects = new Ui::KdeObservatoryConfigProject;
ui_configProjects->setupUi(configProjects);
int currentRow = projects->currentRow();
ui_configProjects->projectName->setText(projects->item(currentRow, 0)->text());
ui_configProjects->commitSubject->setText(projects->item(currentRow, 1)->text());
ui_configProjects->krazyReport->setText(projects->item(currentRow, 2)->text());
ui_configProjects->krazyFilePrefix->setText(projects->item(currentRow, 3)->text());
ui_configProjects->icon->setIcon(projects->item(currentRow, 0)->data(Qt::UserRole).toString());
if (configProjects->exec() == KDialog::Accepted)
{
projects->item(currentRow, 0)->setText(ui_configProjects->projectName->text());
projects->item(currentRow, 0)->setIcon(KIcon(ui_configProjects->icon->icon()));
projects->item(currentRow, 0)->setData(Qt::UserRole, ui_configProjects->icon->icon());
projects->item(currentRow, 1)->setText(ui_configProjects->commitSubject->text());
projects->item(currentRow, 2)->setText(ui_configProjects->krazyReport->text());
projects->item(currentRow, 3)->setText(ui_configProjects->krazyFilePrefix->text());
emit projectEdited(projects->item(currentRow, 0)->text());
}
delete ui_configProjects;
delete configProjects;
}
}

View file

@ -1,49 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef KDEOBSERVATORYCONFIGPROJECTS_HEADER
#define KDEOBSERVATORYCONFIGPROJECTS_HEADER
#include <QWidget>
#include "ui_kdeobservatoryconfigprojects.h"
class KdeObservatoryConfigProjects : public QWidget, public Ui::KdeObservatoryConfigProjects
{
Q_OBJECT
public:
explicit KdeObservatoryConfigProjects(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~KdeObservatoryConfigProjects();
void createTableWidgetItem(const QString &projectName, const QString &commitSubject, const QString &krazyReport, const QString &krazyFilePrefix, const QString &icon);
Q_SIGNALS:
void projectAdded(const QString &projectName, const QString &icon);
void projectRemoved(const QString &projectName);
// I've added the QString argument for feature possible use, don't know if it's really needed!
void projectEdited(const QString &projectName);
public Q_SLOTS:
void on_psbAddProject_clicked();
void on_psbRemoveProject_clicked();
void on_psbEditProject_clicked();
};
#endif

View file

@ -1,125 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "kdeobservatoryconfigviews.h"
KdeObservatoryConfigViews::KdeObservatoryConfigViews(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
setupUi(this);
psbCheckAll->setIcon(KIcon("button_more"));
psbUncheckAll->setIcon(KIcon("button_fewer"));
m_lastView = views->currentText();
}
KdeObservatoryConfigViews::~KdeObservatoryConfigViews()
{
}
void KdeObservatoryConfigViews::projectAdded(const QString &projectName, const QString &icon)
{
KdeObservatory::Project project;
project.icon = icon;
m_projects[projectName] = project;
QMapIterator<QString, ViewProjects> i(m_projectsInView);
while (i.hasNext())
{
i.next();
QString view = i.key();
m_projectsInView[view][projectName] = true;
}
on_views_currentIndexChanged(m_lastView);
}
void KdeObservatoryConfigViews::projectRemoved(const QString &projectName)
{
m_projects.remove(projectName);
QMapIterator<QString, ViewProjects> i(m_projectsInView);
while (i.hasNext())
{
i.next();
QString view = i.key();
m_projectsInView[view].remove(projectName);
}
updateView(m_lastView);
}
void KdeObservatoryConfigViews::on_views_currentIndexChanged(QString view)
{
int counter = projectsInView->count();
for (int i = 0; i < counter; ++i)
{
QListWidgetItem *item = projectsInView->item(i);
m_projectsInView[m_lastView][item->text()] = item->checkState() == Qt::Checked ? true:false;
}
updateView(view);
}
void KdeObservatoryConfigViews::updateView(const QString &view)
{
projectsInView->clear();
QHashIterator<QString, bool> i(m_projectsInView[view]);
while (i.hasNext())
{
i.next();
QString project = i.key();
QListWidgetItem *item = new QListWidgetItem(project, projectsInView);
item->setCheckState(i.value() ? Qt::Checked:Qt::Unchecked);
item->setIcon(KIcon(m_projects[project].icon));
}
m_lastView = view;
}
void KdeObservatoryConfigViews::on_tlbUp_clicked()
{
swapViewItems(-1);
}
void KdeObservatoryConfigViews::on_tlbDown_clicked()
{
swapViewItems(1);
}
void KdeObservatoryConfigViews::on_psbCheckAll_clicked()
{
int counter = projectsInView->count();
for (int i = 0; i < counter; ++i)
projectsInView->item(i)->setCheckState(Qt::Checked);
}
void KdeObservatoryConfigViews::on_psbUncheckAll_clicked()
{
int counter = projectsInView->count();
for (int i = 0; i < counter; ++i)
projectsInView->item(i)->setCheckState(Qt::Unchecked);
}
void KdeObservatoryConfigViews::swapViewItems(int updown)
{
int linenumber = activeViews->currentRow();
if (linenumber + updown < activeViews->count())
{
QListWidgetItem *item = activeViews->currentItem();
activeViews->takeItem(linenumber);
activeViews->insertItem(linenumber + updown, item);
activeViews->setCurrentItem(item);
}
}

View file

@ -1,56 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef KDEOBSERVATORYCONFIGVIEWS_HEADER
#define KDEOBSERVATORYCONFIGVIEWS_HEADER
#include <QWidget>
#include "ui_kdeobservatoryconfigviews.h"
#include "kdeobservatory.h"
class KdeObservatoryConfigViews : public QWidget, public Ui::KdeObservatoryConfigViews
{
Q_OBJECT
public:
explicit KdeObservatoryConfigViews(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~KdeObservatoryConfigViews();
typedef QHash<QString, bool> ViewProjects;
QMap<QString, KdeObservatory::Project> m_projects;
QMap<QString, ViewProjects> m_projectsInView;
public Q_SLOTS:
void projectAdded(const QString &projectName, const QString &icon);
void projectRemoved(const QString &projectName);
void on_views_currentIndexChanged(QString view);
void updateView(const QString &view);
void on_tlbUp_clicked();
void on_tlbDown_clicked();
void on_psbCheckAll_clicked();
void on_psbUncheckAll_clicked();
private:
void swapViewItems(int updown);
QString m_lastView;
};
#endif

View file

@ -1,139 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "krazyreportview.h"
#include <QPen>
#include <QtGui/qbrush.h>
#include <KIcon>
#include <KColorUtils>
#include <KGlobalSettings>
KrazyReportView::KrazyReportView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &krazyReportViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags)
: IViewProvider(kdeObservatory, parent, wFlags),
m_krazyReportViewProjects(krazyReportViewProjects),
m_projects(projects)
{
}
KrazyReportView::~KrazyReportView()
{
}
void KrazyReportView::createViews()
{
deleteViews();
// We don't know in advance how many Krazy report views will be created
// so view creation is postponed to the updateViews function.
}
void KrazyReportView::updateViews(const Plasma::DataEngine::Data &data)
{
QString project = data["project"].toString();
KrazyReportMap krazyReportMap = data[project].value<KrazyReportMap>();
const QList<QString> &keys = krazyReportMap.keys();
foreach (const QString &fileType, keys)
createView(i18nc("Krazy report for a given project %1", "Krazy Report - %1", project), QString("Krazy Report") + " - " + project + " - " + fileType);
KrazyReportMapIterator i1(krazyReportMap);
// For each file type
while (i1.hasNext())
{
i1.next();
QString fileType = i1.key();
const QMap< QString, FileTypeKrazyReportMap > &projectFileTypeKrazyReport = i1.value();
QGraphicsWidget *container = containerForView(QString("Krazy Report") + " - " + project + " - " + fileType);
if (!container)
return;
QGraphicsTextItem *fileTypeText = new QGraphicsTextItem(fileType, container);
fileTypeText->setDefaultTextColor(QColor(0, 0, 0));
fileTypeText->setFont(KGlobalSettings::smallestReadableFont());
fileTypeText->setPos((qreal) ((container->rect().width())/2)-(fileTypeText->boundingRect().width()/2), (qreal) 0);
int maxRank = 0;
qreal height = container->geometry().height() - fileTypeText->boundingRect().height();
qreal step = qMin(container->geometry().width() / projectFileTypeKrazyReport.size(), (qreal) 22);
QMultiMap<int, QString> orderedTestMap;
QMapIterator< QString, FileTypeKrazyReportMap > i2(projectFileTypeKrazyReport);
int errors;
while (i2.hasNext())
{
i2.next();
errors = 0;
foreach (const QStringList &list, i2.value())
errors += list.count();
orderedTestMap.insert(errors, i2.key());
}
int j = 0;
QMapIterator<int, QString> i3(orderedTestMap);
i3.toBack();
// For each krazy test
while (i3.hasPrevious())
{
i3.previous();
QString testName = i3.value();
int rank = i3.key();
if (j == 0)
maxRank = rank;
qreal heightFactor = height/maxRank;
qreal xItem = (j*step)+2;
QGraphicsRectItem *testNameRect = new QGraphicsRectItem(0, 0, (qreal) step-4, (qreal) heightFactor*rank, container);
testNameRect->setPos(xItem, container->geometry().height() - testNameRect->rect().height());
testNameRect->setPen(QPen(QColor(0, 0, 0)));
QColor color = QColor::fromHsv(qrand() % 256, 255, 190);
QLinearGradient grad (0.0, 0.0, 0.0, (qreal) heightFactor*rank);
grad.setColorAt(0, KColorUtils::darken(color, 0.8));
grad.setColorAt(1, color);
testNameRect->setBrush(QBrush(grad));
QString toolTipContents = i18np("%2 %1 error", "%2 %1 errors", rank, testName);
QString toolTip = "<html><body><h5>" + toolTipContents + "<ul>";
const FileTypeKrazyReportMap &fileErrors = projectFileTypeKrazyReport[testName];
QMapIterator<QString, QStringList > i4(fileErrors);
while (i4.hasNext())
{
i4.next();
foreach (const QString &error, i4.value())
toolTip += "<li>" + i4.key() + ": " + error + "</li>";
}
toolTip += "</ul></h5></body></html>";
testNameRect->setToolTip(toolTip);
testNameRect->setAcceptHoverEvents(true);
testNameRect->installSceneEventFilter(m_kdeObservatory);
j++;
}
}
}

View file

@ -1,42 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef KRAZYREPORTVIEW_HEADER
#define KRAZYREPORTVIEW_HEADER
#include "iviewprovider.h"
#include "kdeobservatory.h"
class KrazyReportView : public IViewProvider
{
public:
KrazyReportView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &krazyReportViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~KrazyReportView();
virtual void createViews();
virtual void updateViews(const Plasma::DataEngine::Data &data);
private:
const QHash<QString, bool> &m_krazyReportViewProjects;
const QMap<QString, KdeObservatory::Project> &m_projects;
};
#endif

View file

@ -1,103 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "topactiveprojectsview.h"
#include <QPen>
#include <QFontMetrics>
#include <QtGui/qbrush.h>
#include <KIcon>
#include <KColorUtils>
#include <KGlobalSettings>
TopActiveProjectsView::TopActiveProjectsView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &topActiveProjectsViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags)
: IViewProvider(kdeObservatory, parent, wFlags),
m_parent(parent),
m_topActiveProjectsViewProjects(topActiveProjectsViewProjects),
m_projects(projects)
{
}
TopActiveProjectsView::~TopActiveProjectsView()
{
}
void TopActiveProjectsView::createViews()
{
deleteViews();
createView(i18n("Top Active Projects"), "Top Active Projects");
}
void TopActiveProjectsView::updateViews(const Plasma::DataEngine::Data &data)
{
QMultiMap<int, QString> topActiveProjects = data["topActiveProjects"].value< QMultiMap<int, QString> >();
QGraphicsWidget *container = containerForView("Top Active Projects");
if (!container)
return;
int maxRank = 0;
qreal width = container->geometry().width();
qreal step = 22;
QMapIterator<int, QString> i(topActiveProjects);
i.toBack();
int j = 0;
while (i.hasPrevious())
{
i.previous();
QString project = i.value();
if (m_topActiveProjectsViewProjects[project])
{
int rank = i.key();
if (j == 0)
maxRank = rank;
qreal widthFactor = (width-24)/maxRank;
qreal yItem = (j*step)+2;
if (yItem + step-4 > container->geometry().height())
break;
QGraphicsRectItem *projectRect = new QGraphicsRectItem(0, 0, (qreal) widthFactor*rank, (qreal) step-4, container);
projectRect->setPos(0, yItem);
projectRect->setPen(QPen(QColor(0, 0, 0)));
QColor color = QColor::fromHsv(qrand() % 256, 255, 190);
QLinearGradient grad (0.0, 0.0, (qreal) widthFactor*rank, 0.0);
grad.setColorAt(0, KColorUtils::darken(color, 0.8));
grad.setColorAt(1, color);
projectRect->setBrush(QBrush(grad));
projectRect->setToolTip(i18np("%2 - %1 commit", "%2 - %1 commits", rank, project));
projectRect->setAcceptHoverEvents(true);
projectRect->installSceneEventFilter(m_kdeObservatory);
QGraphicsPixmapItem *icon = new QGraphicsPixmapItem(KIcon(m_projects[project].icon).pixmap(22, 22), container);
icon->setPos((qreal) widthFactor*rank+2, (qreal) yItem+((step-4)/2)-11);
QGraphicsTextItem *commitsNumber = new QGraphicsTextItem(QString::number(rank), projectRect);
commitsNumber->setDefaultTextColor(QColor(255, 255, 255));
commitsNumber->setFont(KGlobalSettings::smallestReadableFont());
commitsNumber->setPos((qreal) ((projectRect->rect().width())/2)-(commitsNumber->boundingRect().width()/2),
(qreal) ((projectRect->rect().height())/2)-(commitsNumber->boundingRect().height()/2));
j++;
}
}
}

View file

@ -1,43 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef TOPACTIVEPROJECTSVIEW_HEADER
#define TOPACTIVEPROJECTSVIEW_HEADER
#include "iviewprovider.h"
#include "kdeobservatory.h"
class TopActiveProjectsView : public IViewProvider
{
public:
TopActiveProjectsView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &topActiveProjectsViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~TopActiveProjectsView();
virtual void createViews();
virtual void updateViews(const Plasma::DataEngine::Data &data);
private:
QGraphicsWidget *m_parent;
const QHash<QString, bool> &m_topActiveProjectsViewProjects;
const QMap<QString, KdeObservatory::Project> &m_projects;
};
#endif

View file

@ -1,102 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#include "topdevelopersview.h"
#include <QPen>
#include <QtGui/qbrush.h>
#include <KIcon>
#include <KColorUtils>
#include <KGlobalSettings>
TopDevelopersView::TopDevelopersView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &topDevelopersViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent, Qt::WindowFlags wFlags)
: IViewProvider(kdeObservatory, parent, wFlags),
m_topDevelopersViewProjects(topDevelopersViewProjects),
m_projects(projects)
{
}
TopDevelopersView::~TopDevelopersView()
{
}
void TopDevelopersView::createViews()
{
deleteViews();
QHashIterator<QString, bool> i(m_topDevelopersViewProjects);
while (i.hasNext())
{
i.next();
if (i.value())
createView(i18n("Top Developers - %1", i.key()), QString("Top Developers") + " - " + i.key());
}
}
void TopDevelopersView::updateViews(const Plasma::DataEngine::Data &data)
{
QString project = data["project"].toString();
RankValueMap topProjectDevelopers = data[project].value<RankValueMap>();
QGraphicsWidget *container = containerForView(QString("Top Developers") + " - " + project);
if (!container)
return;
int maxRank = 0;
qreal width = container->geometry().width();
qreal step = 22;
RankValueMapIterator i(topProjectDevelopers);
i.toBack();
int j = 0;
while (i.hasPrevious())
{
i.previous();
QString developer = i.value();
int rank = i.key();
if (j == 0)
maxRank = rank;
qreal widthFactor = (width-24)/maxRank;
qreal yItem = (j*step)+2;
if (yItem + step-4 > container->geometry().height())
break;
QGraphicsRectItem *developerRect = new QGraphicsRectItem(0, 0, (qreal) widthFactor*rank, (qreal) step-4, container);
developerRect->setPos(0, yItem);
developerRect->setPen(QPen(QColor(0, 0, 0)));
QColor color = QColor::fromHsv(qrand() % 256, 255, 190);
QLinearGradient grad (0.0, 0.0, (qreal) widthFactor*rank, 0.0);
grad.setColorAt(0, KColorUtils::darken(color, 0.8));
grad.setColorAt(1, color);
developerRect->setBrush(QBrush(grad));
developerRect->setToolTip(i18np("%2 - %1 commit", "%2 - %1 commits", rank, developer));
developerRect->setAcceptHoverEvents(true);
developerRect->installSceneEventFilter(m_kdeObservatory);
QGraphicsTextItem *commitsNumber = new QGraphicsTextItem(developer.split(' ')[0], developerRect);
commitsNumber->setDefaultTextColor(QColor(255, 255, 255));
commitsNumber->setFont(KGlobalSettings::smallestReadableFont());
commitsNumber->setPos((qreal) 0, (qreal) ((developerRect->rect().height())/2)-(commitsNumber->boundingRect().height()/2));
j++;
}
}

View file

@ -1,42 +0,0 @@
/*************************************************************************
* Copyright 2009-2010 Sandro Andrade sandroandrade@kde.org *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* ***********************************************************************/
#ifndef TOPDEVELOPERSVIEW_HEADER
#define TOPDEVELOPERSVIEW_HEADER
#include "iviewprovider.h"
#include "kdeobservatory.h"
class TopDevelopersView : public IViewProvider
{
public:
TopDevelopersView(KdeObservatory *kdeObservatory, const QHash<QString, bool> &topDevelopersViewProjects, const QMap<QString, KdeObservatory::Project> &projects, QGraphicsWidget *parent = 0, Qt::WindowFlags wFlags = 0);
virtual ~TopDevelopersView();
virtual void createViews();
virtual void updateViews(const Plasma::DataEngine::Data &data);
private:
const QHash<QString, bool> &m_topDevelopersViewProjects;
const QMap<QString, KdeObservatory::Project> &m_projects;
};
#endif

View file

@ -1,329 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KdeObservatoryConfigGeneral</class>
<widget class="QWidget" name="KdeObservatoryConfigGeneral">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<height>362</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="activitiesRange">
<property name="title">
<string>Activity Range</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout1">
<item>
<widget class="QRadioButton" name="activitiesFullHistory">
<property name="text">
<string>&amp;Full history</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout1">
<item>
<widget class="QRadioButton" name="activitiesInPastDays">
<property name="text">
<string>&amp;Past</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="commitExtent">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>46</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>46</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="value">
<number>7</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDays">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string comment="noun, the 24-hour period">days</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>106</width>
<height>44</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout2">
<item>
<widget class="QRadioButton" name="activitiesInRange">
<property name="text">
<string comment="The beginning of a range" extracomment="The beginning of a range">Fro&amp;m</string>
</property>
</widget>
</item>
<item>
<widget class="KDatePicker" name="fromDate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>222</width>
<height>182</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbTo">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string comment="The end of a range" extracomment="The end of a range">to</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="KDatePicker" name="toDate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>222</width>
<height>182</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="spacer4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>233</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="enableAutoViewChange">
<property name="text">
<string>&amp;Enable automatic view change</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout3">
<item>
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>27</width>
<height>44</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lblViewsDelay">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Change view every:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="viewsDelay">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="displayFormat">
<string>hh 'Hours' mm 'Mins' ss 'Secs'</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>133</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="spacer5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>112</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KDatePicker</class>
<extends>QFrame</extends>
<header>kdatepicker.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>activitiesInPastDays</tabstop>
<tabstop>commitExtent</tabstop>
<tabstop>activitiesInRange</tabstop>
<tabstop>enableAutoViewChange</tabstop>
<tabstop>viewsDelay</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>enableAutoViewChange</sender>
<signal>toggled(bool)</signal>
<receiver>viewsDelay</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>162</x>
<y>306</y>
</hint>
<hint type="destinationlabel">
<x>293</x>
<y>341</y>
</hint>
</hints>
</connection>
<connection>
<sender>activitiesInPastDays</sender>
<signal>toggled(bool)</signal>
<receiver>commitExtent</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>44</x>
<y>92</y>
</hint>
<hint type="destinationlabel">
<x>111</x>
<y>94</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,223 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KdeObservatoryConfigProject</class>
<widget class="QDialog" name="KdeObservatoryConfigProject">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>235</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>411</width>
<height>235</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>411</width>
<height>235</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblName">
<property name="text">
<string>Project name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KLineEdit" name="projectName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblCommitSubject">
<property name="text">
<string>Commit subject:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="commitSubject">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Prefix used for this project in kde-commits mailing list.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Ex:&lt;/span&gt; KDE/kdebase/runtime/plasma/&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblIcon">
<property name="text">
<string>Icon:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KIconButton" name="icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblKrazyReport">
<property name="text">
<string>Krazy report:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="krazyReport">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Krazy report web address for this project.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Format:&lt;/span&gt; http://www.englishbreakfastnetwork.org/krazy/&lt;span style=&quot; font-style:italic;&quot;&gt;&amp;lt;krazy-report&amp;gt;&lt;/span&gt; &lt;span style=&quot; font-weight:600;&quot;&gt;or &lt;/span&gt;http://www.englishbreakfastnetwork.org/krazy/index.php?&lt;span style=&quot; font-style:italic;&quot;&gt;&amp;lt;krazy-component-module&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Ex:&lt;/span&gt; http://www.englishbreakfastnetwork.org/krazy/&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;reports/kde-4.x/kdebase-runtime/plasma&lt;/span&gt;/&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;index.html&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;or&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;http://www.englishbreakfastnetwork.org/krazy/index.php?&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;component=kde-4.x&amp;amp;module=kdevelop&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblKrazyFilePrefix">
<property name="text">
<string>Krazy file identifier:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KLineEdit" name="krazyFilePrefix">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Sub-string that must appear in files belonging to this project. Leave it blank if all files in Krazy report belong to this project or a component-module address was given.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Ex: for a plasmoid in playground, &lt;span style=&quot; text-decoration: underline;&quot;&gt;Krazy report&lt;/span&gt; would be &quot;playground/base/plasma&quot; and &lt;span style=&quot; text-decoration: underline;&quot;&gt;Krazy file identifier&lt;/span&gt; would be &quot;&amp;lt;plasmoid-directory&amp;gt;&quot;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIconButton</class>
<extends>QPushButton</extends>
<header>kicondialog.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>projectName</tabstop>
<tabstop>commitSubject</tabstop>
<tabstop>krazyReport</tabstop>
<tabstop>krazyFilePrefix</tabstop>
<tabstop>icon</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>KdeObservatoryConfigProject</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>128</y>
</hint>
<hint type="destinationlabel">
<x>409</x>
<y>44</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>KdeObservatoryConfigProject</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>195</x>
<y>128</y>
</hint>
<hint type="destinationlabel">
<x>405</x>
<y>80</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KdeObservatoryConfigProjects</class>
<widget class="QWidget" name="KdeObservatoryConfigProjects">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>543</width>
<height>248</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>47</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTableWidget" name="projects">
<property name="minimumSize">
<size>
<width>406</width>
<height>0</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Project</string>
</property>
</column>
<column>
<property name="text">
<string>Commit Subject</string>
</property>
</column>
<column>
<property name="text">
<string>Krazy Report</string>
</property>
</column>
<column>
<property name="text">
<string>Krazy File Identifier</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KPushButton" name="psbAddProject">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>85</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>85</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="psbRemoveProject">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>85</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>85</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="psbEditProject">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>85</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>85</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Edit</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,344 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KdeObservatoryConfigViews</class>
<widget class="QWidget" name="KdeObservatoryConfigViews">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>393</width>
<height>364</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="lblActiveViews">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Active views:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="spacer4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>47</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout1">
<item>
<widget class="QListWidget" name="activeViews">
<property name="minimumSize">
<size>
<width>0</width>
<height>123</height>
</size>
</property>
<item>
<property name="text">
<string>Top Active Projects</string>
</property>
<property name="checkState">
<enum>Checked</enum>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Commit History</string>
</property>
<property name="checkState">
<enum>Checked</enum>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Top Developers</string>
</property>
<property name="checkState">
<enum>Checked</enum>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Krazy Report</string>
</property>
<property name="checkState">
<enum>Checked</enum>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png</iconset>
</property>
</item>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="tlbUp">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/go-up.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/go-up.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tlbDown">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/go-down.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/go-down.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="spacer5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="1" rowspan="2">
<widget class="QGroupBox" name="gpbViewConfiguration">
<property name="title">
<string>View Configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblView">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>View:</string>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="views">
<item>
<property name="text">
<string>Top Active Projects</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/svn-commit.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Top Developers</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/user-properties.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Commit History</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/view-history.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Krazy Report</string>
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png</normaloff>../../../../../usr/share/icons/oxygen/16x16/actions/checkbox.png</iconset>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblProjectsInView">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Projects in view:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QListWidget" name="projectsInView">
<property name="minimumSize">
<size>
<width>0</width>
<height>85</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="KPushButton" name="psbCheckAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>105</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Check All</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="psbUncheckAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>105</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&amp;Uncheck All</string>
</property>
</widget>
</item>
<item>
<spacer name="spacer3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>47</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,6 +0,0 @@
project(konqprofiles)
install(DIRECTORY package/
DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/konqprofiles)
install(FILES package/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-applet-konqprofiles.desktop)

View file

@ -1,4 +0,0 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.qml` -L Java -o $podir/konqprofiles.pot
rm -f rc.cpp

View file

@ -1,164 +0,0 @@
/*****************************************************************************
* Copyright (C) 2011, 2012 by Shaun Reich <shaun.reich@kdemail.net> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
import QtQuick 1.1
import org.kde.qtextracomponents 0.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
Item {
id: konqProfiles
property int minimumWidth: 200
property int minimumHeight: 300
function popupEventSlot(shown) {
if(shown)
view.forceActiveFocus();
}
PlasmaCore.DataSource {
id: profilesSource
engine: "org.kde.konqprofiles"
onSourceAdded: connectSource(source)
onSourceRemoved: disconnectSource(source)
Component.onCompleted: connectedSources = sources
}
PlasmaCore.DataModel {
id: profilesModel
dataSource: profilesSource
}
Component.onCompleted: {
plasmoid.popupIcon = "konqueror";
plasmoid.aspectRatioMode = IgnoreAspectRatio;
plasmoid.popupEvent.connect('popupEvent', popupEventSlot);
}
PlasmaCore.Svg {
id: lineSvg
imagePath: "widgets/line"
}
Row {
id: headerRow
anchors { left: parent.left; right: parent.right}
QIconItem {
icon: QIcon("konqueror")
width: 32
height: 32
}
PlasmaComponents.Label {
id: header
text: i18n("Konqueror Profiles")
anchors { horizontalCenter: parent.horizontalCenter }
horizontalAlignment: Text.AlignHCenter
}
}
PlasmaCore.SvgItem {
id: separator
anchors { left: headerRow.left; right: headerRow.right; top: headerRow.bottom }
svg: lineSvg
elementId: "horizontal-line"
height: lineSvg.elementSize("horizontal-line").height
}
Text {
id: textMetric
visible: false
// translated but not used, we just need length/height
text: i18n("Arbitrary String Which Says The Dictionary Type")
}
ListView {
id: view
anchors { left: parent.left; right: scrollBar.left; bottom: parent.bottom; top: separator.bottom; topMargin: 5}
model: profilesModel
clip: true
focus: true
delegate: Item {
id: listdelegate
height: textMetric.paintedHeight * 2
anchors { left: parent.left; leftMargin: 10; right: parent.right; }
function openProfile() {
var service = profilesSource.serviceForSource(model["DataEngineSource"])
var operation = service.operationDescription("open")
var job = service.startOperationCall(operation)
}
PlasmaComponents.Label {
id: profileText
anchors.fill: parent
text: model.prettyName
}
MouseArea {
height: parent.height + 15
anchors { left: parent.left; right: parent.right;}
hoverEnabled: true
onClicked: {
openProfile();
}
onEntered: {
view.currentIndex = index
view.highlightItem.opacity = 1
}
onExited: {
view.highlightItem.opacity = 0
}
}
Keys.onPressed: {
if (event.key == Qt.Key_Enter || event.key == Qt.Key_Return)
openProfile();
}
}
highlight: PlasmaComponents.Highlight {
hover: true
}
highlightMoveDuration: 250
highlightMoveSpeed: 1
}
PlasmaComponents.ScrollBar {
id: scrollBar
anchors { bottom: parent.bottom; top: separator.top; right: parent.right }
orientation: Qt.Vertical
stepSize: view.count / 4
scrollButtonInterval: view.count / 4
flickableItem: view
}
}

View file

@ -1,133 +0,0 @@
[Desktop Entry]
Name=Konqueror Profiles
Name[ar]=تشكيلة كنيكر
Name[ast]=Perfiles de Konqueror
Name[bs]=Konqueror profili
Name[ca]=Perfils del Konqueror
Name[ca@valencia]=Perfils del Konqueror
Name[cs]=Profily Konqueroru
Name[da]=Konqueror-profiler
Name[de]=Konqueror-Profile
Name[el]=Προφίλ Konqueror
Name[en_GB]=Konqueror Profiles
Name[es]=Perfiles de Konqueror
Name[et]=Konquerori profiilid
Name[eu]=Konquerorren profilak
Name[fi]=Konqueror-profiilit
Name[fr]=Profils de Konqueror
Name[ga]=Próifílí Konqueror
Name[gl]=Perfís de Konqueror
Name[he]=הפרופילים של Konqueror
Name[hr]=Profili u Konqueroru
Name[hu]=Konqueror profilok
Name[is]=Konqueror snið
Name[it]=Profili di Konqueror
Name[ja]=Konqueror
Name[kk]=Konqueror профильдері
Name[km]= Konqueror
Name[ko]=Konqueror
Name[ku]=Profîlên Komqueror
Name[lt]=Konqueror profiliai
Name[lv]=Konqueror profili
Name[mr]=
Name[nb]=Konqueror-profiler
Name[nds]=Konqueror-Profilen
Name[nl]=Konqueror-profielen
Name[nn]=Konqueror-profilar
Name[pa]=ਿ
Name[pl]=Profile Konquerora
Name[pt]=Perfis do Konqueror
Name[pt_BR]=Perfis do Konqueror
Name[ro]=Profiluri Konqueror
Name[ru]=Konqueror: профили
Name[sk]=Profily Konquerora
Name[sl]=Profili za Konqueror
Name[sr]=Косвајачеви профили
Name[sr@ijekavian]=Косвајачеви профили
Name[sr@ijekavianlatin]=Kosvajačevi profili
Name[sr@latin]=Kosvajačevi profili
Name[sv]=Konquerorprofiler
Name[th]=
Name[tr]=Konqueror Profilleri
Name[uk]=Профілі Konqueror
Name[wa]=Profils di Konqueror
Name[x-test]=xxKonqueror Profilesxx
Name[zh_CN]=Konqueror
Name[zh_TW]=Konqueror
Comment=List and launch Konqueror profiles
Comment[ar]=تعرض و تطلق تشكيلات كنكير
Comment[ast]=Amuesa y anicia perfiles de Konqueror
Comment[bs]=Nabraja i pokreće profile Konquerora
Comment[ca]=Llista i executa els perfils del Konqueror
Comment[ca@valencia]=Llista i executa els perfils del Konqueror
Comment[cs]=Seznam a spouštění profilů Konqueroru
Comment[da]=Vis og start Konqueror-profiler.
Comment[de]=Konqueror-Profile anzeigen und starten
Comment[el]=Εμφάνιση και εκτέλεση προφίλ του Konqueror
Comment[en_GB]=List and launch Konqueror profiles
Comment[es]=Muestra e inicia perfiles de Konqueror
Comment[et]=Konquerori profiilide näitamine ja käivitamine
Comment[eu]=Zerrendatu eta jaurti Konquerorren profilak
Comment[fi]=Luettelee ja käynnistää Konqueror-profiileja
Comment[fr]=Permet d'afficher et de lancer des profils de Konqueror
Comment[ga]=Liostaigh agus tosaigh próifílí Konqueror
Comment[gl]=Enumera e inicia perfís de Konqueror
Comment[he]=הצג והפעל פרופילים של Konqueror
Comment[hr]=Navedi i pokreni profile u Konqueroru
Comment[hu]=Konqueror profilok listázása és indítása
Comment[is]=Listar upp og ræsir Konqueror snið
Comment[it]=Elenca ed esegue i profili di Konqueror
Comment[ja]=Konqueror
Comment[kk]=Konqueror профильдерін таңдап жегу
Comment[km]= Konqueror
Comment[ko]=Konqueror
Comment[ku]=Profîlên Konqueror lîste bike û bide destpêkirin
Comment[lt]=Rikiuoti ir įkelti Konqueror profilius
Comment[lv]=Parāda un atver Konqueror profilus
Comment[mr]=
Comment[nb]=List opp og start Konqueror-profiler
Comment[nds]=Konqueror-Profilen oplisten un opropen
Comment[nl]=Toon en start Konqueror-profielen
Comment[nn]=Vis og start Konqueror-profilar
Comment[pa]=ਿ
Comment[pl]=Wypisywanie i uruchamianie profili Konquerora
Comment[pt]=Listar e invocar os perfis do Konqueror
Comment[pt_BR]=Lista e carrega os perfis do Konqueror
Comment[ro]=Enumeră și lansează profiluri Konqueror
Comment[ru]=Запуск Konqueror для разных задач
Comment[sk]=Zobrazenie a spustenie profilov Konquerora
Comment[sl]=Prikažite in zaženite profile Konquerorja
Comment[sr]=Набраја и покреће профиле Косвајача
Comment[sr@ijekavian]=Набраја и покреће профиле Косвајача
Comment[sr@ijekavianlatin]=Nabraja i pokreće profile Kosvajača
Comment[sr@latin]=Nabraja i pokreće profile Kosvajača
Comment[sv]=Lista och starta Konquerorprofiler
Comment[th]=
Comment[tr]=Konqueror profillerini listeleyin ve çalıştırın
Comment[uk]=Перегляньте список і запустіть профілі Konqueror
Comment[wa]=Fé l' djivêye des profils di Konqueror eyet ls enonder
Comment[x-test]=xxList and launch Konqueror profilesxx
Comment[zh_CN]= Konqueror
Comment[zh_TW]= Konqueror
Icon=konqueror
Type=Service
X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet
X-Plasma-API=declarativeappletscript
X-Plasma-MainScript=ui/konqprofiles.qml
X-Plasma-DefaultSize=200,200
X-KDE-PluginInfo-Author=Shaun Reich
X-KDE-PluginInfo-Email=shaun.reich@kdemail.net
X-KDE-PluginInfo-Name=konqprofiles
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://userbase.kde.org/Plasma
X-KDE-PluginInfo-Category=Utilities
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
#X-Plasma-Requires-FileDialog=Unused
#X-Plasma-Requires-LaunchApp=Required
#X-Plasma-NotificationArea=true

View file

@ -1,19 +0,0 @@
project(plasma-microblog)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} )
set(microblog_SRCS
microblog.cpp
postwidget.cpp
configuration.ui
)
kde4_add_plugin(plasma_applet_microblog ${microblog_SRCS})
target_link_libraries(plasma_applet_microblog ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS plasma_applet_microblog DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-microblog.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES
microblog.svgz
DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/)

View file

@ -1,3 +0,0 @@
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/plasma_applet_microblog.pot

View file

@ -1,289 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TwitterConfig</class>
<widget class="QWidget" name="TwitterConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>504</width>
<height>292</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Login</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Password:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>passwordEdit</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="KLineEdit" name="passwordEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="passwordMode">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Appearance</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Timeline size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>historySizeSpinBox</cstring>
</property>
</widget>
</item>
<item row="8" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KIntSpinBox" name="historySizeSpinBox">
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="9" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Timeline refresh:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>historyRefreshSpinBox</cstring>
</property>
</widget>
</item>
<item row="9" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="KIntSpinBox" name="historyRefreshSpinBox">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="10" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Show friends:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>checkIncludeFriends</cstring>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QCheckBox" name="checkIncludeFriends">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Service</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Username:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>usernameEdit</cstring>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="KLineEdit" name="usernameEdit"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Service URL:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>serviceUrlCombo</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="KComboBox" name="serviceUrlCombo">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>serviceUrlCombo</tabstop>
<tabstop>usernameEdit</tabstop>
<tabstop>passwordEdit</tabstop>
<tabstop>historySizeSpinBox</tabstop>
<tabstop>historyRefreshSpinBox</tabstop>
<tabstop>checkIncludeFriends</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load diff

View file

@ -1,196 +0,0 @@
/***************************************************************************
* Copyright (C) 2007 by André Duffeck <duffeck@kde.org> *
* Copyright (C) 2007 Chani Armitage <chanika@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef MICROBLOG_H
#define MICROBLOG_H
#include <QMap>
#include <QTimer>
#include <KTimeZone>
#include <Plasma/PopupApplet>
#include <Plasma/DataEngine>
#include "ui_configuration.h"
#include <QGraphicsLinearLayout>
#include <QGraphicsAnchorLayout>
class KColorScheme;
class PostWidget;
namespace KWallet
{
class Wallet;
}
namespace Plasma
{
class Svg;
class FlashingLabel;
class IconWidget;
class TextEdit;
class WebContent;
class Frame;
class ServiceJob;
class TabBar;
class ScrollWidget;
}
class MicroBlog : public Plasma::PopupApplet
{
Q_OBJECT
public:
MicroBlog(QObject *parent, const QVariantList &args);
~MicroBlog();
void init();
void constraintsEvent(Plasma::Constraints constraints);
QGraphicsWidget *graphicsWidget();
public slots:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void createConfigurationInterface( KConfigDialog *parent );
void configChanged();
/**
* read from the opened KWallet
* @param success whether we got to open it
*/
void readWallet(bool success);
/**
* write to the opened KWallet
* @param success whether we got to open it
*/
void writeWallet(bool success);
protected Q_SLOTS:
void configAccepted();
void updateStatus();
void updateCompleted(Plasma::ServiceJob *job);
void retweetCompleted(Plasma::ServiceJob *job);
void favoriteCompleted(Plasma::ServiceJob *job);
void downloadHistory();
void editTextChanged();
void serviceFinished(Plasma::ServiceJob *job);
void themeChanged();
void scheduleShowTweets();
void showTweets();
void modeChanged(int index);
void openProfile(const QString &user = QString());
void reply(const QString &replyToId, const QString &to);
void forward(const QString &rt);
void favorite(const QString &rt, const bool isFavourite);
/**
* attempt to get the wallet from KWallet
* */
void getWallet();
protected:
bool eventFilter(QObject *obj, QEvent *event);
void popupEvent(bool show);
void focusInEvent(QFocusEvent *event);
private:
/**
* convenience function for setting the folder
*/
bool enterWalletFolder(const QString &folder);
/**
* disable the UI until user is authenticated
*/
void setAuthRequired(bool auth);
/**
* write the password to config instead of wallet
*/
void writeConfigPassword();
/**
* generates and sets the popup icon
*/
void paintIcon();
/**
* Sets up the timeline service object (m_service)
*/
void createTimelineService();
/**
* Returns a unique identifier for a username in a service URL
*/
inline QString identifier() const { return QString("%1@%2").arg(m_username, m_serviceUrl); }
Plasma::Svg *m_theme;
Plasma::TextEdit *m_statusEdit;
Plasma::WebContent *m_historyEdit;
Plasma::FlashingLabel *m_flash;
Plasma::IconWidget *m_icon;
Plasma::ScrollWidget *m_scrollWidget;
Plasma::TabBar *m_tabBar;
QGraphicsWidget *m_tweetsWidget;
QGraphicsLinearLayout *m_tweetsLayout;
QGraphicsLinearLayout *m_layout;
QGraphicsAnchorLayout *m_headerLayout;
QGraphicsWidget *m_graphicsWidget;
QPixmap m_popupIcon;
QString m_username;
QString m_password;
QString m_serviceUrl;
QString m_imageQuery;
//QHash<Plasma::ServiceJob *, QString> m_statusUpdates;
int m_historySize;
int m_historyRefresh;
int m_newTweets;
bool m_includeFriends;
int m_lastMode;
Plasma::DataEngine *m_engine;
QWeakPointer<Plasma::Service> m_service;
Plasma::Service *m_profileService;
QSet<Plasma::ServiceJob *> m_updateJobs;
QSet<Plasma::ServiceJob *> m_retweetJobs;
QSet<Plasma::ServiceJob *> m_favoriteJobs;
QString m_curTimeline;
QString m_replyToId;
Plasma::Frame *m_headerFrame;
QMap<QString, QPixmap> m_pictureMap;
QStringList m_avatarHistory;
QMap<qulonglong, Plasma::DataEngine::Data> m_tweetMap;
QList<PostWidget *> m_tweetWidgets;
qulonglong m_lastTweet;
KWallet::Wallet *m_wallet;
enum WalletWait { None=0, Read, Write };
WalletWait m_walletWait;
KColorScheme *m_colorScheme;
Ui::TwitterConfig configUi;
QTimer *m_showTweetsTimer;
QTimer *m_getWalletDelayTimer;
};
K_EXPORT_PLASMA_APPLET(microblog, MicroBlog)
#endif

View file

@ -1,165 +0,0 @@
[Desktop Entry]
Name=Microblogging
Name[ar]=التدوين المصغر
Name[ast]=Microblogging
Name[bs]=Microblogging
Name[ca]=Microblogs
Name[ca@valencia]=Microblogs
Name[cs]=Mikroblogování
Name[da]=Mikroblogning
Name[de]=Microblogging
Name[el]=Μικροϊστολόγιο
Name[en_GB]=Microblogging
Name[es]=Microblogs
Name[et]=Mikroblogimine
Name[eu]=Mikrobloggintza
Name[fi]=Mikroblogaussovelma
Name[fr]=Microblogging
Name[ga]=Micreabhlagadóireacht
Name[gl]=Microblog
Name[hr]=Microblogging
Name[hu]=Mikroblogolás
Name[is]=Míkróblogg
Name[it]=Microblogging
Name[ja]=
Name[kk]=Микроблогинг
Name[km]=Microblogging
Name[ko]=
Name[lt]=Mikrotinklaraštis
Name[lv]=Mikroblogi
Name[mr]= ि
Name[nb]=Mikroblogging
Name[nds]=Mikronettdagbook
Name[nl]=Microblogging
Name[nn]=Mikroblogging
Name[pa]=
Name[pl]=Mikroblog
Name[pt]=Micro-blog
Name[pt_BR]=Microblogging
Name[ro]=Microblogging
Name[ru]=Микроблоггинг
Name[sk]=Mikroblogovanie
Name[sl]=Mikrobloganje
Name[sq]=Microblogging
Name[sr]=микроблоговање
Name[sr@ijekavian]=микроблоговање
Name[sr@ijekavianlatin]=mikroblogovanje
Name[sr@latin]=mikroblogovanje
Name[sv]=Mikroblogg
Name[tr]=Mikrogünlük
Name[uk]=Міні-журнал
Name[wa]=Microblogaedje
Name[x-test]=xxMicrobloggingxx
Name[zh_CN]=
Name[zh_TW]=Microblogging
Comment=Update and view your microblog status.
Comment[ar]=حدث و شاهد حالة تدويناتك.
Comment[ast]=Anovar y ver l'estáu del to microblog.
Comment[bs]=Ažurirajte i prikažite stanje svog mikrobloga.
Comment[ca]=Actualitza i mostra l'estat del vostre microblog.
Comment[ca@valencia]=Actualitza i mostra l'estat del vostre microblog.
Comment[cs]=Aktualizujte a prohlížejte stav svého mikroblogování.
Comment[da]=Opdater og se status for din mikroblog.
Comment[de]=Status Ihres Microblogs aktualisieren und anzeigen.
Comment[el]=Ενημέρωση και προβολή της κατάστασης του μικροϊστολογίου σας.
Comment[en_GB]=Update and view your microblog status.
Comment[es]=Actualizar y ver el estado de su microblog.
Comment[et]=Oma mikroblogioleku uuendamine ja vaatamine.
Comment[eu]=Eguneratu eta ikusi zure mikroblog egoera.
Comment[fi]=Tarkastele ja päivitä mikroblogaustilaasi.
Comment[fr]=Afficher et mettre à jour l'état de votre mini-blogue.
Comment[ga]=Nuashonraigh agus féach ar do stádas micreabhlagadóireachta.
Comment[gl]=Actualizar e ver o estado do microblog.
Comment[hr]=Ažurirajte i prikažtete Vaš status na mikroblogu.
Comment[hu]=Frissíti és megjeleníti a mikroblogja állapotát.
Comment[is]=Uppfæra og skoða stöðu á míkróblogginu þínu.
Comment[it]=Aggiorna e visualizza lo stato del microblog.
Comment[ja]=
Comment[kk]=Микроблогыңыздың күй-жайын жаңарту әне көрсету
Comment[km]= microblog  
Comment[ko]= .
Comment[lt]=Atnaujinkite ir peržiūrėkite savo minkrotinklaraščio būseną.
Comment[lv]=Atjaunina un rāda mikroblogu statusu.
Comment[mr]= ि .
Comment[nb]=Oppdater og vis din mikroblogg-status.
Comment[nds]=Dien Mikronettdaagbook-Status opfrischen un ankieken
Comment[nl]=Werk uw microblogstatus bij bekijk deze.
Comment[nn]=Oppdater og vis mikrobloggstatusen din
Comment[pa]=
Comment[pl]=Uaktualnianie i przeglądanie mikrobloga.
Comment[pt]=Actualizar e ver o estado do seu micro-blog.
Comment[pt_BR]=Atualiza e exibe o status do seu microblog.
Comment[ro]=Actualizați și vizualizați-vă starea pe microblog.
Comment[ru]=Показывает и позволяет обновлять статус в микроблоге.
Comment[sk]=Aktualizovanie a zobrazenie stavu svojho mikroblogu.
Comment[sl]=Posodobite in spremljajte stanje mikrobloganja.
Comment[sr]=Ажурирајте и прикажите стање свог микроблога.
Comment[sr@ijekavian]=Ажурирајте и прикажите стање свог микроблога.
Comment[sr@ijekavianlatin]=Ažurirajte i prikažite stanje svog mikrobloga.
Comment[sr@latin]=Ažurirajte i prikažite stanje svog mikrobloga.
Comment[sv]=Uppdatera och visa status för mikroblogg
Comment[tr]=Mikrogünlük durumunuzu güncelleyin ve görüntüleyin
Comment[uk]=Оновіть і перегляньте ваш стан у міні-журналі.
Comment[wa]=Metoz a djoû eyet voeyoz vosse sitatut microblog.
Comment[x-test]=xxUpdate and view your microblog status.xx
Comment[zh_CN]=
Comment[zh_TW]= microblog
Keywords=identi.ca;twitter;
Keywords[ar]=identi.ca;twitter;
Keywords[bs]=identi.ca,twitter
Keywords[ca]=identi.ca;twitter;
Keywords[ca@valencia]=identi.ca;twitter;
Keywords[cs]=identi.ca,twitter;
Keywords[da]=identi.ca;twitter;
Keywords[de]=identi.ca;twitter;
Keywords[el]=identi.ca·twitter·
Keywords[en_GB]=identi.ca;twitter;
Keywords[es]=identi.ca;twitter;
Keywords[et]=identi.ca;twitter;
Keywords[fi]=identi.ca;twitter;
Keywords[fr]=identi.ca ; twitter ;
Keywords[gl]=identi.ca;twitter;
Keywords[hu]=identi.ca;twitter;
Keywords[it]=identi.ca;twitter;
Keywords[kk]=identi.ca;twitter;
Keywords[ko]=identi.ca;twitter;
Keywords[lt]=identi.ca;twitter;
Keywords[mr]=identi.ca;twitter;
Keywords[nb]=identi.ca;twitter;
Keywords[nds]=identi.ca,twitter;
Keywords[nl]=identi.ca;twitter;
Keywords[pa]=identi.ca;twitter;
Keywords[pl]=identi.ca;twitter;
Keywords[pt]=identi.ca;twitter;
Keywords[pt_BR]=identi.ca;twitter;
Keywords[ro]=identi.ca;twitter;
Keywords[ru]=identi.ca,twitter,твиттер
Keywords[sk]=identi.ca;twitter;
Keywords[sl]=identi.ca;twitter;
Keywords[sr]=identi.ca;twitter;Идентика;Твитер
Keywords[sr@ijekavian]=identi.ca;twitter;Идентика;Твитер
Keywords[sr@ijekavianlatin]=identi.ca;twitter;identi.ca;Twitter
Keywords[sr@latin]=identi.ca;twitter;identi.ca;Twitter
Keywords[sv]=identi.ca;twitter;
Keywords[tr]=identi.ca;twitter;
Keywords[uk]=identi.ca;twitter;
Keywords[x-test]=xxidenti.ca;twitter;xx
Keywords[zh_CN]=identi.ca;twitter;
Keywords[zh_TW]=identi.ca;twitter;
Type=Service
ServiceTypes=Plasma/Applet
Icon=view-pim-journal
X-KDE-Library=plasma_applet_microblog
X-KDE-PluginInfo-Author=André Duffeck
X-KDE-PluginInfo-Email=andre@duffeck.de
X-KDE-PluginInfo-Name=twitter
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true

View file

@ -1,166 +0,0 @@
/*
* Copyright 2009 by Marco Martin <notmart@gmail.com>
*
*
* 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,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "postwidget.h"
#include <QGraphicsAnchorLayout>
#include <QGraphicsLinearLayout>
#include <QTextDocument>
#include <QLabel>
#include <QLocale>
#include <KDateTime>
#include <KColorScheme>
#include <Plasma/Label>
#include <Plasma/IconWidget>
#include <Plasma/ToolButton>
#include <Plasma/TextBrowser>
#include <Plasma/ScrollWidget>
PostWidget::PostWidget(QGraphicsWidget *parent)
: Plasma::Frame(parent),
m_isFavorite(false),
m_tz(KTimeZone::utc()),
m_colorScheme(0)
{
m_author = new Plasma::Label(this);
m_author->nativeWidget()->setWordWrap(false);
m_picture = new Plasma::IconWidget(this);
m_picture->setMinimumSize(m_picture->sizeFromIconSize(32));
m_picture->setMaximumSize(m_picture->sizeFromIconSize(32));
connect(m_picture, SIGNAL(clicked()), this, SLOT(askProfile()));
m_from = new Plasma::Label(this);
m_from->nativeWidget()->setWordWrap(false);
m_text = new Plasma::TextBrowser(this);
m_text->nativeWidget()->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard);
m_text->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_text->nativeWidget()->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_text->nativeWidget()->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_text->nativeWidget()->setCursor( Qt::ArrowCursor );
m_favoriteButton = new Plasma::ToolButton(this);
//hearth
m_favoriteButton->setText(QChar(0x2665));
connect(m_favoriteButton, SIGNAL(clicked()), this, SLOT(askFavorite()));
m_replyButton = new Plasma::ToolButton(this);
m_replyButton->setText("@");
connect(m_replyButton, SIGNAL(clicked()), this, SLOT(askReply()));
m_forwardButton = new Plasma::ToolButton(this);
//recycle
m_forwardButton->setText(QChar(0x267B));
connect(m_forwardButton, SIGNAL(clicked()), this, SLOT(askForward()));
//corners
QGraphicsAnchorLayout *lay = new QGraphicsAnchorLayout(this);
lay->setSpacing(4);
lay->addCornerAnchors(lay, Qt::TopLeftCorner, m_picture, Qt::TopLeftCorner);
lay->addCornerAnchors(m_picture, Qt::TopRightCorner, m_author, Qt::TopLeftCorner);
lay->addCornerAnchors(m_author, Qt::BottomLeftCorner, m_from, Qt::TopLeftCorner);
lay->addCornerAnchors(lay, Qt::TopRightCorner, m_forwardButton, Qt::TopRightCorner);
lay->addCornerAnchors(m_forwardButton, Qt::TopLeftCorner, m_replyButton, Qt::TopRightCorner);
lay->addCornerAnchors(m_replyButton, Qt::TopLeftCorner, m_favoriteButton, Qt::TopRightCorner);
lay->addCornerAnchors(m_favoriteButton, Qt::TopLeftCorner, m_author, Qt::TopRightCorner);
//vertical
lay->addAnchor(m_from, Qt::AnchorBottom, m_text, Qt::AnchorTop);
lay->addAnchor(lay, Qt::AnchorBottom, m_text, Qt::AnchorBottom);
//horizontal
lay->addAnchor(lay, Qt::AnchorRight, m_from, Qt::AnchorRight);
lay->addAnchors(lay, m_text, Qt::Horizontal);
}
PostWidget::~PostWidget()
{
}
void PostWidget::setData(const Plasma::DataEngine::Data &data)
{
m_messageId = data["Id"].toString();
m_author->setText(data["User"].toString());
QLocale english(QLocale::English, QLocale::UnitedStates);
QDateTime dt = english.toDateTime(data.value( "Date" ).toString(), "ddd MMM dd HH:mm:ss +0000 yyyy");
dt.setTimeSpec(Qt::UTC);
m_from->setText(i18nc("%1 is a time string like '1 hour ago' - %2 is the name of a microblogging client","%1 from %2",timeDescription( dt ), data.value( "Source" ).toString()));
QString status = data["Status"].toString();
status.replace(QRegExp("((http|https)://[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]])"), "<a href='\\1'>\\1</a>");
m_text->setText(QString( "<p><font color='%1'>%2</font></p>" ).arg( m_colorScheme->foreground().color().name()).arg( status ));
m_isFavorite = (data["IsFavorite"].toString() == "true");
m_favoriteButton->setDown(m_isFavorite);
}
void PostWidget::setPicture(const QPixmap &picture)
{
m_picture->setIcon(picture);
}
void PostWidget::setColorScheme(KColorScheme *scheme)
{
m_colorScheme = scheme;
}
void PostWidget::askReply()
{
emit reply(m_messageId, '@' + m_author->text() + ' ');
}
void PostWidget::askForward()
{
emit forward(m_messageId);
}
void PostWidget::askFavorite()
{
emit favorite(m_messageId, !m_isFavorite);
}
void PostWidget::askProfile()
{
emit openProfile(m_author->text());
}
void PostWidget::setActionsShown(bool show)
{
m_favoriteButton->setVisible(show);
m_replyButton->setVisible(show);
m_forwardButton->setVisible(show);
}
QString PostWidget::timeDescription( const QDateTime &dt )
{
int diff = dt.secsTo(KDateTime::currentDateTime(m_tz).dateTime());
if (diff < 60) {
return i18n("Less than a minute ago");
} else if (diff < 60*60) {
return i18np("1 minute ago", "%1 minutes ago", diff/60);
} else if (diff < 2*60*60) {
return i18n("Over an hour ago");
} else if (diff < 24*60*60) {
return i18np("1 hour ago", "%1 hours ago", diff/3600);
}
return dt.toString(Qt::LocaleDate);
}
#include "moc_postwidget.cpp"

View file

@ -1,78 +0,0 @@
/*
* Copyright 2009 by Marco Martin <notmart@gmail.com>
*
*
* 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,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 POSTWIDGET_H
#define POSTWIDGET_H
#include <KTimeZone>
#include <Plasma/DataEngine>
#include <Plasma/Frame>
class KColorScheme;
namespace Plasma
{
class Label;
class IconWidget;
class TextBrowser;
class ToolButton;
}
class PostWidget : public Plasma::Frame
{
Q_OBJECT
public:
PostWidget(QGraphicsWidget *parent);
~PostWidget();
void setData(const Plasma::DataEngine::Data &data);
void setPicture(const QPixmap &picture);
void setColorScheme(KColorScheme *scheme);
void setActionsShown(bool show);
protected:
QString timeDescription(const QDateTime &dt);
protected Q_SLOTS:
void askReply();
void askForward();
void askFavorite();
void askProfile();
Q_SIGNALS:
void reply(const QString messageId, const QString &reply);
void forward(const QString &messageId);
void favorite(const QString &messageId, const bool favorite);
void openProfile(const QString &profile);
private:
QString m_messageId;
Plasma::Label *m_author;
Plasma::IconWidget *m_picture;
Plasma::Label *m_from;
Plasma::TextBrowser *m_text;
Plasma::ToolButton *m_replyButton;
Plasma::ToolButton *m_forwardButton;
Plasma::ToolButton *m_favoriteButton;
bool m_isFavorite;
KTimeZone m_tz;
KColorScheme *m_colorScheme;
};
#endif

View file

@ -1,20 +0,0 @@
project(plasma-news)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(news_SRCS
news.cpp
config.ui
feedsConfig.ui
)
kde4_add_plugin(plasma_applet_news ${news_SRCS})
target_link_libraries(plasma_applet_news
${KDE4_PLASMA_LIBS}
${KDE4_KIO_LIBS}
${QT_QTWEBKIT_LIBRARY}
)
install(TARGETS plasma_applet_news DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-news.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES news.css DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/stylesheets/)

View file

@ -1,4 +0,0 @@
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/plasma_applet_news.pot
rm -f rc.cpp

View file

@ -1,215 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>config</class>
<widget class="QWidget" name="config">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>449</width>
<height>318</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>News</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update interval:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>intervalSpinBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="KIntSpinBox" name="intervalSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>525600</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Information</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="timestampCheckBox">
<property name="text">
<string>Show timestamps</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="titlesCheckBox">
<property name="text">
<string>Show titles</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="descriptionsCheckBox">
<property name="text">
<string>Show descriptions</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string>Note that timestamps, titles and descriptions are available only if they are provided by feed.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>60</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,102 +0,0 @@
<ui version="4.0" >
<class>feedsConfig</class>
<widget class="QWidget" name="feedsConfig" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>502</width>
<height>228</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label_1" >
<property name="text" >
<string>&amp;Add a feed:</string>
</property>
<property name="buddy" >
<cstring>feedComboBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="KHistoryComboBox" name="feedComboBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoCompletion" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="KListWidget" name="feedList" />
</item>
<item>
<layout class="QGridLayout" name="_2" >
<property name="spacing" >
<number>1</number>
</property>
<item row="0" column="0" >
<widget class="KPushButton" name="addFeed" >
<property name="text" >
<string>Add Feed</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="KPushButton" name="removeFeed" >
<property name="text" >
<string>Remove Feed</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KHistoryComboBox</class>
<extends>KComboBox</extends>
<header>khistorycombobox.h</header>
</customwidget>
<customwidget>
<class>KListWidget</class>
<extends>QListWidget</extends>
<header>klistwidget.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,436 +0,0 @@
/*
* Copyright (C) 2007, 2008 Petri Damsten <damu@iki.fi>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "news.h"
#include <QtGui/qgraphicssceneevent.h>
#include <QFile>
#include <QColor>
#include <QtXml/qdom.h>
#include <QGraphicsLinearLayout>
#include <QWebFrame>
#include <QWebPage>
#include <QFileInfo>
#include <KConfigDialog>
#include <KColorScheme>
#include <KDebug>
#include <KStandardDirs>
#include <KRun>
#include <Plasma/Containment>
#include <Plasma/Theme>
#include <Plasma/WebView>
static const char *BEGIN =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
"<head>\n"
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"
" <link rel=\"stylesheet\" type=\"text/css\" href=\"news.css\" />\n"
" <title>Plasma News</title>\n"
"</head>\n"
"<body>\n";
static const char *BEGIN_TABLE = "<table>\n";
static const char *HEADER_LINE = "<tr class=\"header_line\">"
"<td colspan=\"2\" class=\"header\"><a href=\"%1\">%2</a></td></tr>\n";
static const char *DATE_LINE = "<tr class=\"date_line\"><td colspan=\"2\" class=\"date\">%1</td></tr>\n";
static const char *LINE = "<tr class=\"line-%1\">"
"<td colspan=\"2\" class=\"text\"><a href=\"%2\">%3</a></td></tr>\n";
static const char *TIME_LINE = "<tr class=\"line-%1\"><td class=\"time\">%2</td>"
"<td class=\"text\"><a href=\"%3\">%4</a></td></tr>\n";
static const char *TITLE = "<span class=\"title\">%1</span>";
static const char *TITLE_DESC = "<span class=\"title_with_description\">%1</span><br/>";
static const char *DESCRIPTION = "<span class=\"description\">%1</span>";
static const char *END_TABLE = "</table>\n";
static const char *END = "</body>\n</html>\n";
static const char *CSS =
".header { font-size:11pt; font-weight:bold; color:%1; background-color:%2; }\n"
".date { font-size:10pt; font-weight:bold; color:%1; background-color:%2; }\n"
".line-0 { font-size:10pt; color:%1; background-color:%3; }\n"
".line-1 { font-size:10pt; color:%1; background-color:%4; }\n"
".time, .title, .description { }\n"
".text { width:100%; }\n"
".title_with_description { font-weight:bold; }\n"
"a { text-decoration:none; color:%1 }\n"
"table { width:100%; border-spacing:0px; }\n"
"td { vertical-align: top; }\n"
"body { margin:0px; background:none }\n";
News::News(QObject *parent, const QVariantList &args)
: Plasma::PopupApplet(parent, args),
m_graphicsWidget(0)
{
setHasConfigurationInterface(true);
setAspectRatioMode(Plasma::IgnoreAspectRatio);
setPopupIcon("application-rss+xml");
setAssociatedApplication("akregator");
resize(300,300);
}
News::~News()
{
}
QGraphicsWidget *News::graphicsWidget()
{
if (m_graphicsWidget) {
return m_graphicsWidget;
}
m_layout = new QGraphicsLinearLayout();
m_layout->setContentsMargins(0, 0, 0, 0);
m_layout->setSpacing(0);
m_layout->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
m_news = new Plasma::WebView(this);
m_news->setDragToScroll(true);
m_news->installEventFilter(this);
m_news->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
connect(m_news->page(), SIGNAL(linkClicked(QUrl)),
this, SLOT(linkActivated(QUrl)));
m_news->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
m_layout->addItem(m_news);
setAcceptDrops(true);
makeStylesheet();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(makeStylesheet()));
m_graphicsWidget = new QGraphicsWidget(this);
m_graphicsWidget->setLayout(m_layout);
m_graphicsWidget->setPreferredSize(370,440);
//a tiny minimum size, a panel 48px high is enough to display the whole applet
m_graphicsWidget->setMinimumSize(150, 150);
QPalette palette = m_graphicsWidget->palette();
palette.setBrush(QPalette::Base, Qt::transparent);
m_graphicsWidget->setPalette(palette);
configChanged();
return m_graphicsWidget;
}
void News::configChanged()
{
kDebug();
KConfigGroup cg = config();
m_interval = cg.readEntry("interval", 30);
m_showTimestamps = cg.readEntry("showTimestamps", true);
m_showTitles = cg.readEntry("showTitles", true);
m_showDescriptions = cg.readEntry("showDescriptions", false);
m_feeds = cg.readEntry("feeds", QStringList("http://www.kde.org/dotkdeorg.rdf"));
connectToEngine();
}
void News::connectToEngine()
{
if (!m_feeds.isEmpty()) {
Plasma::DataEngine* engine = dataEngine("rss");
if( engine) {
QString feedstring;
foreach (const QString& feed, m_feeds) {
QByteArray ba = QUrl::toPercentEncoding(feed, ":/&?=");
feedstring.append(ba);
feedstring.append(" ");
}
m_feedstring = feedstring;
kDebug() << feedstring;
engine->connectSource(feedstring, this, m_interval * 60 * 1000);
}
else
kDebug()<<"Can not connect to dataengine rss";
}
}
void News::makeStylesheet()
{
const QString search = "desktoptheme/" + Plasma::Theme::defaultTheme()->themeName() +
"/stylesheets/news.css";
const QString path = KStandardDirs::locate("data", search);
if (path.isEmpty()) {
QColor backgroundColor =
Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
QColor altBackgroundColor = backgroundColor;
altBackgroundColor.setHsv(altBackgroundColor.hue(), altBackgroundColor.saturation(),
(altBackgroundColor.value() < 128)
? backgroundColor.value() + 40 : backgroundColor.value() - 40,
altBackgroundColor.alpha());
QString css = QString(CSS).arg(textColor.name())
.arg(QString("rgba(%1, %2, %3, 0.45)").arg(backgroundColor.red()).arg( backgroundColor.green()).arg( backgroundColor.blue()))
.arg(QString("rgba(%1, %2, %3, 0.25)").arg(backgroundColor.red()).arg( backgroundColor.green()).arg( backgroundColor.blue()))
.arg(QString("rgba(%1, %2, %3, 0.25)").arg(altBackgroundColor.red()).arg( altBackgroundColor.green()).arg( altBackgroundColor.blue()));
KStandardDirs dirs;
m_cssDir = dirs.saveLocation("data", "plasma_applet_news");
QFile file(m_cssDir + "/news.css");
if (file.open(QIODevice::WriteOnly)) {
file.write(css.toUtf8());
}
} else {
m_cssDir = QFileInfo(path).absolutePath() + '/';
}
QWebFrame* frame = m_news->mainFrame();
if (frame) {
frame->setHtml(frame->toHtml(), m_cssDir);
}
}
QMap<QString, QString> News::akregatorFeeds()
{
QMap<QString, QString> result;
const QString file = KStandardDirs::locate("data", "akregator/data/feeds.opml");
if (!file.isEmpty()) {
QFile f(file);
if (f.open(QIODevice::ReadOnly)) {
QDomDocument doc;
if (doc.setContent(&f)) {
QDomNodeList nodes = doc.elementsByTagName("outline");
for (int i = 0; i < nodes.count(); ++i) {
QDomElement element = nodes.item(i).toElement();
QString title = element.attribute("title");
if (!title.isEmpty()) {
result[title] = element.attribute("xmlUrl");
}
}
}
f.close();
}
}
return result;
}
void News::createConfigurationInterface(KConfigDialog *parent)
{
QWidget *widget = new QWidget();
ui.setupUi(widget);
QWidget *fWidget = new QWidget(0);
feedsUi.setupUi(fWidget);
parent->addPage(widget, i18n("General"), icon());
parent->addPage(fWidget, i18n("Feeds"), "application-rss+xml");
connect(feedsUi.feedComboBox, SIGNAL(editTextChanged(QString)),
this, SLOT(feedTextChanged(QString)));
connect(parent, SIGNAL(accepted()), this, SLOT(configAccepted()));
connect(feedsUi.addFeed, SIGNAL(clicked()), this, SLOT(addFeed()));
connect(feedsUi.removeFeed, SIGNAL(clicked()), this, SLOT(removeFeed()));
m_defaultFeeds = akregatorFeeds();
feedsUi.feedComboBox->clear();
feedTextChanged(QString());
feedsUi.feedList->clear();
foreach (const QString& name, m_defaultFeeds.keys()) {
feedsUi.feedComboBox->addItem(name);
}
ui.intervalSpinBox->setValue(m_interval);
ui.intervalSpinBox->setSuffix(ki18np(" minute", " minutes"));
ui.timestampCheckBox->setChecked(m_showTimestamps);
ui.titlesCheckBox->setChecked(m_showTitles);
ui.descriptionsCheckBox->setChecked(m_showDescriptions);
feedsUi.feedList->addItems(m_feeds);
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
connect(ui.intervalSpinBox, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified()));
connect(ui.timestampCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(ui.titlesCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(ui.descriptionsCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(feedsUi.feedComboBox, SIGNAL(editTextChanged(QString)), parent, SLOT(settingsModified()));
connect(feedsUi.addFeed, SIGNAL(released()), parent, SLOT(settingsModified()));
connect(feedsUi.removeFeed, SIGNAL(released()), parent, SLOT(settingsModified()));
connect(feedsUi.feedList, SIGNAL(itemSelectionChanged()), parent, SLOT(settingsModified()));
}
void News::feedTextChanged(const QString& text)
{
feedsUi.addFeed->setEnabled(!text.isEmpty());
}
void News::addFeed()
{
if (!feedsUi.feedComboBox->currentText().isEmpty()) {
QString url = feedsUi.feedComboBox->currentText();
if (m_defaultFeeds.keys().contains(url)) {
url = m_defaultFeeds[url];
}
bool found = false;
for (int i = 0; i < feedsUi.feedList->count(); i++) {
QString feed = feedsUi.feedList->item(i)->text();
if (feed == url) {
found = true;
}
}
if (!found) {
feedsUi.feedList->addItem(url);
}
feedsUi.removeFeed->setEnabled(true);
}
}
void News::removeFeed()
{
int row = feedsUi.feedList->currentRow();
if (row != -1) {
feedsUi.feedList->takeItem(row);
if (feedsUi.feedList->count() == 0) {
feedsUi.removeFeed->setEnabled(false);
}
}
}
void News::configAccepted()
{
m_interval = ui.intervalSpinBox->value();
m_showTimestamps = ui.timestampCheckBox->isChecked();
m_showTitles = ui.titlesCheckBox->isChecked();
m_showDescriptions = ui.descriptionsCheckBox->isChecked();
m_feeds.clear();
QString feed;
for (int i = 0; i < feedsUi.feedList->count(); i++) {
feed = feedsUi.feedList->item(i)->text();
if (m_defaultFeeds.keys().contains(feed)) {
feed = m_defaultFeeds[feed];
}
m_feeds.append(feed);
}
KConfigGroup cg = config();
cg.writeEntry("feeds", m_feeds);
cg.writeEntry("interval", m_interval);
cg.writeEntry("showTimestamps", m_showTimestamps);
cg.writeEntry("showTitles", m_showTitles);
cg.writeEntry("showDescriptions", m_showDescriptions);
dataUpdated(m_feedstring, m_dataCache);
}
void News::dropEvent(QGraphicsSceneDragDropEvent *event)
{
if (KUrl::List::canDecode(event->mimeData())) {
KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
if (!urls.isEmpty()) {
event->accept();
m_feeds.clear();
foreach (const KUrl &feed, urls) {
m_feeds << feed.prettyUrl();
}
m_interval = 30;
connectToEngine();
}
}
}
bool News::eventFilter(QObject *receiver, QEvent *event)
{
if (receiver == m_news && event->type() == QEvent::GraphicsSceneContextMenu) {
return true;
}
return false;
}
void News::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data)
{
if (source == m_feedstring && !data.isEmpty()) {
m_dataCache = data;
QDateTime previous = QDateTime::currentDateTime();
QString html;
QVariantList items = data["items"].toList();
uint columns = 1;
uint i = 0;
html += BEGIN;
html += BEGIN_TABLE;
html += QString(HEADER_LINE).arg(data["link"].toString())
.arg(data["title"].toString());
foreach (const QVariant &tmp, items) {
QMap<QString, QVariant> item = tmp.toMap();
if (item["time"].toUInt() != 0) {
columns = 2;
} else {
columns = 1;
}
uint timeStamp = item["time"].toUInt();
QString title = item["title"].toString();
QString description = item["description"].toString().remove(QRegExp("<[^>]*>"));
QString line;
if (title != 0 && m_showTitles) {
if (description != 0 && m_showDescriptions) {
line += QString(TITLE_DESC).arg(title);
} else {
line += QString(TITLE).arg(title);
}
}
if (description != 0 && m_showDescriptions) {
line += QString(DESCRIPTION).arg(description);
}
if (timeStamp != 0 && m_showTimestamps) {
QDateTime time;
time.setTime_t(timeStamp);
if (previous.date() != time.date()) {
html += QString(DATE_LINE).arg(time.date().toString());
i = 0;
}
html += QString(TIME_LINE).arg(i % 2)
.arg(time.time().toString("HH:mm"))
.arg(item["link"].toString())
.arg(line);
previous = time;
} else {
html += QString(LINE).arg(i % 2)
.arg(item["link"].toString())
.arg(line);
}
++i;
}
html += END_TABLE;
html += END;
m_graphicsWidget->setPreferredSize(-1, -1);
m_news->setHtml(html, m_cssDir);
emit sizeHintChanged(Qt::PreferredSize);
}
}
void News::linkActivated(const QUrl& link)
{
KRun::runUrl(KUrl(link), "text/html", 0);
}
#include "moc_news.cpp"

View file

@ -1,13 +0,0 @@
.header { font-size:11pt; font-weight:bold; color:#000; background-color:rgba(255,255,255,0.45); }
.date { font-size:10pt; font-weight:bold; color:#000; background-color:rgba(255,255,255,0.45); }
.line-0 { font-size:10pt; color:#000; background-color:rgba(255,255,255,0.25); }
.line-1 { font-size:10pt; color:#000; background-color:transparent; }
.time { font-size:7pt; color:#555; padding-top:3px; }
.title, .description { }
.description { font-size:9pt; }
.text { width:100%; }
.title_with_description { font-weight:bold; }
a { text-decoration:none; color:#222; }
table { width:100%; border-spacing:0px; }
td { vertical-align: top; }
body { margin:0px; background-color:transparent }

View file

@ -1,78 +0,0 @@
/*
* Copyright (C) 2007, 2008 Petri Damsten <damu@iki.fi>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NEWS_HEADER
#define NEWS_HEADER
#include <Plasma/PopupApplet>
#include <Plasma/DataEngine>
#include "ui_config.h"
#include "ui_feedsConfig.h"
namespace Plasma {
class WebView;
}
#include <QGraphicsLinearLayout>
class News : public Plasma::PopupApplet
{
Q_OBJECT
public:
News(QObject *parent, const QVariantList &args);
~News();
QGraphicsWidget *graphicsWidget();
public Q_SLOTS:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void configChanged();
protected:
virtual void createConfigurationInterface(KConfigDialog *parent);
void connectToEngine();
QMap<QString, QString> akregatorFeeds();
bool eventFilter(QObject *receiver, QEvent *event);
protected Q_SLOTS:
void dropEvent(QGraphicsSceneDragDropEvent *event);
void configAccepted();
void linkActivated(const QUrl& link);
void addFeed();
void removeFeed();
void feedTextChanged(const QString& text);
void makeStylesheet();
private:
QStringList m_feeds;
QString m_feedstring;
uint m_interval;
bool m_showTimestamps;
bool m_showTitles;
bool m_showDescriptions;
Ui::config ui;
Ui::feedsConfig feedsUi;
QMap<QString, QString> m_defaultFeeds;
Plasma::WebView* m_news;
QGraphicsLinearLayout* m_layout;
QGraphicsWidget *m_graphicsWidget;
QString m_cssDir;
Plasma::DataEngine::Data m_dataCache;
};
K_EXPORT_PLASMA_APPLET(news, News)
#endif

View file

@ -1,128 +0,0 @@
[Desktop Entry]
Name=News
Name[ar]=أخبار
Name[ast]=Noticies
Name[bs]=Novosti
Name[ca]=Notícies
Name[ca@valencia]=Notícies
Name[cs]=Novinky
Name[da]=Nyheder
Name[de]=News
Name[el]=Ειδήσεις
Name[en_GB]=News
Name[es]=Noticias
Name[et]=Uudised
Name[eu]=Berriak
Name[fi]=Uutiset
Name[fr]=Nouvelles
Name[ga]=Nuacht
Name[gl]=Novas
Name[he]=חדשות
Name[hr]=Novosti
Name[hu]=Hírek
Name[is]=Fréttir
Name[it]=Notizie
Name[ja]=
Name[kk]=Жаңалықтар
Name[km]=
Name[ko]=
Name[ku]=Nûçe
Name[lt]=Naujienos
Name[lv]=Ziņas
Name[mr]=
Name[nb]=Nyheter
Name[nds]=Narichten
Name[nl]=Nieuws
Name[nn]=Nyheiter
Name[pa]=
Name[pl]=Nowości
Name[pt]=Notícias
Name[pt_BR]=Notícias
Name[ro]=Știri
Name[ru]=Новости
Name[sk]=Novinky
Name[sl]=Novice
Name[sq]=Të rejat
Name[sr]=вести
Name[sr@ijekavian]=вијести
Name[sr@ijekavianlatin]=vijesti
Name[sr@latin]=vesti
Name[sv]=Nyheter
Name[th]=
Name[tr]=Haberler
Name[ug]=خەۋەر
Name[uk]=Новини
Name[wa]=Noveles
Name[x-test]=xxNewsxx
Name[zh_CN]=
Name[zh_TW]=
Comment=Show news from various sources
Comment[ar]=أظهر الأخبار من مصادر متعددة
Comment[ast]=Amuesa noticies de delles fontes
Comment[bs]=Prikazuje vijesti iz različitih izvora
Comment[ca]=Mostra les notícies de diverses fonts
Comment[ca@valencia]=Mostra les notícies de diverses fonts
Comment[cs]=Zobrazit novinky z různých zdrojů
Comment[da]=Viser nyheder fra forskellige kilder.
Comment[de]=Neuigkeiten aus verschiedenen Quellen anzeigen
Comment[el]=Εμφάνιση ειδήσεων από διάφορες πηγές
Comment[en_GB]=Show news from various sources
Comment[es]=Muestra noticias de varias fuentes
Comment[et]=Mitmest allikast uudiste näitamine
Comment[eu]=Erakutsi iturburu desberdinetako berriak
Comment[fi]=Näyttää uutisia useista eri lähteistä
Comment[fr]=Affiche des nouvelles depuis diverses sources
Comment[ga]=Taispeáin nuacht ó fhoinsí éagsúla
Comment[gl]=Mostra as novas de varias fontes.
Comment[he]=מציג חדשות ממקורות שונים
Comment[hr]=Prikaži vijesti iz raznih izvora
Comment[hu]=Különböző forrásból származó hírek megjelenítése
Comment[is]=Sýna fréttir frá mismunandi uppruna
Comment[it]=Mostra notizie da varie fonti
Comment[ja]=
Comment[kk]=Түрлі көздерден келген жаңалықтарды көрсету
Comment[km]=
Comment[ko]=
Comment[ku]=Jê çavkaniyên cur bi cur nûçe yan nîşan bide
Comment[lt]=Rodo naujienas iš įvairių šaltinių
Comment[lv]=Rāda ziņas no dažādiem avotiem
Comment[mr]=िि
Comment[nb]=Vis nyheter fra ymse kilder
Comment[nds]=Narichten vun verscheden Borns wiesen
Comment[nl]=Toont nieuws van verschillende bronnen
Comment[nn]=Vis nyheiter frå ulike kjelder
Comment[pa]=
Comment[pl]=Wyświetlanie nowości z różnych źródeł
Comment[pt]=Mostra as notícias de várias fontes
Comment[pt_BR]=Mostra notícias de várias fontes
Comment[ro]=Afișează noutăți din diverse surse
Comment[ru]=Показывает новости из различных источников
Comment[sk]=Zobrazenie noviniek z rôznych zdrojov
Comment[sl]=Prikaže novice iz različnih virov
Comment[sr]=Приказује вести из различитих извора
Comment[sr@ijekavian]=Приказује вијести из различитих извора
Comment[sr@ijekavianlatin]=Prikazuje vijesti iz različitih izvora
Comment[sr@latin]=Prikazuje vesti iz različitih izvora
Comment[sv]=Visa nyheter från olika källor
Comment[th]=
Comment[tr]=Çeşitli kaynaklardan haberleri göster
Comment[uk]=Показати новини від різноманітних джерел
Comment[wa]=Mostrer des noveles a pårti d' sacwants sourdants
Comment[x-test]=xxShow news from various sourcesxx
Comment[zh_CN]=
Comment[zh_TW]=
Type=Service
Icon=application-rss+xml
ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_news
X-KDE-PluginInfo-Author=Petri Damstén
X-KDE-PluginInfo-Email=damu@iki.fi
X-KDE-PluginInfo-Name=news
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true

View file

@ -1,32 +0,0 @@
project(rememberthemilk-plasmoid)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${KDE4_INCLUDES}
)
set(rememberthemilk-plasmoid_SRCS
rememberthemilk-plasmoid.cpp
taskitem.cpp
taskitemdelegate.cpp
taskeditor.cpp
taskmodel.cpp
tasksortfilter.cpp
authenticate.ui
general.ui
)
kde4_add_plugin(plasma_applet_rtm ${rememberthemilk-plasmoid_SRCS})
target_link_libraries(plasma_applet_rtm
${KDE4_PLASMA_LIBS}
${KDE4_SOLID_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KDEWEBKIT_LIBS}
)
install(TARGETS plasma_applet_rtm
DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-rememberthemilk.desktop
DESTINATION ${SERVICES_INSTALL_DIR})

View file

@ -1,3 +0,0 @@
#! /bin/sh
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/plasma_applet_rtm.pot

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AuthWidget</class>
<widget class="QWidget" name="AuthWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>517</width>
<height>477</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="whatsThis">
<string>Displays the current authentication state of the KDE Remember The Milk applet. If the light is green, the applet is authenticated. If the light is red, you need to enter your username and password below to log in.</string>
</property>
<property name="title">
<string>Current Authentication Status</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KLed" name="kled">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="authStatus">
<property name="text">
<string>Authenticated</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Re-Authenticate</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<item row="1" column="1">
<widget class="KWebView" name="webView"/>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="authenticateButton">
<property name="text">
<string>Authenticate with Remember The Milk Service</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>No Remember The Milk Account?</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="KUrlLabel" name="signupLabel">
<property name="text">
<string>Register for one here.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="url">
<string>https://www.rememberthemilk.com/signup/</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>123</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
<customwidget>
<class>KWebView</class>
<extends>QWebView</extends>
<header>kwebview.h</header>
</customwidget>
<customwidget>
<class>KUrlLabel</class>
<extends>QLabel</extends>
<header>kurllabel.h</header>
</customwidget>
<customwidget>
<class>KLed</class>
<extends>QWidget</extends>
<header>kled.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeneralWidget</class>
<widget class="QWidget" name="GeneralWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Sort by:</string>
</property>
<property name="buddy">
<cstring>sortType</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="sortType">
<property name="whatsThis">
<string>Change the current sorting method.
Priority:
Items are first sorted by their priority (1, 2, 3, none) and secondly by due date.
Due Date:
Items are first sorted by their due date and secondly by priority.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>123</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,118 +0,0 @@
[Desktop Entry]
Name=Remember The Milk
Name[ar]=Remember The Milk
Name[ast]=Remember The Milk
Name[bs]=Sjeti se mlijeka
Name[ca]=Remember The Milk
Name[ca@valencia]=Remember The Milk
Name[cs]=Remember The Milk
Name[da]=Remember The Milk
Name[de]=Remember The Milk
Name[el]=Remember The Milk
Name[en_GB]=Remember The Milk
Name[es]=Remember The Milk
Name[et]=Remember The Milk
Name[fi]=Remember The Milk
Name[fr]=Pense-bête
Name[ga]=Remember The Milk
Name[gl]=Acórdate do leite
Name[hr]=Remember The Milk
Name[hu]=Remember The Milk
Name[is]=Muna eftir mjólkinni
Name[it]=Remember The Milk
Name[ja]=Remember The Milk
Name[kk]=Remember The Milk
Name[km]= Milk
Name[ko]=Remember The Milk
Name[lt]=Prisimink pieną
Name[lv]=Remember The Milk
Name[mr]=
Name[nb]=Husk melk
Name[nds]=Dor-An-Denken
Name[nl]=Remember The Milk
Name[nn]=Remember The Milk
Name[pa]= ਿ
Name[pl]=Remember The Milk
Name[pt]=Recordar as Tarefas
Name[pt_BR]=Remember The Milk
Name[ro]=Nu uita laptele
Name[ru]=Remember The Milk
Name[sk]=Remember The Milk
Name[sl]=Remember The Milk
Name[sr]=Не заборави млеко
Name[sr@ijekavian]=Не заборави млијеко
Name[sr@ijekavianlatin]=Ne zaboravi mlijeko
Name[sr@latin]=Ne zaboravi mleko
Name[sv]=Remember The Milk
Name[tr]=Remember The Milk
Name[uk]=Remember The Milk
Name[wa]=Si sovni do laecea
Name[x-test]=xxRemember The Milkxx
Name[zh_CN]=Remember The Milk
Name[zh_TW]=Remember The Milk
Comment=Remember The Milk Todo list applet
Comment[ar]=بريمج قائمة المهام Remember The Milk
Comment[ast]=Miniaplicación de xeres pendientes Remember The Milk
Comment[bs]=Aplet spisak obaveza na Sjeti se mlijeka
Comment[ca]=Miniaplicació per la llista de coses pendents de «Remember The Milk»
Comment[ca@valencia]=Miniaplicació per la llista de coses pendents de «Remember The Milk»
Comment[cs]=Applet úkolů Remember The Milk
Comment[da]=Remember The Milk er en opgaveliste-applet.
Comment[de]=Aufgaben-Listen-Miniprogramm für Remember The Milk
Comment[el]=Remember The Milk μικροεφαρμογή λίστας υλοποίησης
Comment[en_GB]=Remember The Milk Todo list applet
Comment[es]=Miniaplicación de tareas pendientes Remember The Milk
Comment[et]=Remember The Milk ülesannete nimekirja aplett
Comment[fi]=Remember The Milk -tehtävälistasovelma
Comment[fr]=Composant graphique de pense-bête pour une liste de tâches
Comment[ga]=Feidhmchláirín tascanna Remember The Milk
Comment[gl]=Applet de lista de tarefas pendentes «Acórdate do leite»
Comment[hu]=Remember The Milk teendőlista-kisalkalmazás
Comment[is]=Smáforritið 'Muna eftir mjólkinni' geralisti
Comment[it]=Applet delle cose da fare Remember The Milk
Comment[ja]=Remember The Milk To-Do
Comment[kk]=Remember The Milk істейтін істер тізімі
Comment[km]= Milk
Comment[ko]=Remember The Milk 릿
Comment[lt]=Prisimink pieną užduočių sąrašo programėlė
Comment[lv]=Remember The Milk darāmo darbu saraksta sīkrīks
Comment[mr]=
Comment[nb]=Husk melk miniprogram for gjøreliste
Comment[nds]=Opgavenlist-Lüttprogramm "Dor An Denken"
Comment[nl]=Applet voor takenlijst van Remember The Milk
Comment[nn]=Hugselista Remember The Milk
Comment[pa]= ਿ - ਿ ਿ
Comment[pl]=Lista rzeczy do zrobienia Remember The Milk
Comment[pt]='Applet' de lista de tarefas e itens por-fazer
Comment[pt_BR]=Miniaplicativo de lista de tarefas do Remember The Milk
Comment[ro]=Miniaplicație cu listă de sarcini Nu uita laptele
Comment[ru]=Список заданий Remember The Milk
Comment[sk]=Zoznam úloh z Remember The Milk
Comment[sl]=Aplet za opravila na Remember The Milk
Comment[sr]=Аплет списка обавеза на Не заборави млеку
Comment[sr@ijekavian]=Аплет списка обавеза на Не заборави млијеку
Comment[sr@ijekavianlatin]=Aplet spiska obaveza na Ne zaboravi mlijeku
Comment[sr@latin]=Aplet spiska obaveza na Ne zaboravi mleku
Comment[sv]=Miniprogram med lista över Remember The Milk-aktiviteter
Comment[tr]=Remember The Milk Yapılacaklar listesi programcığı
Comment[uk]=Аплет списку завдань Remember The Milk
Comment[wa]=Aplikete des afés Si sovni do laecea
Comment[x-test]=xxRemember The Milk Todo list appletxx
Comment[zh_CN]=Remember The Milk
Comment[zh_TW]=Remember The Milk
Type=Service
X-KDE-ServiceTypes=Plasma/Applet
Icon=basket
X-KDE-Library=plasma_applet_rtm
X-KDE-PluginInfo-Author=Andrew Stromme
X-KDE-PluginInfo-Email=astromme@chatonka.com
X-KDE-PluginInfo-Name=plasma_applet_rtm
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://blog.chatonka.com
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-Requires-FileDialog=Unused
X-Plasma-Requires-LaunchApp=Unused

View file

@ -1,433 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
* Copyright 2012 Jeremy Whiting <jpwhiting@kde.org>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "rememberthemilk-plasmoid.h"
// Qt Includes
#include <QPushButton>
#include <QCheckBox>
#include <QTreeView>
// KDE Includes
#include <KConfigDialog>
#include <KDebug>
#include <KToolInvocation>
// Plasma Includes
#include <Plasma/Theme>
#include <Plasma/Service>
#include <Plasma/Animator>
#include <Plasma/TreeView>
#include <Plasma/TabBar>
#include <Plasma/Label>
#include <Plasma/LineEdit>
#include <Plasma/ServiceJob>
// Local
#include "ui_authenticate.h"
#include "ui_general.h"
#include "taskmodel.h"
#include "tasksortfilter.h"
#include <KLineEdit>
RememberTheMilkPlasmoid::RememberTheMilkPlasmoid(QObject* parent, const QVariantList& args)
: Plasma::PopupApplet(parent, args),
m_authenticated(false),
m_sortBy(SortDue),
m_taskEditor(0),
m_engine(0),
m_taskService(0),
m_graphicsWidget(0),
m_authService(0),
m_authWidgetUi(new Ui::AuthWidget),
m_generalOptionsUi(new Ui::GeneralWidget)
{
setBackgroundHints(DefaultBackground);
setPopupIcon("view-pim-journal"); // TODO: Create/Find better item
m_authWidget = new QWidget();
m_authWidgetUi->setupUi(m_authWidget);
m_authWidgetUi->webView->hide();
m_generalOptions = new QWidget();
connect(m_authWidgetUi->signupLabel, SIGNAL(leftClickedUrl(QString)), KToolInvocation::self(), SLOT(invokeBrowser(QString)));
m_generalOptionsUi->setupUi(m_generalOptions);
m_generalOptionsUi->sortType->addItem(i18n("Due Date"));
m_generalOptionsUi->sortType->addItem(i18n("Priority"));
}
RememberTheMilkPlasmoid::~RememberTheMilkPlasmoid() {
if (hasFailedToLaunch()) {
kDebug() << "failed to launch";
}
delete m_authWidget;
delete m_authWidgetUi;
delete m_generalOptions;
delete m_generalOptionsUi;
}
void RememberTheMilkPlasmoid::init() {
setAspectRatioMode(Plasma::IgnoreAspectRatio);
graphicsWidget();
if (!m_engine || !m_engine->isValid()) {
return Plasma::Applet::init();
}
m_engine->connectSource("Auth", this);
m_authService = m_engine->serviceForSource("Auth");
m_authService->setParent(this);
connect(m_authService, SIGNAL(finished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*)));
configChanged();
Plasma::Applet::init();
setAssociatedApplicationUrls(KUrl("http://rememberthemilk.com"));
}
void RememberTheMilkPlasmoid::startAuth()
{
disconnect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(startAuth()));
connect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(continueAuth()));
m_authWidgetUi->authenticateButton->setText(i18n("Click to finish authentication"));
KConfigGroup cg = m_authService->operationDescription("StartLogin");
Plasma::ServiceJob* authJob = m_authService->startOperationCall(cg);
connect(authJob, SIGNAL(finished(KJob*)), SLOT(authJobFinished(KJob*)));
busyUntil(authJob);
busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh
m_authenticated = false;
}
void RememberTheMilkPlasmoid::authJobFinished(KJob* job)
{
Plasma::ServiceJob *authJob = qobject_cast<Plasma::ServiceJob*>(job);
QString url = authJob->result().toString();
m_authWidgetUi->webView->setUrl(QUrl(url));
m_authWidgetUi->webView->show();
}
void RememberTheMilkPlasmoid::continueAuth()
{
KConfigGroup cg = m_authService->operationDescription("Login");
Plasma::ServiceJob* authJob = m_authService->startOperationCall(cg);
busyUntil(authJob);
busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh
m_authenticated = false;
}
void RememberTheMilkPlasmoid::configAccepted() {
switch(m_generalOptionsUi->sortType->currentIndex()) {
case 0:
setSortBy(SortDue);
break;
case 1:
setSortBy(SortPriority);
break;
}
}
void RememberTheMilkPlasmoid::configFinished()
{
m_authWidget->setParent(0); // We don't want these widgets destroyed along with the configuration window
m_generalOptions->setParent(0); // They are reused later
}
void RememberTheMilkPlasmoid::createConfigurationInterface(KConfigDialog* parent) {
connect(parent, SIGNAL(finished()), this, SLOT(configFinished()));
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
connect(m_authWidgetUi->authenticateButton, SIGNAL(clicked(bool)), this, SLOT(startAuth()));
m_generalOptionsUi->sortType->setCurrentIndex(m_sortBy);
KPageWidgetItem* general = parent->addPage(m_generalOptions, i18n("General"), "configure", i18n("General Configuration Options"));
KPageWidgetItem* auth = parent->addPage(m_authWidget, i18n("Authentication"), icon(), i18n("Remember The Milk Authentication"));
if (!m_authenticated)
parent->setCurrentPage(auth);
else
parent->setCurrentPage(general);
connect(m_generalOptionsUi->sortType, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(this, SIGNAL(authenticated()), parent, SLOT(settingsModified()));
}
void RememberTheMilkPlasmoid::setSortBy(SortBy sortBy)
{
m_filterModel->setSortBy(sortBy);
m_model->setDropType(sortBy);
switch (sortBy) {
case SortPriority:
config().writeEntry("SortBy", "Priority");
m_delegate->setSmallTasks(false);
break;
case SortDue:
config().writeEntry("SortBy", "Date");
m_delegate->setSmallTasks(true);
break;
}
m_sortBy = sortBy;
}
void RememberTheMilkPlasmoid::dataUpdated(const QString& name, const Plasma::DataEngine::Data& data) {
if (name == "Auth") {
m_authenticated = data.value("ValidToken").toBool();
kDebug() << "Auth: " << m_authenticated;
m_authWidgetUi->webView->hide();
if (m_authenticated) {
m_authWidgetUi->authStatus->setText(i18n("Authenticated"));
m_authWidgetUi->kled->setState(KLed::On);
m_authWidgetUi->kled->setColor(Qt::green);
} else {
m_authWidgetUi->authStatus->setText(i18n("Not Authenticated"));
m_authWidgetUi->kled->setState(KLed::Off);
m_authWidgetUi->kled->setColor(Qt::red);
m_busyUntil.clear(); // no longer trying to authenticate
setBusy(false);
}
if (m_authenticated) {
setConfigurationRequired(false);
m_token = data.value("Token").toString();
config().writeEntry("token", m_token);
m_engine->connectSource("Lists", this);
m_engine->connectSource("Tasks", this);
busyUntil(0);
emit authenticated();
}
else if (m_categoriesBar->count() == 1 && m_lists.isEmpty())
m_categoriesBar->nativeWidget()->setTabText(0, i18n("Login Failed. Please try again."));
}
else if (name == "Lists") {
if (m_categoriesBar->count() == 1 && m_lists.isEmpty())
m_categoriesBar->removeTab(0); // remove "refreshing" tab;
//while (m_categoriesBar->count())
// m_categoriesBar->removeTab(0);
//m_lists.clear(); //FIXME: What happens when a list is deleted?
foreach(const QString &key, data.keys()) {
if (!m_lists.contains(key.toULongLong())) {
m_categoriesBar->addTab(data.value(key).toString());
m_lists.append(key.toULongLong());
}
m_model->listUpdate(key.toULongLong());
}
int current = config().readEntry("CurrentList").toInt();
if (m_categoriesBar->count() >= current) {
m_categoriesBar->setCurrentIndex(current);
listChanged(current); // doesn't always update.. i.e if current is actually the current
}
}
else if (name == "Tasks") {
if (data.keys().count() > 0)
jobFinished(0); // No longer busy.
}
}
void RememberTheMilkPlasmoid::listChanged(int pos)
{
if (pos < 0 || pos >= m_lists.size())
return;
config().writeEntry("CurrentList", pos);
m_model->switchToList(m_lists.at(pos));
}
void RememberTheMilkPlasmoid::createTask(const QString& task)
{
if (!m_taskService) {
m_taskService = m_engine->serviceForSource("Tasks");
m_taskService->setParent(this);
connect(m_taskService, SIGNAL(finished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*)));
}
KConfigGroup cg = m_taskService->operationDescription("create");
cg.writeEntry("task", task);
kDebug() << "QString::number(m_model->currentList()->id)";
cg.writeEntry("listid", m_model->currentList()->id);
busyUntil(m_taskService->startOperationCall(cg));
}
void RememberTheMilkPlasmoid::onTaskEditorHide() {
m_tasksView->nativeWidget()->setEnabled(true);
m_priorityLabel->setText(i18n("Remember The Milk Tasks"));
}
void RememberTheMilkPlasmoid::showTaskEditor(QModelIndex index) {
if (index.data(Qt::RTMItemType).toInt() != RTMTaskItem) // We have a header rather than a task.
return;
m_taskEditor->setModelIndex(index);
m_taskEditor->hide();
m_taskEditor->show();
m_tasksView->nativeWidget()->setEnabled(false);
m_taskEditor->setEnabled(true);
m_taskEditor->startAnimation(m_tasksView->size());
m_priorityLabel->setText(i18n("Editing Task: ") + index.data(Qt::RTMNameRole).toString());
geometryChanged();
}
void RememberTheMilkPlasmoid::busyUntil(Plasma::ServiceJob* job)
{
setBusy(true);
m_busyUntil.append(job);
}
void RememberTheMilkPlasmoid::jobFinished(Plasma::ServiceJob* job)
{
if (m_busyUntil.contains(job)) {
m_busyUntil.removeAll(job);
}
if (m_busyUntil.isEmpty())
setBusy(false);
}
void RememberTheMilkPlasmoid::resizeEvent(QGraphicsSceneResizeEvent* event) {
if (m_taskEditor)
m_taskEditor->resize(m_tasksView->size());
Plasma::Applet::resizeEvent(event);
}
QGraphicsWidget* RememberTheMilkPlasmoid::graphicsWidget() {
if (m_graphicsWidget)
return m_graphicsWidget;
m_engine = dataEngine("rtm");
if (!m_engine || !m_engine->isValid()) {
setFailedToLaunch(true, i18n("Failed to load the Remember The Milk DataEngine"));
return m_graphicsWidget;
}
m_graphicsWidget = new QGraphicsWidget(this);
m_model = new TaskModel(m_engine, this);
connect(m_model, SIGNAL(jobStarted(Plasma::ServiceJob*)), SLOT(busyUntil(Plasma::ServiceJob*)));
connect(m_model, SIGNAL(jobFinished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*)));
m_priorityLabel = new Plasma::Label(this);
m_priorityLabel->setAlignment(Qt::AlignHCenter);
m_priorityLabel->setText(i18n("Remember The Milk Tasks"));
m_categoriesBar = new Plasma::TabBar(this);
m_categoriesBar->addTab(i18n("No Data Yet. Refreshing..."));
connect(m_categoriesBar, SIGNAL(currentChanged(int)), SLOT(listChanged(int)));
QPalette palette;
palette.setBrush(QPalette::Background, Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
palette.setBrush(QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
m_delegate = new TaskItemDelegate(this);
m_filterModel = new TaskSortFilter(m_model, this);
connect(m_model, SIGNAL(modelUpdated()), m_filterModel, SLOT(listChanged()));
m_tasksView = new Plasma::TreeView(this);
m_tasksView->installEventFilter(m_delegate);
m_tasksView->setModel(m_filterModel);
m_tasksView->nativeWidget()->setItemDelegate(m_delegate);
m_tasksView->nativeWidget()->header()->setHidden(true);
m_tasksView->nativeWidget()->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_tasksView->nativeWidget()->setRootIsDecorated(false);
m_tasksView->nativeWidget()->setIndentation(0);
m_tasksView->nativeWidget()->viewport()->setAutoFillBackground(false);
m_tasksView->nativeWidget()->viewport()->setPalette( palette );
m_tasksView->nativeWidget()->setSelectionMode(QAbstractItemView::SingleSelection);
m_tasksView->nativeWidget()->setDragEnabled(true);
m_tasksView->nativeWidget()->setAcceptDrops(true);
m_tasksView->nativeWidget()->viewport()->setAcceptDrops(true);
m_tasksView->nativeWidget()->setDropIndicatorShown(false);
m_tasksView->nativeWidget()->setDragDropMode(QAbstractItemView::DragDrop);
m_tasksView->nativeWidget()->setSortingEnabled(true);
m_tasksView->nativeWidget()->sortByColumn(0, Qt::AscendingOrder);
m_tasksView->nativeWidget()->expandAll();
connect(m_tasksView->nativeWidget(), SIGNAL(clicked(QModelIndex)), this, SLOT(showTaskEditor(QModelIndex)));
m_searchLine = new Plasma::LineEdit(this);
m_searchLine->nativeWidget()->setClearButtonShown(true);
m_searchLine->nativeWidget()->setClickMessage(i18n("Filter Tasks..."));
connect(m_searchLine->nativeWidget(), SIGNAL(textChanged(QString)), m_filterModel, SLOT(setFilterWildcard(QString)));
m_addTaskLine = new Plasma::LineEdit(this); // must wait for plasma theming (4.3?) to get a themed lineedit
m_addTaskLine->nativeWidget()->setClearButtonShown(true);
m_addTaskLine->nativeWidget()->setClickMessage(i18n("Create New Task..."));
connect(m_addTaskLine->nativeWidget(), SIGNAL(returnPressed(QString)), m_addTaskLine->nativeWidget(), SLOT(clear()));
connect(m_addTaskLine->nativeWidget(), SIGNAL(returnPressed(QString)), this, SLOT(createTask(QString)));
kDebug() << "Creating layout";
m_mainLayout = new QGraphicsLinearLayout(Qt::Vertical, m_graphicsWidget);
m_mainLayout->addItem(m_priorityLabel);
m_mainLayout->addItem(m_categoriesBar);
m_mainLayout->addItem(m_searchLine);
m_mainLayout->addItem(m_tasksView);
m_mainLayout->addItem(m_addTaskLine);
m_graphicsWidget->setLayout(m_mainLayout);
m_graphicsWidget->setMinimumSize(250, 300);
m_graphicsWidget->setPreferredSize(300, 500);
m_taskEditor = new TaskEditor(m_engine, m_tasksView);
m_taskEditor->hide();
connect(m_taskEditor, SIGNAL(requestDiscardChanges()), this, SLOT(onTaskEditorHide()));
connect(m_taskEditor, SIGNAL(requestSaveChanges()), this, SLOT(onTaskEditorHide()));
connect(m_taskEditor, SIGNAL(jobStarted(Plasma::ServiceJob*)), SLOT(busyUntil(Plasma::ServiceJob*)));
connect(m_taskEditor, SIGNAL(jobFinished(Plasma::ServiceJob*)), SLOT(jobFinished(Plasma::ServiceJob*)));
return m_graphicsWidget;
}
void RememberTheMilkPlasmoid::configChanged()
{
KConfigGroup cg = config();
m_token = cg.readEntry("token");
kDebug() << "Token from config: " << m_token;
if (m_token.isNull())
setConfigurationRequired(true, i18n("Authentication to Remember The Milk needed"));
else {
KConfigGroup cg = m_authService->operationDescription("AuthWithToken");
cg.writeEntry("token", m_token);
busyUntil(m_authService->startOperationCall(cg));
busyUntil(0); // Sets busy until we manually call jobFinished(0). Busy until first tasks refresh
}
QString sortBy = config().readEntry("SortBy").toLower();
kDebug() << "Config says sort by " << sortBy;
if (sortBy == "date" || sortBy == "due")
setSortBy(SortDue);
else if (sortBy == "priority")
setSortBy(SortPriority);
else
setSortBy(SortDue); // Default
}
#include "moc_rememberthemilk-plasmoid.cpp"

View file

@ -1,123 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
* Copyright 2012 Jeremy Whiting <jpwhiting@kde.org>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 REMEMBERTHEMILK_PLASMOID_H
#define REMEMBERTHEMILK_PLASMOID_H
#include <Plasma/PopupApplet>
#include <QGraphicsLinearLayout>
#include <QList>
#include "taskitem.h"
#include "taskeditor.h"
#include "taskitemdelegate.h"
#include "tasksortfilter.h"
class KJob;
namespace Plasma {
class TabBar;
class Label;
class LineEdit;
class TreeView;
class ServiceJob;
}
namespace Ui
{
class AuthWidget;
class GeneralWidget;
}
class TaskModel;
class RememberTheMilkPlasmoid : public Plasma::PopupApplet
{
Q_OBJECT
public:
RememberTheMilkPlasmoid(QObject *parent, const QVariantList &args);
~RememberTheMilkPlasmoid();
virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
QGraphicsWidget* graphicsWidget();
void init();
public slots:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void showTaskEditor(QModelIndex index);
void onTaskEditorHide();
void busyUntil(Plasma::ServiceJob *job);
void jobFinished(Plasma::ServiceJob* job);
void createConfigurationInterface(KConfigDialog *parent);
void configAccepted();
void configFinished();
void configChanged();
// Start the authentication process.
void startAuth();
// Got a url, so let the user do their part.
void authJobFinished(KJob* job);
// Continue authentication process.
void continueAuth();
void setSortBy(SortBy sortBy);
void listChanged(int pos);
void createTask(const QString &task);
private:
QString m_token;
QList<qulonglong> m_lists;
bool m_authenticated;
QList<Plasma::ServiceJob*> m_busyUntil;
SortBy m_sortBy;
TaskEditor *m_taskEditor;
Plasma::DataEngine *m_engine;
Plasma::Service *m_taskService;
Plasma::Label *m_priorityLabel;
Plasma::TabBar *m_categoriesBar;
Plasma::TreeView *m_tasksView;
Plasma::LineEdit *m_addTaskLine;
QGraphicsLinearLayout *m_mainLayout;
TaskModel *m_model;
TaskItemDelegate *m_delegate;
QGraphicsWidget *m_graphicsWidget;
Plasma::LineEdit *m_searchLine;
TaskSortFilter *m_filterModel;
Plasma::Service *m_authService;
Ui::AuthWidget *m_authWidgetUi;
QWidget *m_authWidget;
Ui::GeneralWidget *m_generalOptionsUi;
QWidget *m_generalOptions;
signals:
void authenticated();
};
// This links the .desktop file to the applet
K_EXPORT_PLASMA_APPLET(rtm, RememberTheMilkPlasmoid)
#endif // REMEMBERTHEMILK-PLASMOID_H

View file

@ -1,254 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "taskeditor.h"
#include "taskitem.h"
#include <KComboBox>
#include <KLocale>
#include <KLineEdit>
#include <KPushButton>
#include <KDebug>
#include <QPainter>
#include <QStringList>
#include <QDateTime>
#include <Plasma/Theme>
#include <Plasma/Animator>
#include <Plasma/Animation>
#include <Plasma/IconWidget>
#include <Plasma/Service>
TaskEditor::TaskEditor(Plasma::DataEngine* engine, QGraphicsWidget* parent)
: QGraphicsWidget(parent),
m_engine(engine),
m_service(0)
{
mainLayout = new QGraphicsGridLayout(this);
nameEdit = new Plasma::LineEdit(this);
dateEdit = new Plasma::LineEdit(this);
tagsEdit = new Plasma::LineEdit(this);
priorityEdit = new Plasma::ComboBox(this);
completeBox = new Plasma::CheckBox(this);
nameLabel = new Plasma::Label(this);
nameLabel->setText(i18n("Name:"));
dateLabel = new Plasma::Label(this);
dateLabel->setText(i18n("Due:"));
tagsLabel = new Plasma::Label(this);
tagsLabel->setText(i18n("Tags:"));
priorityLabel = new Plasma::Label(this);
priorityLabel->setText(i18n("Priority:"));
completeLabel = new Plasma::Label(this);
completeLabel->setText(i18n("Complete:"));
QStringList priorityStrings;
priorityStrings << i18n("Top Priority") << i18n("Medium Priority") << i18n("Low Priority") << i18n("No Priority");
priorityEdit->nativeWidget()->addItems(priorityStrings);
saveChangesButton = new Plasma::PushButton(this);
connect(saveChangesButton, SIGNAL(clicked()), this, SIGNAL(requestSaveChanges()));
connect(saveChangesButton, SIGNAL(clicked()), this, SLOT(saveChanges()));
discardChangesButton = new Plasma::PushButton(this);
connect(discardChangesButton, SIGNAL(clicked()), this, SIGNAL(requestDiscardChanges()));
connect(discardChangesButton, SIGNAL(clicked()), this, SLOT(discardChanges()));
saveChangesButton->setText(i18n("Update Task"));
saveChangesButton->nativeWidget()->setIcon(KIcon("dialog-ok-apply"));
discardChangesButton->setText(i18n("Discard Changes"));
discardChangesButton->nativeWidget()->setIcon(KIcon("dialog-cancel"));
mainLayout->addItem(nameLabel, 0, 0);
mainLayout->addItem(nameEdit, 0, 1);
mainLayout->addItem(dateLabel, 1, 0);
mainLayout->addItem(dateEdit, 1, 1);
mainLayout->addItem(tagsLabel, 2, 0);
mainLayout->addItem(tagsEdit, 2, 1);
mainLayout->addItem(priorityLabel, 3, 0);
mainLayout->addItem(priorityEdit, 3, 1);
mainLayout->addItem(completeLabel, 4, 0);
mainLayout->addItem(completeBox, 4, 1);
//mainLayout->setColumnStretchFactor(2, 1);
mainLayout->setRowStretchFactor(6, 1);
mainLayout->addItem(saveChangesButton, 7, 0, 1, 2);
mainLayout->addItem(discardChangesButton, 8, 0, 1, 2);
setLayout(mainLayout);
}
TaskEditor::~TaskEditor()
{
// Service is parented to the engine and is thus deleted automatically
}
void TaskEditor::keyPressEvent(QKeyEvent* event) {
kDebug() << event->key();
if (event->key() == Qt::Key_Escape) {
//emit requestDiscardChanges(); // Only works when in line edits... i.e. not good
//discardChanges();
}
QGraphicsItem::keyPressEvent(event);
}
void TaskEditor::setModelIndex(QModelIndex index) {
m_index = index.data(Qt::RTMTaskIdRole).toULongLong();
m_name = index.data(Qt::RTMNameRole).toString();
nameEdit->nativeWidget()->clear();
nameEdit->nativeWidget()->setText(m_name);
m_date = index.data(Qt::RTMDueRole).toDate().toString(Qt::DefaultLocaleShortDate); //FIXME: Allow times within a date
dateEdit->nativeWidget()->clear();
dateEdit->nativeWidget()->setText(m_date);
m_tags = index.data(Qt::RTMTagsRole).toStringList().join(", ");
tagsEdit->nativeWidget()->clear();
tagsEdit->nativeWidget()->setText(m_tags);
priorityEdit->nativeWidget()->setCurrentIndex((index.data(Qt::RTMPriorityRole).toInt()-1) % 4);
m_priority = priorityEdit->nativeWidget()->currentIndex();
completeBox->setChecked(index.data(Qt::RTMCompletedRole).toBool());
if (m_service)
m_service->deleteLater();
m_service = m_engine->serviceForSource("Task:" + QString::number(m_index));
connect(m_service, SIGNAL(finished(Plasma::ServiceJob*)), SIGNAL(jobFinished(Plasma::ServiceJob*)));
}
void TaskEditor::discardChanges() {
startAnimation(fullSize, false);
}
void TaskEditor::saveChanges() {
if (!m_service)
return; // No index (and hence no task) has been set, or something is really wrong.
if (m_name != nameEdit->text()) {
kDebug() << "Name Change: " << nameEdit->text();
KConfigGroup cg = m_service->operationDescription("setName");
cg.writeEntry("name", nameEdit->text());
emit jobStarted(m_service->startOperationCall(cg));
}
if (m_date != dateEdit->text()) {
kDebug() << "Date Change: " << dateEdit->text();
KConfigGroup cg = m_service->operationDescription("setDueText");
cg.writeEntry("dueText", dateEdit->text());
emit jobStarted(m_service->startOperationCall(cg));
}
if (m_tags != tagsEdit->text()) {
QStringList tags = tagsEdit->text().split(',');
KConfigGroup cg = m_service->operationDescription("setTags");
cg.writeEntry("tags", tags);
emit jobStarted(m_service->startOperationCall(cg));
}
if (priorityEdit->nativeWidget()->currentIndex() != m_priority) {
KConfigGroup cg = m_service->operationDescription("setPriority");
cg.writeEntry("priority", priorityEdit->nativeWidget()->currentIndex() + 1);
emit jobStarted(m_service->startOperationCall(cg));
}
if (completeBox->isChecked()) {
KConfigGroup cg = m_service->operationDescription("setCompleted");
cg.writeEntry("completed", true);
emit jobStarted(m_service->startOperationCall(cg));
}
startAnimation(fullSize, false);
}
void TaskEditor::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
Q_UNUSED(widget)
QColor wash = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
painter->setBrush(wash);
painter->setPen(QPen(Qt::NoPen));
painter->drawRect(option->exposedRect);
}
void TaskEditor::setFullSize(QSizeF size) {
fullSize = size;
resize(fullSize);
}
void TaskEditor::startAnimation(QSizeF endSize, bool show) {
appearing = show;
if (appearing)
foreach(QGraphicsItem* child, childItems())
child->show();
this->show();
fullSize = endSize;
resize(fullSize);
Plasma::Animation *animation = m_fadeAnimation.data();
if (!animation) {
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
animation->setTargetWidget(this);
animation->setProperty("startValue", 0.0);
animation->setProperty("endValue", 1.0);
animation->setProperty("duration", 100);
m_fadeAnimation = animation;
connect(animation, SIGNAL(finished()), this, SLOT(animationFinished()));
} else if (animation->state() == QAbstractAnimation::Running) {
animation->pause();
}
if (show) {
animation->setProperty("easingCurve", QEasingCurve::InQuad);
animation->setProperty("direction", QAbstractAnimation::Forward);
animation->start(QAbstractAnimation::KeepWhenStopped);
} else {
animation->setProperty("easingCurve", QEasingCurve::OutQuad);
animation->setProperty("direction", QAbstractAnimation::Backward);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
}
void TaskEditor::animationFinished() {
if (appearing) {
setPos(0, 0);
resize(fullSize);
}
else {
hide();
}
update();
}
#include "moc_taskeditor.cpp"

View file

@ -1,102 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 TASKEDITOR_H
#define TASKEDITOR_H
namespace Plasma {
class ServiceJob;
class Animation;
}
//#include <Plasma/Frame>
#include <Plasma/LineEdit>
#include <Plasma/ComboBox>
#include <Plasma/Label>
#include <Plasma/PushButton>
#include <Plasma/CheckBox>
#include <QGraphicsGridLayout>
#include <QGraphicsWidget>
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qsharedpointer.h>
class TaskEditor : public QGraphicsWidget
{
Q_OBJECT
public:
explicit TaskEditor(Plasma::DataEngine *engine, QGraphicsWidget *parent = 0);
~TaskEditor();
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
void setFullSize(QSizeF size);
void setModelIndex(QModelIndex index);
protected:
void keyPressEvent(QKeyEvent* event);
signals:
void requestSaveChanges();
void requestDiscardChanges();
void jobStarted(Plasma::ServiceJob *job);
void jobFinished(Plasma::ServiceJob *job);
public slots:
void startAnimation(QSizeF endSize, bool show = true);
void animationFinished();
protected slots:
void saveChanges();
void discardChanges();
private:
Plasma::DataEngine *m_engine;
qulonglong m_index;
QGraphicsGridLayout *mainLayout;
Plasma::Label *nameLabel;
Plasma::LineEdit *nameEdit;
Plasma::Label *dateLabel;
Plasma::LineEdit *dateEdit;
Plasma::Label *tagsLabel;
Plasma::LineEdit *tagsEdit;
Plasma::Label *priorityLabel;
Plasma::ComboBox *priorityEdit;
Plasma::Label *completeLabel;
Plasma::CheckBox *completeBox;
Plasma::PushButton *saveChangesButton;
Plasma::PushButton *discardChangesButton;
bool appearing; // used to know which direction to go in for the animation
QSizeF fullSize;
QString m_name;
QString m_date;
QString m_tags;
int m_priority;
Plasma::Service* m_service;
QWeakPointer<Plasma::Animation> m_fadeAnimation;
};
#endif // TASKEDITOR_H

View file

@ -1,53 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "taskitem.h"
#include <KDebug>
TaskItem::TaskItem()
{
setData(RTMTaskItem, Qt::RTMItemType);
}
bool TaskItem::operator<(const QStandardItem& other) const {
return (data(Qt::RTMSortRole).toInt() < other.data(Qt::RTMSortRole).toInt());
}
int TaskItem::type() const {
return RTMTaskItem; // FIXME: Use the Qt macro to grab an unused number per app
}
HeaderItem::HeaderItem(RTMItemType type)
{
setData(type, Qt::RTMItemType);
m_type = type;
}
bool HeaderItem::operator<(const QStandardItem& other) const {
return (data(Qt::RTMSortRole).toInt() <= other.data(Qt::RTMSortRole).toInt()); // <= intentional. Allows PriorityItems to be above other items
}
int HeaderItem::type() const {
return m_type;
}

View file

@ -1,73 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 TASKITEM_H
#define TASKITEM_H
#include <QGraphicsWidget>
#include <QtGui/qstandarditemmodel.h>
#include <Plasma/Theme>
#include <Plasma/Svg>
namespace Qt
{
enum ItemUserDataRole {
RTMSortRole = 64,
RTMTaskIdRole = 65,
RTMPriorityRole = 66,
RTMNameRole = 67,
RTMTagsRole = 68,
RTMDueRole = 69,
RTMTimeTRole = 70,
RTMCompletedRole = 71,
RTMItemType = 72
};
}
enum RTMItemType {
RTMTaskItem = 1001,
RTMPriorityHeader = 1002,
RTMDateHeader = 1003
};
enum RTMSortType {
RTMSortByPriority,
RTMSortByDate
};
class TaskItem : public QStandardItem
{
public:
TaskItem();
virtual bool operator<( const QStandardItem & other ) const;
virtual int type() const;
};
class HeaderItem : public QStandardItem
{
public:
HeaderItem(RTMItemType type);
virtual bool operator<(const QStandardItem& other) const;
virtual int type() const;
private:
RTMItemType m_type;
};
#endif // TASKITEM_H

View file

@ -1,308 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "taskitemdelegate.h"
#include "taskeditor.h"
#include <QApplication>
#include <Plasma/Theme>
#include <Plasma/Svg>
#include <QColor>
#include <QBrush>
#include <QCheckBox>
#include <QDateTime>
#include <KDebug>
const qreal TaskItemDelegate::MARGIN = 1.0;
const qreal TaskItemDelegate::MARGINH = 6.0;
const qreal TaskItemDelegate::COLORTAB = MARGIN*6;
// These colors are hardcoded because they represent priorities and need to be the same for visual recognition purposes.
const QColor TaskItemDelegate::priority1 = QColor(255, 123, 0); // reddish-orange
const QColor TaskItemDelegate::priority2 = QColor(0, 132, 255); // Darker blue
const QColor TaskItemDelegate::priority3 = QColor(53, 201, 255); // Ligher Blue
const QColor TaskItemDelegate::priorityNone = QColor(241, 241, 241); // Almost white
const QString TaskItemDelegate::tagsPrefix = i18n("Tags: ");
TaskItemDelegate::TaskItemDelegate(QObject *parent)
: QStyledItemDelegate(parent),
dragging(false)
{
setSmallTasks(false);
}
void TaskItemDelegate::setSmallTasks(bool small)
{
smallTasks = small;
leftMargin = small ? 0 : MARGIN;
}
bool TaskItemDelegate::eventFilter(QObject* object, QEvent* event) {
if (event->type() == QEvent::DragMove)
dragging = true;
if (event->type() == QEvent::Drop || QEvent::DragLeave)
dragging = false;
return QStyledItemDelegate::eventFilter(object, event);
}
QColor TaskItemDelegate::itemPriorityColor(const QModelIndex &index) const
{
switch (index.data(Qt::RTMPriorityRole).toInt()) { // Set color based on priority
case 1:
return priority1;
case 2:
return priority2;
case 3:
return priority3;
case 4:
return priorityNone;
}
return QColor();
}
void TaskItemDelegate::paintDueHeader(QPainter* painter, const QRectF& rect, const QModelIndex &index) const
{
painter->save();
QFontMetrics fm = QApplication::fontMetrics();
QString dueString = index.data(Qt::DisplayRole).toString();
QLinearGradient gradient(rect.bottomLeft(), rect.bottomRight());
gradient.setColorAt(0, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
gradient.setColorAt((qreal)(0.9*fm.width(dueString)+2*MARGIN)/rect.width(), Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
gradient.setColorAt((qreal)(1.3*fm.width(dueString)+2*MARGIN)/rect.width(), Qt::transparent);
painter->setBrush(Qt::NoBrush);
painter->setPen(QPen(QBrush(gradient), 1));
painter->drawLine(rect.bottomLeft()+QPoint(0, -MARGIN), rect.bottomRight()+QPoint(0, -MARGIN));
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
painter->drawText(rect.bottomLeft()+QPoint(MARGIN, -2*MARGIN) ,dueString);
painter->restore();
}
void TaskItemDelegate::paintPriorityHeader(QPainter* painter, const QRectF& rect, const QModelIndex &index) const
{
painter->save();
//Draw colored gradient as priority background
QLinearGradient gradient(rect.topLeft(), rect.bottomRight());
gradient.setColorAt(0, itemPriorityColor(index));
gradient.setColorAt(1, Qt::transparent);
int h = QApplication::fontMetrics().height();
QPainterPath path;
path.moveTo(rect.bottomLeft());
path.quadTo(rect.bottomLeft()+QPointF(0, -h), rect.bottomLeft()+QPointF(2, -h));
path.lineTo(rect.bottomRight()-QPointF(2, h));
path.quadTo(rect.bottomRight()+QPointF(0, -h), rect.bottomRight());
painter->setBrush(Qt::NoBrush);
QPen thickPen(itemPriorityColor(index));
thickPen.setWidth(2);
painter->setPen(thickPen);
painter->drawPath(path);
// Draw priority text
QString priority = index.data(Qt::DisplayRole).toString();
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
painter->setBrush(Qt::NoBrush);
painter->drawText(rect.bottomLeft()+QPoint(MARGIN, -2*MARGIN) ,priority);
painter->restore();
}
void TaskItemDelegate::paintTask(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex& index) const
{
QRect rect = option.rect;
QFontMetrics fm = QApplication::fontMetrics();
// Painting Order:
// Background wash
// Mouseover highlight
// Priority Tab on left
// Bounding Box
// Task name
// If not small, other task information
painter->save();
if (smallTasks) { // Paint the background for a small task
painter->save();
painter->setOpacity(0.5);
painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
painter->setPen(Qt::NoPen);
painter->drawRoundedRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3);
painter->restore();
}
else { // Paint the background for a two row task
painter->save();
painter->setOpacity(0.5);
painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
painter->drawRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN));
painter->restore();
painter->drawRect(QRectF(option.rect.topLeft()+QPointF(leftMargin, MARGIN), option.rect.bottomLeft()+QPointF(COLORTAB, -MARGIN)));
}
if (option.state & QStyle::State_MouseOver) {
painter->save();
painter->setBrush(Plasma::Theme::defaultTheme()->color(Plasma::Theme::HighlightColor));
painter->setPen(Qt::NoPen);
if (smallTasks)
painter->drawRoundedRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3);
else
painter->drawRect(rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN));
painter->restore();
}
//Paint Priority tab on the left
painter->setPen(Qt::NoPen);
painter->setBrush(itemPriorityColor(index));
painter->drawRoundedRect(QRectF(option.rect.topLeft()+QPointF(leftMargin, MARGIN), option.rect.bottomLeft()+QPointF(COLORTAB, 0)), 3, 3);
// Draw Bounding rect/box
painter->save();
painter->setOpacity(.5);
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
painter->setBrush(Qt::NoBrush);
if (smallTasks)
painter->drawRoundedRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN), 3, 3);
else
painter->drawRect(option.rect.adjusted(leftMargin, MARGIN, -MARGIN, -MARGIN));
painter->restore();
// Draw Task information
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
QString task = index.data(Qt::RTMNameRole).toString();
QString due = index.data(Qt::RTMDueRole).toDate().toString("MMM d");
QString tags = index.data(Qt::RTMTagsRole).toStringList().join(", ");
if (!tags.isEmpty())
tags.prepend(tagsPrefix);
QFont font = painter->font();
font.setPointSize(font.pointSize());
QFontMetrics largerFM(font);
QDate date = index.data(Qt::RTMDueRole).toDate();
if (smallTasks && date.isValid() && date < QDate::currentDate()) {
// Elide (text with dots like th...) if wider than view and draw
font.setBold(true);
QFontMetrics boldLargerFM(font);
due = due.append(" "); // So that we have a space after the date before the task name
task = largerFM.elidedText(task, Qt::ElideRight, option.rect.width()-COLORTAB-3*MARGIN - boldLargerFM.width(due));
painter->setFont(font);
painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+MARGIN,largerFM.height()),due);
font.setBold(false);
painter->setFont(font);
painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+3*MARGIN + boldLargerFM.width(due),boldLargerFM.height()),task);
}
else {
// Elide (text with dots like th...) if wider than view and draw
task = largerFM.elidedText(task, Qt::ElideRight, option.rect.width()-COLORTAB-3*MARGIN);
painter->setFont(font);
painter->drawText(option.rect.topLeft()+QPoint(COLORTAB+MARGIN,largerFM.height()),task);
}
if (smallTasks) {
painter->restore();
return;
}
// Set our smaller attributes and blue hue for additional text
font.setPointSize(font.pointSize()-1);
font.setItalic(true);
painter->setFont(font);
fm = QFontMetrics(font);
QColor moreText(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
qreal red = moreText.redF();
qreal green = moreText.greenF();
qreal blue = moreText.blueF();
qreal colorChangeMult = 0.85;
if (blue < colorChangeMult)
blue /= colorChangeMult;
else {
red *= colorChangeMult;
green *= colorChangeMult;
}
moreText.setRgbF(red, green, blue);
painter->setPen(moreText);
// Elide the due from the front because "Due on" isn't necessary
due = fm.elidedText(due, Qt::ElideLeft, option.rect.width() - COLORTAB+3*MARGIN - fm.width(tags));
painter->drawText(option.rect.bottomLeft()+QPoint(COLORTAB+MARGIN, -MARGINH), tags);
painter->drawText(option.rect.bottomRight()+QPoint(-COLORTAB+MARGIN-fm.width(due), -MARGINH), due);
painter->restore();
}
void TaskItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
switch (index.data(Qt::RTMItemType).toInt()) {
case RTMPriorityHeader:
paintPriorityHeader(painter, option.rect, index);
break;
case RTMDateHeader:
paintDueHeader(painter, option.rect, index);
break;
case RTMTaskItem:
paintTask(painter, option, index);
break;
}
}
QSize TaskItemDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(option)
if (smallTasks || index.data(Qt::RTMItemType).toInt() != RTMTaskItem) {
QString priority = index.data(Qt::DisplayRole).toString();
QSize size;
if (index.data(Qt::RTMItemType).toInt() == RTMDateHeader)
size.setHeight(QApplication::fontMetrics().height()+MARGINH*1.5);
else
size.setHeight(QApplication::fontMetrics().height()+MARGINH);
size.setWidth(QApplication::fontMetrics().width(priority));
return size;
}
else {
QString task = index.data(Qt::RTMNameRole).toString();
QString due = index.data(Qt::RTMDueRole).toDate().toString("MMM d");
QString tags = index.data(Qt::RTMTagsRole).toStringList().join(", ");
if (!tags.isEmpty())
tags.prepend(tagsPrefix);
//QSize size = QStyledItemDelegate::sizeHint(option, index);
QSize size;
size.setHeight(MARGINH + MARGINH + QApplication::fontMetrics().height()*2);
size.setWidth(MARGIN + MARGIN + QApplication::fontMetrics().width(task+due));
return size;
}
}

View file

@ -1,66 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 TASKITEMDELEGATE_H
#define TASKITEMDELEGATE_H
#include <QPainter>
#include <QtGui/qstyleoption.h>
#include <QStyledItemDelegate>
#include <QtCore/qabstractitemmodel.h>
#include "taskitem.h"
class TaskItemDelegate : public QStyledItemDelegate
{
public:
TaskItemDelegate(QObject *parent = 0);
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
virtual QSize sizeHint (const QStyleOptionViewItem &option,
const QModelIndex &index) const;
virtual bool eventFilter(QObject* object, QEvent* event);
void setSmallTasks(bool small);
void paintTask(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paintPriorityHeader(QPainter* painter, const QRectF &rect, const QModelIndex &index) const;
void paintDueHeader(QPainter* painter, const QRectF &rect, const QModelIndex &index) const;
QColor itemPriorityColor(const QModelIndex &index) const;
static const qreal MARGIN;
static const qreal MARGINH;
static const qreal COLORTAB;
static const QString tagsPrefix;
static const QColor priority1;
static const QColor priority2;
static const QColor priority3;
static const QColor priorityNone;
protected:
bool dragging;
bool smallTasks;
qreal leftMargin;
};
#endif // TASKITEMDELEGATE_H

View file

@ -1,328 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "taskmodel.h"
#include "taskitem.h"
#include <QMimeData>
#include <KDebug>
#include <limits.h>
#include <QDateTime>
#include <Plasma/Service>
TaskModel::TaskModel(Plasma::DataEngine* e, QObject* parent)
: QStandardItemModel(parent),
engine(e),
dropType(SortPriority)
{
currentListIndex = 0;
rootitem = invisibleRootItem();
refreshToplevel();
}
TaskModel::~TaskModel() {
}
void TaskModel::setDropType(SortBy dropType)
{
this->dropType = dropType;
}
void TaskModel::dayChanged()
{
QDateTime nextMidnight = QDateTime(QDate::currentDate().addDays(1));
int secsUntilMidnight = QDateTime::currentDateTime().secsTo(nextMidnight);
midnightAlarm.setInterval(1000*secsUntilMidnight+5000); // 5 secs over to ensure we're not under
midnightAlarm.start();
m_dateItems.at(0)->setData(0, Qt::RTMTimeTRole); // Overdue
m_dateItems.at(0)->setData(0, Qt::RTMSortRole);
m_dateItems.at(1)->setData(QDateTime(QDate::currentDate()).toTime_t(), Qt::RTMTimeTRole); // Today
m_dateItems.at(1)->setData(QDateTime(QDate::currentDate()).toTime_t(), Qt::RTMSortRole);
m_dateItems.at(2)->setData(QDateTime(QDate::currentDate()).addDays(1).toTime_t(), Qt::RTMTimeTRole); // Tomorrow
m_dateItems.at(2)->setData(QDateTime(QDate::currentDate()).addDays(1).toTime_t(), Qt::RTMSortRole);
m_dateItems.at(3)->setData(QDateTime(QDate::currentDate()).addDays(2).toTime_t(), Qt::RTMTimeTRole); // Past Tomorrow/Never
m_dateItems.at(3)->setData(QDateTime(QDate::currentDate()).addDays(2).toTime_t(), Qt::RTMSortRole);
emit modelUpdated();
}
void TaskModel::refreshToplevel()
{
m_priorityItems.clear();
m_dateItems.clear();
rootitem->removeRows(0, rootitem->rowCount()); // FIXME: Crash candidate?
QStringList priorityStrings;
priorityStrings.append(i18n("Top Priority:"));
priorityStrings.append(i18n("Medium Priority:"));
priorityStrings.append(i18n("Low Priority:"));
priorityStrings.append(i18n("No Priority:"));
QStringList dateStrings;
dateStrings.append(i18n("Overdue"));
dateStrings.append(i18n("Today"));
dateStrings.append(i18n("Tomorrow"));
dateStrings.append(i18n("Anytime")); //FIXME: STRINGFREEZE: Consider a change to 'Later'
for(int i=0;i<4;i++) {
HeaderItem *priority = new HeaderItem(RTMPriorityHeader);
priority->setData(i+1, Qt::RTMPriorityRole);
priority->setData(i+1, Qt::RTMSortRole); // Put it in both places so both the coloring and the sorting work
priority->setData(priorityStrings.at(i), Qt::DisplayRole);
priority->setEditable(false);
m_priorityItems.append(priority);
rootitem->insertRow(rootitem->rowCount(), priority);
HeaderItem *date = new HeaderItem(RTMDateHeader);
date->setData(dateStrings.at(i), Qt::DisplayRole);
date->setEditable(false);
m_dateItems.append(date);
rootitem->insertRow(rootitem->rowCount(), date);
}
dayChanged();
connect(&midnightAlarm, SIGNAL(timeout()), SLOT(dayChanged()));
}
QFlags< Qt::DropAction > TaskModel::supportedDropActions() const {
//kDebug() << "TaskModel::supportedDropActions()";
return Qt::MoveAction;
}
QFlags< Qt::ItemFlag > TaskModel::flags(const QModelIndex& index) const {
Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index);
if (defaultFlags.testFlag(Qt::ItemIsDragEnabled))
defaultFlags ^= Qt::ItemIsDragEnabled; // bitwise xor, i.e. remove this flag if it is there.
if (index.data(Qt::RTMItemType).toInt() != RTMTaskItem) //header item
return Qt::ItemIsDropEnabled | defaultFlags;
else
return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
}
QStringList TaskModel::mimeTypes() const {
QStringList types;
types << "application/vnd.text.list";
return types;
}
QMimeData* TaskModel::mimeData(const QList< QModelIndex >& indexes) const {
kDebug() << "TaskModel::mimeData";
QMimeData *mimeData = new QMimeData();
QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly);
foreach(const QModelIndex &index, indexes)
if (index.isValid())
stream << index.data(Qt::RTMTaskIdRole).toString();
mimeData->setData("application/vnd.text.list", encodedData);
return mimeData;
}
bool TaskModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) {
Q_UNUSED(row);
if (action == Qt::IgnoreAction)
return true;
if (!data->hasFormat("application/vnd.text.list"))
return false;
if (column > 0)
return false;
RTMItemType dropHeaderType;
if (dropType == SortDue)
dropHeaderType = RTMDateHeader;
else if (dropType == SortPriority)
dropHeaderType = RTMPriorityHeader;
else
dropHeaderType = RTMDateHeader; // default it
QModelIndex parentItem = parent;
while (parentItem.data(Qt::RTMItemType).toInt() != dropHeaderType && parentItem.row() >= 0)
parentItem = index(parentItem.row()-1, 0, rootitem->index()); // This is buggy. going up rows doesn't always give the right headers...
kDebug() << parentItem.data(Qt::RTMItemType).toInt();
QByteArray encodedData = data->data("application/vnd.text.list");
QDataStream stream(&encodedData, QIODevice::ReadOnly);
QStringList newItems;
int rows = 0;
while (!stream.atEnd()) {
QString text;
stream >> text;
newItems << text;
++rows;
}
//int beginRow = rowCount(priorityParent);
foreach(const QString &id, newItems) {
if (m_taskItems.contains(id.toULongLong())) {
TaskItem *item = taskFromId(id.toULongLong());
if (item) {
Plasma::Service *service = engine->serviceForSource("Task:" + id);
connect(service, SIGNAL(finished(Plasma::ServiceJob*)), SIGNAL(jobFinished(Plasma::ServiceJob*)));
if (service) {
if (dropType == SortDue) {
QDate headerDate = QDateTime::fromTime_t(parentItem.data(Qt::RTMTimeTRole).toUInt()).date();
kDebug() << headerDate;
if (headerDate < QDate::currentDate())
headerDate = QDate::currentDate().addDays(-1); // set to due yesterday
else if (headerDate == QDate::currentDate().addDays(2)) // set to due never
headerDate = QDate();
kDebug() << "Setting Item to be due: " << headerDate.toString(Qt::SystemLocaleShortDate);
KConfigGroup cg = service->operationDescription("setDueText");
cg.writeEntry("dueText", headerDate.toString(Qt::SystemLocaleShortDate));
emit jobStarted(service->startOperationCall(cg));
}
else if (dropType == SortPriority) {
kDebug() << "Setting Item to priority: " << parentItem.data(Qt::RTMPriorityRole).toInt();
KConfigGroup cg = service->operationDescription("setPriority");
cg.writeEntry("priority", parentItem.data(Qt::RTMPriorityRole).toInt());
emit jobStarted(service->startOperationCall(cg));
}
}
}
}
}
return false; // We don't actually process the drop right now. We just send off the request and let the library->dataengine->plasmoid take care of it.
}
TaskItem* TaskModel::taskFromId(qulonglong id) {
if (m_taskItems.contains(id))
return m_taskItems.value(id);
TaskItem *item = new TaskItem();
item->setEditable(false); // We override the normal Qt editing structure because we provide TaskEditor overlay
m_taskItems.insert(id, item);
return item;
}
ListItem* TaskModel::listFromId(qulonglong id) {
if (m_listItems.contains(id))
return m_listItems.value(id);
ListItem *item = new ListItem();
m_listItems.insert(id, item);
listUpdate(id);
return item;
}
void TaskModel::listUpdate(qulonglong listId)
{
if (!m_listItems.contains(listId)) {
engine->connectSource("List:" + QString::number(listId), this);
}
else {
foreach(const qulonglong &taskid, m_listItems.value(listId)->tasks) {
engine->connectSource("Task:" + QString::number(taskid), this);
}
}
}
void TaskModel::switchToList(qulonglong listId) {
m_currentList = listId;
emit listSwitched(listId);
emit modelUpdated();
}
const ListItem* TaskModel::currentList() {
return listFromId(m_currentList);
}
void TaskModel::dataUpdated(const QString& name, const Plasma::DataEngine::Data& data) {
//kDebug() << name;
if (name.startsWith(QLatin1String("List:"))) {
//kDebug() << data.value("id");
qulonglong id = data.value("id").toULongLong();
if (id == 0)
return;
ListItem *item = listFromId(id);
item->id = id;
item->name = data.value("name").toString();
item->smart = data.value("smart").toBool();
item->tasks.clear();
foreach(const QString &key, data.keys()) {
if (key != "id" && key != "name" && key != "smart")
item->tasks.append(key.toULongLong());
}
if (!item->tasks.count()) {
kDebug() << "No tasks for: " << item->name << item->id << data.keys() << item->tasks;
}
if (id == m_currentList)
switchToList(m_currentList);
}
else if (name.startsWith(QLatin1String("Task:"))) {
qulonglong id = data.value("id").toULongLong();
if (id == 0) // Seems to happen when multiple applets are running
return;
TaskItem *item = taskFromId(id);
item->setData(data.value("id"), Qt::RTMTaskIdRole);
item->setData(data.value("priority"), Qt::RTMPriorityRole);
item->setData(data.value("name"), Qt::RTMNameRole);
item->setData(data.value("tags"), Qt::RTMTagsRole);
item->setData(data.value("due"), Qt::RTMDueRole);
item->setData(data.value("isCompleted"), Qt::RTMCompletedRole);
QDateTime due = data.value("due").toDateTime();
if (due.isValid())
item->setData(due.toTime_t(), Qt::RTMTimeTRole);
else
item->setData(UINT_MAX, Qt::RTMTimeTRole);
//item->setData(data.value("priority"), Qt::RTMSortRole);
if (item->parent()) {
item->parent()->takeRow(item->row());
}
insertTask(id);
}
else {
kDebug() << "Error, unknown source: " << name;
}
emit modelUpdated();
}
void TaskModel::insertTask(qulonglong taskid)
{
TaskItem *task = taskFromId(taskid);
if (!task->model())
rootitem->insertRow(rootitem->rowCount(), task);
}
#include "moc_taskmodel.cpp"

View file

@ -1,91 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 RTM_TASKMODEL_H
#define RTM_TASKMODEL_H
#include <QTimer>
#include <QStandardItemModel>
#include <Plasma/DataEngine>
#include "tasksortfilter.h"
namespace Plasma {
class ServiceJob;
}
class TaskItem;
struct ListItem {
qulonglong id;
bool smart;
QString name;
QList<qulonglong> tasks;
};
class TaskModel : public QStandardItemModel
{
Q_OBJECT
public:
explicit TaskModel(Plasma::DataEngine *engine, QObject *parent=0);
QFlags< Qt::DropAction > supportedDropActions() const;
QFlags< Qt::ItemFlag > flags(const QModelIndex& index) const;
QStringList mimeTypes() const;
QMimeData* mimeData(const QList< QModelIndex >& indexes) const;
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
void setDropType(SortBy dropType);
void listUpdate(qulonglong listId);
void switchToList(qulonglong listId);
const ListItem* currentList();
~TaskModel();
public slots:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void dayChanged();
signals:
void listSwitched(qulonglong listId);
void modelUpdated();
void jobStarted(Plasma::ServiceJob *job);
void jobFinished(Plasma::ServiceJob *job);
protected:
void refreshToplevel();
void insertTask(qulonglong task);
QMap<qulonglong, TaskItem*> m_taskItems;
QMap<qulonglong, ListItem*> m_listItems;
int currentListIndex;
QList<QStandardItem*> m_priorityItems;
QList<QStandardItem*> m_dateItems;
QStandardItem *rootitem;
qulonglong m_currentList;
Plasma::DataEngine *engine;
SortBy dropType;
private:
QTimer midnightAlarm;
TaskItem* taskFromId(qulonglong id);
ListItem* listFromId(qulonglong id);
};
#endif // RTM_TASKMODEL_H

View file

@ -1,170 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "tasksortfilter.h"
#include "taskitem.h"
#include "taskmodel.h"
#include <KDebug>
#include <QDateTime>
TaskSortFilter::TaskSortFilter(TaskModel *model, QObject* parent)
: QSortFilterProxyModel(parent),
m_model(model),
filterOn(All),
sortBy(SortPriority)
{
setSourceModel(model);
setDynamicSortFilter(true);
setFilterCaseSensitivity(Qt::CaseInsensitive);
}
void TaskSortFilter::listChanged()
{
invalidate();
}
void TaskSortFilter::setSortBy(SortBy sortBy)
{
if (this->sortBy == sortBy)
return;
this->sortBy = sortBy;
invalidate();
emit layoutChanged();
}
bool TaskSortFilter::lessThan(const QModelIndex& left, const QModelIndex& right) const
{
uint leftTime = sourceModel()->data(left, Qt::RTMTimeTRole).toUInt();
uint rightTime = sourceModel()->data(right, Qt::RTMTimeTRole).toUInt();
int leftPriority = sourceModel()->data(left, Qt::RTMPriorityRole).toInt();
int rightPriority = sourceModel()->data(right, Qt::RTMPriorityRole).toInt();
if (sortBy == SortDue) {
if (sourceModel()->data(left, Qt::RTMItemType).toInt() == RTMPriorityHeader)
return leftTime <= rightTime;
else if (leftTime == rightTime)
return leftPriority < rightPriority; // Subsort by priority
else
return leftTime < rightTime;
}
else if (sortBy == SortPriority) {
if (left.data(Qt::RTMItemType).toInt() != RTMTaskItem)
return leftPriority <= rightPriority;
else if (leftPriority == rightPriority)
return leftTime < rightTime; // Subsort by time
else
return leftPriority < rightPriority;
}
kDebug() << "Returning default";
return TaskSortFilter::lessThan(left, right);
}
bool TaskSortFilter::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const {
Q_UNUSED(source_column)
Q_UNUSED(source_parent)
return true;
}
bool TaskSortFilter::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const {
QModelIndex item = sourceModel()->index(source_row, 0, source_parent);
if (item.data(Qt::RTMItemType).toInt() == RTMPriorityHeader) { //Priority header
return sortBy == SortPriority ? true : false; // same as an if (condition) true; else false; structure;
}
if (item.data(Qt::RTMItemType).toInt() == RTMDateHeader) {
return sortBy == SortDue ? true : false;
}
const ListItem *currentList = m_model->currentList();
if (!currentList->tasks.contains(item.data(Qt::RTMTaskIdRole).toULongLong()))
return false;
if (item.data(Qt::RTMCompletedRole).toBool())
return false;
if (item.isValid()) {
switch (filterOn) {
case Tags:
foreach(const QString &tag, item.data(Qt::RTMTagsRole).toStringList()) {
if (tag.contains(filterRegExp()))
return true;
}
break;
case Name:
if (item.data(Qt::RTMNameRole).toString().contains(filterRegExp()))
return true;
break;
case Due:
if (item.data(Qt::RTMDueRole).toDateTime().toString(Qt::LocalDate).contains(filterRegExp()))
return true;
break;
case All:
if ((item.data(Qt::RTMNameRole).toString().contains(filterRegExp())) ||
(item.data(Qt::RTMDueRole).toDateTime().toString(Qt::LocalDate).contains(filterRegExp()))
)
return true;
foreach(const QString &tag, item.data(Qt::RTMTagsRole).toStringList()) {
if (tag.contains(filterRegExp()))
return true;
}
break;
}
}
return false;
}
void TaskSortFilter::setFilterWildcard(QString pattern) {
if (pattern.startsWith(QLatin1String("tag:"))) {
pattern.remove("tag:");
filterOn = Tags;
}
else if (pattern.startsWith(QLatin1String("task:"))) {
pattern.remove("task:");
filterOn = Name;
}
else if (pattern.startsWith(QLatin1String("name:"))) {
pattern.remove("name:");
filterOn = Name;
}
else if (pattern.startsWith(QLatin1String("date:"))) {
pattern.remove("date:");
filterOn = Due;
}
else if (pattern.startsWith(QLatin1String("due:"))) {
pattern.remove("due:");
filterOn = Due;
}
else
filterOn = All;
QSortFilterProxyModel::setFilterWildcard(pattern);
}

View file

@ -1,51 +0,0 @@
/*
* Copyright 2009 Andrew Stromme <astromme@chatonka.com>
*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 RTM_TASKSORTFILTER_H
#define RTM_TASKSORTFILTER_H
class TaskModel;
#include <QSortFilterProxyModel>
enum FilterOn { All, Name, Tags, Due };
enum SortBy { SortDue = 0, SortPriority = 1 };
class TaskSortFilter : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit TaskSortFilter(TaskModel* model, QObject* parent = 0);
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
bool filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
void setSortBy(SortBy sortBy);
public slots:
void setFilterWildcard(QString filter);
void listChanged();
private:
TaskModel *m_model;
FilterOn filterOn;
SortBy sortBy;
};
#endif

View file

@ -1,21 +0,0 @@
project(webslice)
include_directories( ${QT_INCLUDES} )
set(webslice_SRCS
main.cpp
kgraphicswebslice.cpp
kwebslice.cpp
)
add_executable(webslice ${webslice_SRCS})
target_link_libraries(webslice
${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTWEBKIT_LIBRARY}
${QT_QTSCRIPT_LIBRARY}
)
add_subdirectory(plasma)

View file

@ -1,294 +0,0 @@
/*
* Copyright 2009-2011 by Sebastian Kügler <sebas@kde.org>
* Copyright 2009 by Richard Moore <rich@kde.org>
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "kgraphicswebslice.h"
#include <qdebug.h>
#include <QtGui/qgraphicssceneevent.h>
#include <qgraphicswebview.h>
#include <qlabel.h>
#include <qtimer.h>
#include <qwebelement.h>
#include <qwebpage.h>
#include <qwebframe.h>
#include <qboxlayout.h>
struct KGraphicsWebSlicePrivate
{
QString selector;
QRectF sliceGeometry;
QRectF originalGeometry;
QString loadingText;
QTimer* resizeTimer;
QSizeF resizeNew;
QRectF previewRect;
bool previewMode;
QColor previewMaskColor;
QSize fullContentSize;
QWebElementCollection elementCache;
QHash<uint, QRect> selectorGeometry;
QRect documentGeometry;
};
KGraphicsWebSlice::KGraphicsWebSlice( QGraphicsWidget *parent )
: QGraphicsWebView( parent )
{
d = new KGraphicsWebSlicePrivate;
d->originalGeometry = QRectF();
d->fullContentSize = QSize(1024,768);
d->previewMaskColor = QColor("black");
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finishedLoading(bool)));
d->resizeTimer = new QTimer(this);
d->resizeTimer->setInterval(100);
d->resizeTimer->setSingleShot(true);
d->resizeNew = QSizeF();
connect(d->resizeTimer, SIGNAL(timeout()), SLOT(resizeTimeout()));
//resize(300, 300);
}
KGraphicsWebSlice::~KGraphicsWebSlice()
{
delete d;
}
void KGraphicsWebSlice::loadSlice(const QUrl &u, const QString &selector)
{
if ( d->selector == selector && url() == u) {
return;
}
setElement(selector);
if (url() != u) {
QGraphicsWebView::load(u);
}
setZoomFactor(1.0);
}
void KGraphicsWebSlice::setLoadingText(const QString &html)
{
d->loadingText = html;
}
void KGraphicsWebSlice::setElement(const QString &selector)
{
d->selector = selector;
}
void KGraphicsWebSlice::setSliceGeometry(const QRectF geo)
{
d->sliceGeometry = geo;
}
void KGraphicsWebSlice::finishedLoading(bool ok)
{
if (!ok) {
return;
}
// Normalize page
qDebug() << "loading finished" << ok << ", updating cache then slice or preview";
QWebFrame *frame = page()->mainFrame();
frame->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
frame->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
page()->setPreferredContentsSize(d->fullContentSize);
// Update geometry caches
updateElementCache();
// Zoom to slice or preview
refresh();
}
void KGraphicsWebSlice::refresh()
{
// TODO: optimize for non-changes
if (!d->previewMode) {
showSlice(d->selector);
} else {
showPage();
}
}
void KGraphicsWebSlice::updateElementCache()
{
qDebug() << "updateElementCache()";
d->elementCache = page()->mainFrame()->findAllElements("*");
d->documentGeometry = page()->mainFrame()->documentElement().geometry();
foreach(const QWebElement &el, d->elementCache) {
d->selectorGeometry[qHash(el.toOuterXml())] = el.geometry();
}
}
QRectF KGraphicsWebSlice::previewGeometry(const QString &selector) const
{
return QRectF(page()->mainFrame()->findFirstElement(selector).geometry());
}
QRectF KGraphicsWebSlice::sliceGeometry(const QString &selector) const
{
QWebElement el = page()->mainFrame()->findFirstElement(selector);
return d->selectorGeometry.value(qHash(el.toOuterXml()));
}
void KGraphicsWebSlice::resizeEvent ( QGraphicsSceneResizeEvent * event )
{
setTiledBackingStoreFrozen(true);
d->resizeNew = event->newSize();
d->resizeTimer->start();
event->accept();
}
void KGraphicsWebSlice::resizeTimeout()
{
QSizeF n = d->resizeNew;
// Prevent oopses.
if (n.width() > 2400 || n.height() > 2400) {
qDebug() << "giant size, what's going on???????" << n.width();
return;
}
refresh();
setTiledBackingStoreFrozen(false);
}
void KGraphicsWebSlice::preview(const QString &selector)
{
if (selector.isEmpty()) {
setPreviewMode(false);
refresh();
return;
}
setPreviewMode(true);
d->previewRect = previewGeometry(selector);
update();
}
void KGraphicsWebSlice::setPreviewMode(bool on)
{
showPage();
if (on && !d->previewMode) {
d->previewMode = on;
refresh();
}
if (!on && d->previewMode) {
d->previewMode = on;
setZoomFactor(1.0);
refresh();
}
}
void KGraphicsWebSlice::showSlice(const QString &selector)
{
QRectF r = sliceGeometry(selector);
// qDebug() << "area=" << d->documentGeometry << ", viewportSize=" << page()->viewportSize() << ", contentsRect=" << contentsRect().size();
if (!selector.isEmpty() && r.isValid()) {
zoom(r);
} else if (d->documentGeometry.width() != contentsRect().size().width()) {
// Change zoom level only if the current one isn't appropriate
// but reset to 1.0 first
setZoomFactor(1.0);
updateElementCache();
zoom(d->documentGeometry);
}
}
void KGraphicsWebSlice::zoom(const QRectF &area)
{
if (!area.isValid()) {
qDebug() << "invalid zoom area" << area;
return;
}
qreal f = contentsRect().size().width() / qMax((qreal)1.0, area.width());
// size: zoom page
if (f > 0.1 && f < 32) { // within sane bounds?
setZoomFactor(f);
}
if (area != sliceGeometry(d->selector)) {
qDebug() << "different results.";
}
// position: move origin according to zoom
QPointF viewPosition = area.topLeft();
// We end up positioning too low, so move the new position up a little
viewPosition = QPointF(viewPosition.x() * f, (viewPosition.y() * f) - (16 * f));
page()->mainFrame()->setScrollPosition(viewPosition.toPoint());
}
void KGraphicsWebSlice::showPage()
{
qreal zoom = 1.0;
QSizeF o = d->documentGeometry.size();
QSizeF s = o;
s.scale(contentsRect().size(), Qt::KeepAspectRatio);
zoom = s.width() / qMax((qreal)1.0, contentsRect().width());
setZoomFactor(zoom);
page()->mainFrame()->setScrollPosition(QPoint(0, 0));
update();
}
QPixmap KGraphicsWebSlice::elementPixmap() const
{
QRectF rect = sliceGeometry();
if (!rect.isValid()) {
return QPixmap();
}
QPixmap result = QPixmap( rect.size().toSize() );
result.fill( Qt::white );
QPainter painter( &result );
painter.translate( -rect.x(), -rect.y() );
QWebFrame *frame = page()->mainFrame();
frame->render( &painter, QRegion(rect.toRect()) );
return result;
}
void KGraphicsWebSlice::setPreviewMaskColor(const QColor &color)
{
d->previewMaskColor = color;
if (d->previewMode) {
update();
}
}
void KGraphicsWebSlice::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget)
{
QGraphicsWebView::paint(painter, option, widget);
if (!d->previewMode) {
return;
}
d->previewMaskColor.setAlphaF(1.0);
painter->setPen(d->previewMaskColor);
d->previewMaskColor.setAlphaF(.5);
painter->setBrush(d->previewMaskColor);
QPainterPath path;
path.addRect(boundingRect());
path.addRect(d->previewRect);
painter->drawPath(path);
//painter->drawRect(d->previewRect);
}
#include "moc_kgraphicswebslice.cpp"

View file

@ -1,190 +0,0 @@
/*
* Copyright 2009-2011 by Sebastian Kügler <sebas@kde.org>
* Copyright 2009 by Richard Moore <rich@kde.org>
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 KGRAPHICSWEBSLICE_H
#define KGRAPHICSWEBSLICE_H
#include <qgraphicswebview.h>
#include <QGraphicsSceneResizeEvent>
#include <QUrl>
class QWebFrame;
/**
* @class KGraphicsWebSlice plasma/kgraphicswebslice.h
*
* @short A QGraphicsWidget displaying a part of a webpage
*
* KGraphicsWebSlice provides a graphicswidget that displays a part of a
* webpage, based on a QRectF inside the webpage or a CSS selector.
*
* The KGraphicsWebSlice needs a URL set and either a slice geometry (using
* setSliceGeometry(QRectF) or directly a QRectF, for web pages missing the
* semantic information. When both options are given, element() takes
* precedence.
*/
class KGraphicsWebSlice : public QGraphicsWebView
{
Q_OBJECT
public:
KGraphicsWebSlice( QGraphicsWidget *parent=0 );
~KGraphicsWebSlice();
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget = 0);
/**
* Set the URL of the webpage the is being sliced. If you want
* to use the more flexible CSS selector to render your slice,
* the URL should point to the frame you're looking for, not to
* the mainframe of the page. If the page doesn't use frames,
* just the URL will work of course.
*
* @param url The page or frame URL to render
**/
void loadSlice(const QUrl &url, const QString &selector = QString());
/**
* Specify the element of the webpage to be rendered. selector can
* be any CSS that is matched by WebKit's findElement() API. If you
* want to select a div with the id "mybox", specify "#mybox" here.
* The first element found will be used.
*
* @param selector the name of the group to access
**/
void setElement(const QString &selector);
/**
* Directly set the geometry of the piece that is cut out of the
* webpage. This option is only effective when element().isEmpty().
*
* @param geo The QRectF to slice out of the webpage
**/
void setSliceGeometry( const QRectF geo );
/**
* Returns the CSS selector used to identify the element that is being
* rendered.
*
* @return The CSS selector used to identify the element to render as
* the slice
**/
QString element() const;
/**
* Returns the manually set sliceGeometry inside the page. If you are using
* the CSS selector mechanism, this function is not what you want. Use the
* sizing mechanism of the widget instead.
*
* @param selector Specify a selector to find the geometry of a specific element
* @return The geometry of the slice within the page, if selector is empty, the current
* element is show, if the slice is not found, a zero-size rect will be returned.
**/
QRectF sliceGeometry(const QString &selector = QString()) const;
/**
* Returns a pixmap of the selected slice. Which slice to show is determined
* by setUrl(QUrl) or setSliceGeometry(QRectF).
*
* @return A QPixmap of a part of the webpage
**/
QPixmap elementPixmap() const;
/**
* Sets the text shown while the widget is loading. You can use HTML here,
* as it uses the same webview we use to display the slice. This has to be
* set before calling setUrl(url).
*
* @param text The HTML to display
**/
void setLoadingText(const QString &html);
/**
* Sets the color of the preview overlay mask, if nothing is set, default to black.
*
* @param color The color used to paint the preview mask
**/
void setPreviewMaskColor(const QColor &color);
/**
* Switches the widget to showing a specific slice.
*
* @param color The CSS selector used to identify the element of the webpage to show
**/
void showSlice(const QString &selector = QString());
/**
* Shows the full page unsliced and zoomed out to fit into the widget.
**/
void showPage();
public Q_SLOTS:
/**
* Renders a preview for a specific element as overlay over the body of the page.
*
**/
void preview(const QString& = QString());
/**
* Refresh the position of the slice. This function can be needed if the
* geometry changes, or anything else that influences painting and
* rendering of the webpage.
*
**/
void refresh();
void zoom(const QRectF &area);
Q_SIGNALS:
/**
* Emitted when the webslice has found out its preferred geometry
*/
void sizeChanged(QSizeF);
protected Q_SLOTS:
/**
* Slot to catch loading errors, and initiating showing the slice or preview
*/
void finishedLoading(bool ok);
/**
* Reimplemented from QGraphicsWidget
*/
void resizeEvent ( QGraphicsSceneResizeEvent * event );
/**
* slot compressing resize events.
*/
void resizeTimeout();
private:
/**
* Initial creating of slice and setting of sizing information.
*/
void setPreviewMode(bool = true);
QRectF previewGeometry(const QString &selector) const;
void updateElementCache();
QRectF mapFromPage(const QRectF &rectOnPage) const;
struct KGraphicsWebSlicePrivate *d;
};
#endif // KGRAPHICSWEBSLICE_H

View file

@ -1,90 +0,0 @@
/*
* Copyright 2009 by Sebastian Kügler <sebas@kde.org>
* Copyright 2009 by Richard Moore <rich@kde.org>
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 "kwebslice.h"
#include "kgraphicswebslice.h"
#include <qdebug.h>
struct KWebSlicePrivate
{
KGraphicsWebSlice *slice;
QString selector;
};
KWebSlice::KWebSlice( QWidget *parent )
: QGraphicsView( parent )
{
d = new KWebSlicePrivate;
d->slice = new KGraphicsWebSlice;
connect(d->slice, SIGNAL(sizeChanged(QSizeF)), this, SLOT(sizeChanged(QSizeF)));
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QGraphicsScene *qgs = new QGraphicsScene(this);
qgs->addItem(d->slice);
qgs->setActiveWindow(d->slice);
setScene(qgs);
setMinimumSize(20,20);
//setPreferedSize(20,80);
}
KWebSlice::~KWebSlice()
{
delete d;
}
void KWebSlice::setUrl( const QUrl &url )
{
d->slice->setUrl( url );
}
void KWebSlice::setLoadingText(const QString &html)
{
d->slice->setLoadingText(html);
}
void KWebSlice::setElement( const QString &selector )
{
d->slice->setElement(selector);
}
void KWebSlice::sizeChanged(QSizeF newsize)
{
//qDebug() << "size changed" << newsize;
QRectF newgeometry = QRectF(QPointF(0, 0), newsize);
setSceneRect(newgeometry);
resize(newgeometry.toRect().size());
}
QSize KWebSlice::sizeHint () const
{
return sceneRect().size().toSize();
}
void KWebSlice::resizeEvent ( QResizeEvent * event )
{
QRectF newgeometry = QRectF(QPointF(0, 0), event->size());
//qDebug() << "KWebSlice::resizeEvent" << newgeometry << "(" << event->oldSize() << ")";
setSceneRect(newgeometry);
d->slice->setGeometry(newgeometry);
}

View file

@ -1,87 +0,0 @@
/*
* Copyright 2009 by Sebastian Kügler <sebas@kde.org>
* Copyright 2009 by Richard Moore <rich@kde.org>
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU 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 KWEBSLICE_H
#define KWEBSLICE_H
#include <qgraphicsview.h>
#include <QUrl>
/**
* @class KWebSlice
*
* @short A QWidget displaying a part of a webpage
*
* KWebSlice provides a graphicsview embedding the SliceGraphicsWidget
* graphicswidget that displays a part of a webpage, based on a QRectF
* inside the webpage or a CSS selector (preferred).
*/
class KWebSlice : public QGraphicsView
{
Q_OBJECT
public:
KWebSlice( QWidget *parent=0 );
~KWebSlice();
/**
* Set the URL of the webpage the is being sliced. If you want
* to use the more flexible CSS selector to render your slice,
* the URL should point to the frame you're looking for, not to
* the mainframe of the page. If the page doesn't use frames,
* just the URL will work of course.
*
* @param url The page or frame URL to render
**/
void setUrl( const QUrl &url );
/**
* Specify the element of the webpage to be rendered. selector can
* be any CSS that is matched by WebKit's findElement() API. If you
* want to select a div with the id "mybox", specify "#mybox" here.
* The first element found will be used.
*
* @param selector the name of the group to access
**/
void setElement( const QString &selector );
/**
* Sets the text shown while the widget is loading. You can use HTML here,
* as it uses the same webview we use to display the slice. This has to be
* set before calling setUrl(url).
*
* @param text The HTML to display
**/
void setLoadingText(const QString &html);
protected:
QSize sizeHint () const;
protected slots:
void resizeEvent ( QResizeEvent * event );
void sizeChanged ( QSizeF newsize );
private:
struct KWebSlicePrivate *d;
};
#endif // KWEBSLICE_H

View file

@ -1,16 +0,0 @@
#include <qapplication.h>
#include <qurl.h>
#include "kwebslice.h"
int main( int argc, char **argv )
{
QApplication app( argc, argv );
KWebSlice slice;
slice.setElement( QString("#hotspot") );
slice.setLoadingText("<h1>Loading ...<h1>");
slice.setUrl( QUrl(QString("http://www.kde.org/")) );
slice.show();
return app.exec();
}

View file

@ -1,20 +0,0 @@
project(plasma-webslice)
include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/.. )
set(plasma-webslice_SRCS
webslice.cpp
../kgraphicswebslice.cpp
websliceConfig.ui
)
kde4_add_plugin(plasma_applet_webslice ${plasma-webslice_SRCS})
target_link_libraries(plasma_applet_webslice
${KDE4_PLASMA_LIBS}
${KDE4_KIO_LIBS}
${QT_QTWEBKIT_LIBRARY}
)
install(TARGETS plasma_applet_webslice DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-applet-webslice.desktop DESTINATION ${SERVICES_INSTALL_DIR})

View file

@ -1,3 +0,0 @@
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/plasma_applet_webslice.pot

View file

@ -1,111 +0,0 @@
[Desktop Entry]
Name=Web Slice
Name[bs]=Web Isječak
Name[ca]=Lliscador Web
Name[ca@valencia]=Lliscador Web
Name[cs]=Web Slice
Name[da]=Web Slice
Name[de]=Web-Scheibchen
Name[el]=Κομμάτι ιστού
Name[en_GB]=Web Slice
Name[es]=Web Slice
Name[et]=Veebilõik
Name[fi]=Web-siivu
Name[fr]=Tranche de Web
Name[ga]=Slis Ghréasáin
Name[gl]=Fragmento web
Name[hr]=Isječak weba
Name[hu]=Webszelet
Name[it]=Porzione di Web
Name[ja]=
Name[kk]=Веб-үзіндісі
Name[km]=
Name[ko]=
Name[lv]=Tīmekļa izgriezums
Name[mr]=
Name[nb]=Nettstykke
Name[nds]=Nettstremel
Name[nl]=Web Slice
Name[nn]=Vevstykke
Name[pa]=
Name[pl]=Wycinek sieci
Name[pt]=Fatia Web
Name[pt_BR]=Web Slice
Name[ru]=Фрагмент веб-страницы
Name[sk]=Webový výsek
Name[sl]=Rezina spleta
Name[sr]=веб исечак
Name[sr@ijekavian]=веб исечак
Name[sr@ijekavianlatin]=veb isečak
Name[sr@latin]=veb isečak
Name[sv]=Webbutdrag
Name[tr]=Web Dilimi
Name[uk]=Вебзріз
Name[x-test]=xxWeb Slicexx
Name[zh_CN]=
Name[zh_TW]=
Comment=Show a part of a webpage
Comment[ar]=اعرض جزءًا من صفحة الوِب
Comment[bs]=Prikazi dio internet stranice
Comment[ca]=Mostra una part d'una pàgina web
Comment[ca@valencia]=Mostra una part d'una pàgina web
Comment[cs]=Zobrazit část webové stránky
Comment[da]=Vis en del af en webside
Comment[de]=Einen Teil einer Webseite anzeigen
Comment[el]=Εμφάνιση ενός τμήματος μίας ιστοσελίδας
Comment[en_GB]=Show a part of a webpage
Comment[es]=Mostrar una parte de una página web
Comment[et]=Veebilehe osa näitamine
Comment[fi]=Näyttää osan web-sivusta
Comment[fr]=Affiche une partie d'une page Web
Comment[ga]=Taispeáin cuid de leathanach Gréasáin
Comment[gl]=Mostrar unha parte dunha páxina web.
Comment[hr]=Prikaži dio web stranice
Comment[hu]=Weboldalrészlet megjelenítése
Comment[it]=Mostra una parte di una pagina web
Comment[ja]=
Comment[kk]=Веб-парағының бір бөлігін көрсету
Comment[km]=
Comment[ko]=
Comment[lv]=Rāda daļu no tīmekļa lapas
Comment[mr]= ि
Comment[nb]=Vis en del av et nettside
Comment[nds]=Wiest en Deelrebeet vun en Nettsiet
Comment[nl]=Een deel van een webpagina tonen
Comment[nn]=Vis ein del av ei nettside
Comment[pa]=
Comment[pl]=Wyświetlacz wycinków stron internetowych
Comment[pt]=Mostrar uma parte de uma página Web
Comment[pt_BR]=Mostra parte de uma página Web
Comment[ro]=Arată o porțiune de pagină web
Comment[ru]=Показывает часть веб-страницы
Comment[sk]=Zobrazenie časti webovej stránky
Comment[sl]=Prikaži del spletne strani
Comment[sr]=Приказ дела веб странице
Comment[sr@ijekavian]=Приказ дијела веб странице
Comment[sr@ijekavianlatin]=Prikaz dijela veb stranice
Comment[sr@latin]=Prikaz dela veb stranice
Comment[sv]=Visa en del av en webbsida
Comment[tr]=Bir web sayfasının belirli bir bölümünü göster
Comment[uk]=Показ частини вебсторінки
Comment[x-test]=xxShow a part of a webpagexx
Comment[zh_CN]=
Comment[zh_TW]=
Type=Service
Icon=internet-web-browser
ServiceTypes=Plasma/Applet
X-KDE-Library=plasma_applet_webslice
X-KDE-PluginInfo-Author=Sebastian Kügler
X-KDE-PluginInfo-Email=sebas@kde.org
X-KDE-PluginInfo-Name=webslice
X-KDE-PluginInfo-Version=0.3
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-DefaultSize=200,150
X-Plasma-Requires-FileDialog=Unused
X-Plasma-Requires-LaunchApp=Required

View file

@ -1,293 +0,0 @@
/***************************************************************************
* Copyright 2009-2011 by Sebastian Kugler <sebas@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "webslice.h"
#include <kgraphicswebslice.h>
#include <limits.h>
// Qt
#include <QtGui/qgraphicssceneevent.h>
#include <QLabel>
#include <QGraphicsLinearLayout>
#include <QWebElement>
#include <QWebFrame>
// KDE
#include <KDebug>
#include <KConfigDialog>
#include <KServiceTypeTrader>
#include <Plasma/Theme>
// Plasma
#include <Plasma/Label>
WebSlice::WebSlice(QObject *parent, const QVariantList &args)
: Plasma::PopupApplet(parent, args),
m_slice(0),
m_url(0)
{
setPopupIcon("internet-web-browser");
setAspectRatioMode(Plasma::IgnoreAspectRatio );
setAcceptDrops(true);
setAcceptHoverEvents(true);
setMinimumSize(64, 64);
resize(800, 600);
kDebug() << "0";
}
void WebSlice::init()
{
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(pluginName());
const KService::List offers = KServiceTypeTrader::self()->query("Plasma/Applet",
constraint);
foreach (const KService::Ptr &service, offers) {
QStringList args = service->property("X-Plasma-Args").toStringList();
if (args.count() >= 1) {
m_url = KUrl(args[0]);
if (args.count() >= 2) {
m_element = args[1];
if (args.count() >= 6) {
m_sliceGeometry = QRectF(args[2].toInt(), args[3].toInt(),
args[4].toInt(), args[5].toInt());
}
}
}
}
void graphicsWidget();
}
WebSlice::~WebSlice ()
{
}
void WebSlice::configChanged()
{
kDebug();
KConfigGroup cg = config();
if (!m_url.isValid() || m_url.isEmpty()) {
m_url = cg.readEntry("url", "http://dot.kde.org/");
m_element = cg.readEntry("element", "#block-views-planetkde-block_1");
// for testing geometry
//m_url = cg.readEntry("url", "http://buienradar.nl/");
//m_sliceGeometry = cg.readEntry("size", QRectF(258, 102, 550, 511));
m_sliceGeometry = cg.readEntry("sliceGeometry", QRectF());
}
setAssociatedApplicationUrls(KUrl::List(m_url));
if (m_slice) {
m_slice->preview();
}
loadSlice(m_url, m_element);
}
QGraphicsWidget* WebSlice::graphicsWidget()
{
if (!m_slice) {
m_widget = new QGraphicsWidget(this);
QGraphicsLinearLayout *l = new QGraphicsLinearLayout(m_widget);
m_widget->setLayout(l);
m_slice = new KGraphicsWebSlice(m_widget);
m_slice->setMaximumSize(contentsRect().size());
//m_slice->show();
updateColors();
//connect(m_slice, SIGNAL(sizeChanged(QSizeF)), this, SLOT(sizeChanged(QSizeF)));
connect(m_slice, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateColors()));
setBusy(true);
m_slice->setLoadingText(i18nc("displayed in the widget while loading", "<h1>Loading...</h1>"));
//m_slice->hide();
l->addItem(m_slice);
kDebug() << "slice set up";
configChanged();
}
return m_widget;
}
void WebSlice::createConfigurationInterface(KConfigDialog *parent)
{
//QLabel *info = new QLabel(parent);
QLabel* info = new QLabel(parent);
info->setWordWrap(true);
info->setTextInteractionFlags(Qt::TextBrowserInteraction);
info->setText(i18n("<p>The Webslice Widget allows you to display a part of a webpage on your desktop or in a panel. The webslice is fully interactive.</p>"
"<p>"
"Specify the URL of the webpage in the URL field."
"In the <em>Element to Show</em> field, fill in a CSS identifier (for example #mybox for elements with the id \"mybox\"). This is the preferred method as it works best with layout changes on the webpage."
"</p>"
"<p>"
"Alternatively, you can specify a rectangle on the webpage to use as slice. Use \"x,y,width,height\" in pixels, for example <em>\"100,80,300,360\"</em>. This method is a fallback for webpages that do not provide enough semantic markup for the above mechanism."
"</p>"
"If both methods (element and geometry) are used, the element will take precedence."));
parent->addPage(info, i18nc("informational page", "Info"), "help-hint");
QWidget *widget = new QWidget(parent);
ui.setupUi(widget);
parent->addPage(widget, i18nc("general config page", "Webpage"), Applet::icon());
connect(ui.loadUrl, SIGNAL(clicked()), this, SLOT(loadUrl()));
connect(ui.elementCombo, SIGNAL(destroyed()), SLOT(disconnectLoadFinished()));
connect(ui.elementCombo, SIGNAL(activated(QString)), this, SLOT(preview(QString)));
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
ui.urlEdit->setText(m_url.toString());
ui.loadUrl->setIcon(KIcon("view-refresh"));
ui.geometryEdit->setText(sliceGeometryToString());
ui.elementCombo->setEditable(true);
updateElements();
preview(m_element);
connect(ui.urlEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified()));
connect(ui.loadUrl, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(ui.elementCombo, SIGNAL(editTextChanged(QString)), parent, SLOT(settingsModified()));
connect(ui.geometryEdit, SIGNAL(userTextChanged(QString)), parent, SLOT(settingsModified()));
connect(ui.elementCombo, SIGNAL(editTextChanged(QString)), this, SLOT(handleGeometryEdit()));
connect(parent, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this,
SLOT(handleGeometryEdit()));
}
void WebSlice::updateElements()
{
ui.elementCombo->clear();
ui.elementCombo->addItem(m_element, m_element);
ui.elementCombo->addItem(QString("body"), QString("body"));
foreach(const QWebElement el, m_slice->page()->mainFrame()->findAllElements("*")) {
QString elSelector;
QString elAttributeName;
if (el.attributeNames().contains("id")) {
elAttributeName = QString("id");
elSelector = QString("#%1").arg(el.attribute("id")); // according to CSS selector syntax
} else {
/* don't add all elements for now, this really only clutters the combo
elSelector = el.localName();
if (!el.attribute("class").isEmpty()) {
elSelector.append("." + el.attribute("class"));
}
*/
}
// Add Item?
if (!elSelector.isEmpty() && !(el.geometry().size().isNull())) {
ui.elementCombo->addItem(elSelector, elAttributeName);
}
}
}
void WebSlice::disconnectLoadFinished()
{
// we need to prevent the combo from being updated when it's gone
disconnect(m_slice, SIGNAL(loadFinished(bool)), this, SLOT(updateElements()));
m_slice->preview();
}
void WebSlice::preview(const QString &selector)
{
ui.geometryEdit->setText(sliceGeometryToString(selector));
m_slice->preview(selector);
}
void WebSlice::loadUrl()
{
loadSlice(QUrl(ui.urlEdit->text()));
connect(m_slice, SIGNAL(loadFinished(bool)), SLOT(updateElements()));
}
void WebSlice::loadSlice(const QUrl &url, const QString &selector)
{
if (m_slice) {
m_slice->loadSlice(url, selector);
setAssociatedApplicationUrls(KUrl::List(url));
}
}
void WebSlice::configAccepted()
{
if (m_url.toString() != ui.urlEdit->text() ||
m_element != ui.elementCombo->currentText() ||
ui.geometryEdit->text() != sliceGeometryToString()) {
m_url = QUrl(ui.urlEdit->text());
m_element = ui.elementCombo->currentText();
QString geo = ui.geometryEdit->text();
QStringList gel = geo.split(',');
qreal x, y, w, h;
bool ok = true;
if (gel.length() == 4) {
x = (qreal)(gel[0].toDouble(&ok));
y = (qreal)(gel[1].toDouble(&ok));
w = (qreal)(gel[2].toDouble(&ok));
h = (qreal)(gel[3].toDouble(&ok));
if (!ok) {
kWarning() << "a conversion error occurred." << gel;
} else {
m_sliceGeometry = QRectF(x, y, w, h);
config().writeEntry("sliceGeometry", m_sliceGeometry);
}
} else {
if (m_element.isEmpty()) {
kWarning() << "format error, use x,y,w,h" << gel << gel.length();
}
}
KConfigGroup cg = config();
cg.writeEntry("url", m_url.toString());
cg.writeEntry("element", m_element);
if (!m_element.isEmpty()) {
m_sliceGeometry = QRectF();
}
emit configNeedsSaving();
configChanged();
}
}
QString WebSlice::sliceGeometryToString(const QString &selector)
{
QString s = QString("%1,%2,%3,%4").arg(m_slice->sliceGeometry(selector).x()).arg(m_slice->sliceGeometry(selector).y()).arg(m_slice->sliceGeometry(selector).width()).arg(m_slice->sliceGeometry(selector).height());
return s;
}
void WebSlice::loadFinished(bool ok)
{
setBusy(false);
if (!ok) {
return;
}
}
void WebSlice::updateColors()
{
m_slice->setPreviewMaskColor(
Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
}
void WebSlice::handleGeometryEdit()
{
if (ui.elementCombo->currentText().isEmpty()) {
ui.geometryEdit->setEnabled(true);
} else {
ui.geometryEdit->setEnabled(false);
}
}
#include "moc_webslice.cpp"

View file

@ -1,70 +0,0 @@
/***************************************************************************
* Copyright 2009-2011 by Sebastian Kügler <sebas@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef WEBSLICE_HEADER
#define WEBSLICE_HEADER
#include <QString>
#include <plasma/popupapplet.h>
#include "ui_websliceConfig.h"
class KGraphicsWebSlice;
class KConfigDialog;
class WebSlice: public Plasma::PopupApplet
{
Q_OBJECT
public:
WebSlice(QObject *parent, const QVariantList &args);
~WebSlice();
void init();
protected:
QGraphicsWidget *graphicsWidget();
KGraphicsWebSlice *m_slice;
protected Q_SLOTS:
void createConfigurationInterface(KConfigDialog *parent);
void configAccepted();
public slots:
void configChanged();
private slots:
void loadFinished(bool);
void loadUrl();
void updateElements();
void disconnectLoadFinished();
void preview(const QString &selector);
void updateColors();
void handleGeometryEdit();
private:
QString sliceGeometryToString(const QString &selector = QString());
void loadSlice(const QUrl &url, const QString &selector = QString("body"));
QUrl m_url;
QString m_element;
QRectF m_sliceGeometry;
Ui::websliceConfig ui;
QGraphicsWidget *m_widget;
};
K_EXPORT_PLASMA_APPLET(webslice, WebSlice)
#endif

View file

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>websliceConfig</class>
<widget class="QWidget" name="websliceConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>276</width>
<height>102</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>700</height>
</size>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="urlLabel">
<property name="text">
<string>URL:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="KLineEdit" name="urlEdit"/>
</item>
<item>
<widget class="KPushButton" name="loadUrl">
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="elementLabel">
<property name="text">
<string>Element to show:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="elementCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Geometry:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="geometryEdit"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,15 +0,0 @@
######################################################################
# This will only build the slicewidget and the graphicswidget
#
# You most likely want to use the cmake-based build.
######################################################################
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += /home/rich/src/project-silk/webslice/. .
QT += webkit
# Input
HEADERS += kwebslice.h kgraphicswebslice.h
SOURCES += main.cpp kwebslice.cpp kgraphicswebslice.cpp

View file

@ -1,44 +0,0 @@
# Find QJSON - JSON handling library for Qt
#
# This module defines
# QJSON_FOUND - whether the qsjon library was found
# QJSON_LIBRARIES - the qjson library
# QJSON_INCLUDE_DIR - the include path of the qjson library
#
if (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
# Already in cache
set (QJSON_FOUND TRUE)
else (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)
if (NOT WIN32)
# use pkg-config to get the values of QJSON_INCLUDE_DIRS
# and QJSON_LIBRARY_DIRS to add as hints to the find commands.
include (FindPkgConfig)
pkg_check_modules (PC_QJSON QJson>=0.5)
endif (NOT WIN32)
find_library (QJSON_LIBRARIES
NAMES
qjson
PATHS
${PC_QJSON_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
${KDE4_LIB_DIR}
)
find_path (QJSON_INCLUDE_DIR
NAMES
qjson/parser.h
PATHS
${PC_QJSON_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QJSON DEFAULT_MSG QJSON_LIBRARIES QJSON_INCLUDE_DIR)
endif (QJSON_INCLUDE_DIR AND QJSON_LIBRARIES)

View file

@ -1,37 +0,0 @@
# - Try to find the QtOAuth library
# Once done this will define
#
# QTOAUTH_FOUND - system has the QtOAuth library
# QTOAUTH_INCLUDE_DIR - the QtOAuth include directory
# QTOAUTH_LIBRARY - Link this to use the QtOAuth
# QTOAUTH_DEFINITIONS - Compiler switches required for using QOAuth
#
# Copyright © 2010, Mehrdad Momeny <mehrdad.momeny@gmail.com>
# Copyright © 2010, Harald Sitter <apachelogger@ubuntu.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY)
# in cache already
set(QTOAUTH_FOUND TRUE)
else (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY)
if (NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(PC_QTOAUTH QUIET qoauth)
set(QTOAUTH_DEFINITIONS ${PC_QTOAUTH_CFLAGS_OTHER})
endif(NOT WIN32)
find_library(QTOAUTH_LIBRARY NAMES qoauth
HINTS ${PC_QTOAUTH_LIBDIR} ${PC_QTOAUTH_LIBRARY_DIRS}
)
find_path(QTOAUTH_INCLUDE_DIR QtOAuth/interface.h
HINTS ${PC_QTOAUTH_INCLUDEDIR} ${PC_QTOAUTH_INCLUDE_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QtOAuth DEFAULT_MSG QTOAUTH_LIBRARY QTOAUTH_INCLUDE_DIR)
mark_as_advanced(QTOAUTH_INCLUDE_DIR QTOAUTH_LIBRARY)
endif (QTOAUTH_INCLUDE_DIR AND QTOAUTH_LIBRARY)

View file

@ -1,14 +1,8 @@
if (QCA2_FOUND AND QJSON_FOUND AND QTOAUTH_FOUND)
add_subdirectory(microblog)
endif()
if(LIBATTICA_FOUND)
add_subdirectory(ocs)
endif()
add_subdirectory(potd)
add_subdirectory(rememberthemilk)
add_subdirectory(kdeobservatory)
add_subdirectory(kimpanel)
add_subdirectory(konsoleprofiles)
add_subdirectory(konqprofiles)

View file

@ -1,12 +0,0 @@
set(konqprofilesengine_SRCS
konqprofilesengine.cpp
konqprofilesservice.cpp
)
kde4_add_plugin(plasma_engine_konqprofiles ${konqprofilesengine_SRCS})
target_link_libraries(plasma_engine_konqprofiles ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS plasma_engine_konqprofiles DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-dataengine-konqprofiles.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install(FILES org.kde.plasma.dataengine.konqprofiles.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)

View file

@ -1,2 +0,0 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.cpp` -o $podir/plasma_engine_konqprofiles.pot

View file

@ -1,95 +0,0 @@
/*****************************************************************************
* Copyright (C) 2011 by Shaun Reich <shaun.reich@kdemail.net> *
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "konqprofilesengine.h"
#include "konqprofilesservice.h"
#include <KStandardDirs>
#include <KDirWatch>
#include <QFileInfo>
#include <kio/global.h>
#include <KGlobalSettings>
#include <KDebug>
KonqProfilesEngine::KonqProfilesEngine(QObject *parent, const QVariantList &args)
: Plasma::DataEngine(parent, args),
m_dirWatch(0)
{
}
KonqProfilesEngine::~KonqProfilesEngine()
{
}
void KonqProfilesEngine::init()
{
kDebug() << "KonqProfilesDataEngine init";
m_dirWatch = new KDirWatch( this );
loadProfiles();
connect(m_dirWatch, SIGNAL(dirty(QString)), this, SLOT(profilesChanged()));
}
Plasma::Service *KonqProfilesEngine::serviceForSource(const QString &source)
{
//create a new service for this profile's name, so it can be operated on.
return new KonqProfilesService(this, source);
}
void KonqProfilesEngine::profilesChanged()
{
//wipe the data clean, load it again. (there's not a better way of doing this but no big deal)
removeAllSources();
loadProfiles();
}
void KonqProfilesEngine::loadProfiles()
{
const QStringList lst = KGlobal::dirs()->findDirs( "data", "konqueror/profiles/" );
for ( int i = 0; i < lst.count(); i++ )
{
m_dirWatch->addDir( lst[i] );
}
const QStringList list = KGlobal::dirs()->findAllResources( "data", "konqueror/profiles/*", KStandardDirs::NoDuplicates );
const QStringList::ConstIterator end = list.constEnd();
for (QStringList::ConstIterator it = list.constBegin(); it != end; ++it)
{
QFileInfo info(*it);
const QString profileName = KIO::decodeFileName(info.baseName());
QString niceName=profileName;
KConfig cfg(*it, KConfig::SimpleConfig);
if (cfg.hasGroup("Profile")) {
KConfigGroup grp(&cfg, "Profile");
if (grp.hasKey( "Name" )) {
niceName = grp.readEntry("Name");
}
QString sourceName = "name:" + profileName;
kDebug() << "adding sourcename: " << profileName << " ++" << niceName;
setData(profileName, "prettyName", niceName);
}
}
}
K_EXPORT_PLASMA_DATAENGINE(konqprofilesengine, KonqProfilesEngine)
#include "moc_konqprofilesengine.cpp"

View file

@ -1,50 +0,0 @@
/*****************************************************************************
* Copyright (C) 2011 by Shaun Reich <shaun.reich@kdemail.net> *
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef KONQPROFILESENGINE_H
#define KONQPROFILESENGINE_H
#include <Plasma/DataEngine>
class KDirWatch;
/**
* This engine provides the list of session applets for konqueror, as well
* as support to open/launch them.
*/
class KonqProfilesEngine : public Plasma::DataEngine
{
Q_OBJECT
public:
KonqProfilesEngine(QObject *parent, const QVariantList &args);
~KonqProfilesEngine();
void init();
Plasma::Service *serviceForSource(const QString &source);
private Q_SLOTS:
void profilesChanged();
private:
void loadProfiles();
KDirWatch *m_dirWatch;
};
#endif

View file

@ -1,60 +0,0 @@
/*****************************************************************************
* Copyright (C) 2011 by Shaun Reich <shaun.reich@kdemail.net> *
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "konqprofilesservice.h"
#include <QtCore/QMap>
#include <KToolInvocation>
#include <KDebug>
KonqProfilesService::KonqProfilesService(QObject* parent, const QString& profileName)
: Plasma::Service(parent)
{
setName("org.kde.plasma.dataengine.konqprofiles");
setDestination(profileName);
}
Plasma::ServiceJob* KonqProfilesService::createJob(const QString& operation, QMap<QString,QVariant>& parameters)
{
return new ProfileJob(this, operation, parameters);
}
ProfileJob::ProfileJob(KonqProfilesService *service, const QString &operation, const QMap<QString, QVariant> &parameters)
: Plasma::ServiceJob(service->destination(), operation, parameters, service)
{
}
void ProfileJob::start()
{
//destination is the profile name, operation is e.g. "open"
// QMap<QString, QVariant>jobParameters = parameters();
const QString operation = operationName();
kDebug() << "SERVICE START...operation: " << operation << " dest: " << destination();
if (operation == "open") {
// Q_ASSERT(!jobParameters.isEmpty());
QStringList args;
args << "--profile" << destination();
KToolInvocation::kdeinitExec("konqueror", args);
setResult(true);
}
}
#include "moc_konqprofilesservice.cpp"

View file

@ -1,45 +0,0 @@
/*****************************************************************************
* Copyright (C) 2011 by Shaun Reich <shaun.reich@kdemail.net> *
* Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef KONQPROFILESSERVICE_H
#define KONQPROFILESSERVICE_H
#include <Plasma/Service>
#include <Plasma/ServiceJob>
class KonqProfilesService : public Plasma::Service
{
Q_OBJECT
public:
KonqProfilesService(QObject* parent, const QString& profileName);
protected:
Plasma::ServiceJob* createJob(const QString& operation, QMap<QString,QVariant>& parameters);
};
class ProfileJob : public Plasma::ServiceJob
{
Q_OBJECT
public:
ProfileJob(KonqProfilesService *service, const QString& operation, const QMap<QString, QVariant> &parameters);
void start();
};
#endif

Some files were not shown because too many files have changed in this diff Show more