[kdeplasma-addons/frameworks] applets: Replace the old pastebin plasmoid for a new plasmoid named Quick Share
Albert Astals Cid
aacid at kde.org
Thu Jan 16 22:35:44 UTC 2014
El Dijous, 16 de gener de 2014, a les 22:30:52, Aleix Pol va escriure:
> Git commit 181d3ed72ca3fe2c796eb4001fdea2c32e5f280a by Aleix Pol.
> Committed on 16/01/2014 at 22:30.
> Pushed by apol into branch 'frameworks'.
>
> Replace the old pastebin plasmoid for a new plasmoid named Quick Share
I'd say you're missing a Messages.sh here.
Cheers,
Albert
>
> It's basically the same it used to be, decided to rename it because it does
> more than just pastebin.
> It's mostly a port (so rewrite) of the plasmoid to QML.
>
> M +2 -1 applets/CMakeLists.txt
> D +0 -15 applets/pastebin/CMakeLists.txt
> D +0 -3 applets/pastebin/Messages.sh
> D +0 -821 applets/pastebin/pastebin.cpp
> D +0 -182 applets/pastebin/pastebin.h
> D +0 -7 applets/pastebin/pastebin.knsrc
> D +0 -163 applets/pastebin/pastebinConfig.ui
> D +0 -129 applets/pastebin/plasma-applet-pastebin.desktop
> D +0 -217 applets/pastebin/plasma_pastebin.notifyrc
> A +31 -0 applets/quickshare/contents/config/config.qml [License:
> GPL (v2/3)] A +15 -0 applets/quickshare/contents/config/main.xml
> A +28 -0 applets/quickshare/contents/ui/PasteMenuItem.qml
> [License: GPL (v2+)] A +223 -0 applets/quickshare/contents/ui/main.qml
> [License: GPL (v2+)] A +71 -0
> applets/quickshare/contents/ui/settingsGeneral.qml [License: GPL (v2+)]
> A +26 -0 applets/quickshare/metadata.desktop
>
> http://commits.kde.org/kdeplasma-addons/181d3ed72ca3fe2c796eb4001fdea2c32e5f
> 280a
>
> diff --git a/applets/CMakeLists.txt b/applets/CMakeLists.txt
> index 857294e..2520071 100644
> --- a/applets/CMakeLists.txt
> +++ b/applets/CMakeLists.txt
> @@ -40,7 +40,6 @@ add_subdirectory(calculator)
> # add_subdirectory(community)
> # add_subdirectory(social-news)
> # endif(LIBATTICA_FOUND)
> -# add_subdirectory(pastebin)
> # add_subdirectory(previewer)
> # add_subdirectory(rememberthemilk)
> # add_subdirectory(rssnow)
> @@ -97,3 +96,5 @@ add_subdirectory(calculator)
> # endif (Q_WS_X11)
> #
> # add_subdirectory(webslice)
> +
> +plasma_install_package(quickshare org.kde.plasma.quickshare)
> diff --git a/applets/pastebin/CMakeLists.txt
> b/applets/pastebin/CMakeLists.txt deleted file mode 100644
> index 3814dda..0000000
> --- a/applets/pastebin/CMakeLists.txt
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -project(plasma-pastebin)
> -
> -set(pastebin_SRCS
> - pastebin.cpp)
> -
> -kde4_add_ui_files(pastebin_SRCS pastebinConfig.ui)
> -
> -kde4_add_plugin(plasma_applet_pastebin ${pastebin_SRCS})
> -target_link_libraries(plasma_applet_pastebin ${KDE4_PLASMA_LIBS}
> ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KNEWSTUFF3_LIBS}) -
> -install(TARGETS plasma_applet_pastebin DESTINATION ${PLUGIN_INSTALL_DIR})
> -install(FILES plasma-applet-pastebin.desktop DESTINATION
> ${SERVICES_INSTALL_DIR}) -install(FILES plasma_pastebin.notifyrc
> DESTINATION ${DATA_INSTALL_DIR}/plasma_pastebin) -install(FILES
> pastebin.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
> -
> diff --git a/applets/pastebin/Messages.sh b/applets/pastebin/Messages.sh
> deleted file mode 100755
> index 9dc8642..0000000
> --- a/applets/pastebin/Messages.sh
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -#! /usr/bin/env bash
> -$EXTRACTRC *.ui >> rc.cpp
> -$XGETTEXT *.cpp -o $podir/plasma_applet_pastebin.pot
> diff --git a/applets/pastebin/pastebin.cpp b/applets/pastebin/pastebin.cpp
> deleted file mode 100644
> index df7f534..0000000
> --- a/applets/pastebin/pastebin.cpp
> +++ /dev/null
> @@ -1,821 +0,0 @@
> -/**************************************************************************
> * - * Copyright (C) 2007 by Thomas Georgiou <TAGeorgiou at gmail.com>
> * - * Artur Duque de Souza <asouza at 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 "pastebin.h"
> -
> -#include <KConfigDialog>
> -#include <KStandardAction>
> -#include <KToolInvocation>
> -#include <KNotification>
> -#include <KAction>
> -
> -#include <kmimetype.h>
> -#include <KTemporaryFile>
> -#include <KDE/KIO/MimetypeJob>
> -#include <KDebug>
> -
> -#include <kio/global.h>
> -#include <kio/job.h>
> -
> -#include <Plasma/Theme>
> -#include <Plasma/Service>
> -#include <Plasma/ServiceJob>
> -#include <KNS3/DownloadDialog>
> -
> -#include <QApplication>
> -#include <QClipboard>
> -#include <QGraphicsLinearLayout>
> -#include <QGraphicsScene>
> -#include <QGraphicsSceneDragDropEvent>
> -#include <QFile>
> -#include <QBuffer>
> -#include <QPainter>
> -#include <QPaintEngine>
> -#include <QSignalMapper>
> -#include <QPropertyAnimation>
> -
> -
> -Pastebin::Pastebin(QObject *parent, const QVariantList &args)
> - : Plasma::Applet(parent, args),
> - m_signalMapper(new QSignalMapper()), m_paste(0),
> - m_topSeparator(0), m_bottomSeparator(0),
> - m_historySize(3), m_newStuffDialog(0)
> -{
> - setAcceptDrops(true);
> - setHasConfigurationInterface(true);
> - setAspectRatioMode(Plasma::ConstrainedSquare);
> - setMinimumSize(16, 16);
> - resize(150, 150);
> - m_timer = new QTimer(this);
> - connect(m_timer, SIGNAL(timeout()), this, SLOT(showErrors()));
> -
> - connect(m_signalMapper, SIGNAL(mapped(QString)),
> - this, SLOT(copyToClipboard(QString)));
> - connect(this, SIGNAL(activate()), this, SLOT(postClipboard()));
> -
> - // connect to all sources of our 'share' dataengine
> - m_engine = dataEngine("org.kde.plasma.dataengine.share");
> - m_engine->connectAllSources(this);
> -
> - // to detect when the mimetypes were added again after a refresh
> - connect(m_engine, SIGNAL(sourceAdded(QString)),
> - this, SLOT(sourceAdded(QString)));
> - connect(m_engine, SIGNAL(sourceRemoved(QString)),
> - this, SLOT(sourceRemoved(QString)));
> -}
> -
> -// save history of URLs
> -void Pastebin::saveHistory()
> -{
> - QString history;
> - const int numberOfActionHistory = m_actionHistory.size();
> - for (int i = 0; i < numberOfActionHistory; ++i) {
> - history.prepend(m_actionHistory.at(i)->toolTip());
> - history.prepend('|');
> - }
> -
> - KConfigGroup cg = config();
> - cg.writeEntry("History", history);
> -}
> -
> -Pastebin::~Pastebin()
> -{
> - delete m_topSeparator;
> - delete m_bottomSeparator;
> - delete m_newStuffDialog;
> -
> - saveHistory();
> - const int numberOfActionHistory = m_actionHistory.size();
> - for (int i = 0; i < numberOfActionHistory; ++i) {
> - delete m_actionHistory.at(i);
> - }
> -}
> -
> -void Pastebin::init()
> -{
> - configChanged();
> - setActionState(Idle);
> - setInteractionState(Waiting);
> -
> - updateTheme();
> - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
> SLOT(updateTheme())); -
> Plasma::ToolTipManager::self()->registerWidget(this);
> - Plasma::ToolTipManager::self()->setContent(this, toolTipData);
> -}
> -
> -void Pastebin::dataUpdated(const QString &source, const
> Plasma::DataEngine::Data &data) -{
> - // update the options
> - if (source != "Mimetypes") {
> - const QString mimetype = data.value("Mimetypes").toString();
> -
> - if (mimetype.startsWith("text/")) {
> - m_txtServers.insert(data.value("Name").toString(), source);
> - } else if (mimetype.startsWith("image/")) {
> - m_imgServers.insert(data.value("Name").toString(), source);
> - } else {
> - kDebug() << "Mimetype not supported by this applet";
> - }
> - }
> -}
> -
> -void Pastebin::sourceAdded(const QString &source)
> -{
> - // update the options
> - if (source != "Mimetypes") {
> - const Plasma::DataEngine::Data data = m_engine->query(source);
> - const QString mimetype = data.value("Mimetypes").toString();
> -
> - if (mimetype.startsWith("text/")) {
> - m_txtServers.insert(data.value("Name").toString(), source);
> - } else if (mimetype.startsWith("image/")) {
> - m_imgServers.insert(data.value("Name").toString(), source);
> - } else {
> - kDebug() << "Mimetype not supported by this applet";
> - }
> - }
> -}
> -
> -void Pastebin::sourceRemoved(const QString &source)
> -{
> - // update the options
> - if (source != "Mimetypes") {
> - QString key = m_txtServers.key(source);
> - m_txtServers.remove(key);
> -
> - key = m_imgServers.key(source);
> - m_imgServers.remove(key);
> - }
> -}
> -
> -void Pastebin::setHistorySize(int max)
> -{
> - if (max <= 0) {
> - max = 0;
> - }
> - while (max < m_actionHistory.count()) {
> - delete m_actionHistory.takeFirst();
> - }
> -
> - m_historySize = max;
> -}
> -
> -void Pastebin::updateTheme()
> -{
> - m_font =
> Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont); -
> m_font.setBold(true);
> - m_fgColor =
> Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor); -
> m_bgColor =
> Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor); -
> m_linePen = QPen(m_fgColor);
> - kDebug() << "Color" << m_bgColor << m_fgColor;
> - update();
> -}
> -
> -void Pastebin::setInteractionState(InteractionState state)
> -{
> - switch (state ) {
> - case Hovered:
> - m_linePen.setStyle(Qt::DotLine);
> - m_linePen.setWidth(2);
> - showOverlay(true);
> - break;
> - case Waiting:
> - showOverlay(false);
> - break;
> - case DraggedOver:
> - m_linePen.setStyle(Qt::DashLine);
> - m_linePen.setWidth(2);
> - showOverlay(true);
> - break;
> - case Rejected:
> - break;
> - default:
> - break;
> - }
> - m_interactionState = state;
> -}
> -
> -void Pastebin::setActionState(ActionState state)
> -{
> - toolTipData = Plasma::ToolTipContent();
> - toolTipData.setAutohide(true);
> -
> - toolTipData.setMainText("Pastebin");
> -
> - //TODO: choose icons for each state
> -
> - switch (state ) {
> - case Unset:
> - toolTipData.setSubText(i18nc("The status of the applet has not
> been set - i.e. it is unset.", "Unset")); -
> toolTipData.setImage(KIcon("edit-paste"));
> - break;
> - case Idle:
> - setBusy(false);
> - toolTipData.setSubText(i18n("Drop text or an image onto me to
> upload it to Pastebin.")); -
> toolTipData.setImage(KIcon("edit-paste"));
> - break;
> - case IdleError:
> - setBusy(false);
> - toolTipData.setSubText(i18n("Error during upload. Try
> again.")); - toolTipData.setImage(KIcon("dialog-cancel"));
> - // Notification ...
> - QTimer::singleShot(15000, this, SLOT(resetActionState()));
> - m_timer->stop();
> - break;
> - case IdleSuccess:
> - setBusy(false);
> - toolTipData.setSubText(i18n("Successfully uploaded to %1.",
> m_url)); - toolTipData.setImage(KIcon("dialog-ok"));
> - // Notification ...
> - QTimer::singleShot(15000, this, SLOT(resetActionState()));
> - m_timer->stop();
> - break;
> - case Sending:
> - setBusy(true);
> - toolTipData.setSubText(i18n("Sending...."));
> - toolTipData.setImage(KIcon("view-history"));
> - break;
> - default:
> - break;
> - }
> -
> - Plasma::ToolTipManager::self()->setContent(this, toolTipData);
> - m_actionState = state;
> - update();
> -}
> -
> -void Pastebin::constraintsEvent(Plasma::Constraints constraints)
> -{
> - if (constraints & Plasma::FormFactorConstraint) {
> - if (formFactor() == Plasma::Horizontal || formFactor() ==
> Plasma::Vertical ) { - setPreferredSize(-1, -1);
> - } else {
> - setPreferredSize(150, 150);
> - }
> - }
> -}
> -
> -int Pastebin::iconSize()
> -{
> - // return the biggest fitting icon size from KIconLoader
> - int c = qMin(contentsRect().width(), contentsRect().height());
> - int s;
> - if (c >= KIconLoader::SizeEnormous) { // 128
> - s = KIconLoader::SizeEnormous;
> - } else if (c >= KIconLoader::SizeHuge) { // 64
> - s = KIconLoader::SizeHuge;
> - } else if (c >= KIconLoader::SizeLarge) { // 48
> - s = KIconLoader::SizeLarge;
> - } else if (c >= KIconLoader::SizeMedium) { // 32
> - s = KIconLoader::SizeMedium;
> - } else if (c >= KIconLoader::SizeSmallMedium) { // 32
> - s = KIconLoader::SizeSmallMedium;
> - } else { // 16
> - s = KIconLoader::SizeSmall;
> - }
> - return s;
> -}
> -
> -void Pastebin::paintPixmap(QPainter *painter, QPixmap &pixmap, const QRectF
> &rect, qreal opacity) -{
> - int size = pixmap.size().width();
> - QPointF iconOrigin = QPointF(rect.left() + (rect.width() - size) / 2,
> - rect.top() + (rect.height() - size) / 2);
> -
> - painter->setRenderHint(QPainter::SmoothPixmapTransform);
> - painter->setRenderHint(QPainter::Antialiasing);
> -
> - if (!painter->paintEngine()->hasFeature(QPaintEngine::ConstantOpacity))
> { - QPixmap temp(QSize(size, size));
> - temp.fill(Qt::transparent);
> -
> - QPainter p;
> - p.begin(&temp);
> -
> - p.setCompositionMode(QPainter::CompositionMode_Source);
> - p.drawPixmap(QPoint(0,0), pixmap);
> -
> - p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
> - p.fillRect(pixmap.rect(), QColor(0, 0, 0, opacity * 254));
> - p.end();
> -
> - // draw the pixmap
> - painter->drawPixmap(iconOrigin, temp);
> - } else {
> - // FIXME: Works, but makes hw acceleration impossible, use above
> code path - qreal old = painter->opacity();
> - painter->setOpacity(opacity);
> - painter->drawPixmap(iconOrigin, pixmap);
> - painter->setOpacity(old);
> - }
> -}
> -
> -void Pastebin::paintInterface(QPainter *p, const QStyleOptionGraphicsItem
> *, const QRect &contentsRect) -{
> - if (!contentsRect.isValid() || isBusy()) {
> - return;
> - }
> -
> - // BusyWidget is being shown
> - if (m_actionState == Sending) {
> - return;
> - }
> -
> - // Fade in the icon on top of it
> - int iconsize = iconSize();
> - qreal pix_alpha = 1.0 - (0.5 * m_alpha); // Fading out to .5
> -
> - QPointF iconOrigin = QPointF(contentsRect.left() +
> (contentsRect.width() - iconsize) / 2, -
> contentsRect.top() + (contentsRect.height() - iconsize) / 2); - QRectF
> iconRect = QRectF(iconOrigin, QSize(iconsize, iconsize)); -
> - if (m_actionState == IdleSuccess) {
> - QPixmap iconok = KIcon("dialog-ok").pixmap(QSize(iconsize,
> iconsize)); - paintPixmap(p, iconok, iconRect, pix_alpha);
> - } else if (m_actionState == IdleError) {
> - QPixmap iconok = KIcon("dialog-cancel").pixmap(QSize(iconsize,
> iconsize)); - paintPixmap(p, iconok, iconRect, pix_alpha);
> - } else {
> - QPixmap iconpix = KIcon("edit-paste").pixmap(QSize(iconsize,
> iconsize)); - if (!iconpix.isNull()) {
> - paintPixmap(p, iconpix, iconRect, pix_alpha);
> - }
> - }
> -
> - // Draw background
> - if (m_interactionState == DraggedOver) {
> - m_fgColor.setAlphaF(m_alpha);
> - } else if (m_interactionState == Hovered) {
> - m_fgColor.setAlphaF(m_alpha * 0.15);
> - } else {
> - // Whatever, as long as it goes down to 0
> - m_fgColor.setAlphaF(m_alpha * 0.15);
> - }
> - m_bgColor.setAlphaF(m_alpha * 0.3);
> -
> - p->setBrush(m_bgColor);
> - m_linePen.setColor(m_fgColor);
> - p->setPen(m_linePen);
> - p->setFont(m_font);
> -
> - qreal proportion = contentsRect.width() / contentsRect.height();
> - qreal round_radius = 35.0;
> - p->drawRoundedRect(contentsRect, round_radius / proportion,
> round_radius, Qt::RelativeSize); -}
> -
> -void Pastebin::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
> -{
> - setInteractionState(Hovered);
> - Applet::hoverEnterEvent(event);
> -}
> -
> -void Pastebin::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
> -{
> - setInteractionState(Waiting);
> - Applet::hoverLeaveEvent(event);
> -}
> -
> -void Pastebin::showOverlay(bool show)
> -{
> - if (m_fadeIn == show) {
> - return;
> - }
> - m_fadeIn = show;
> -
> - QPropertyAnimation *animation = m_animation.data();
> - if (!animation) {
> - animation = new QPropertyAnimation(this, "animationUpdate");
> - animation->setDuration(400);
> - animation->setStartValue(0.0);
> - animation->setEndValue(1.0);
> - animation->setEasingCurve(QEasingCurve::Linear);
> - m_animation = animation;
> - } else if (animation->state() == QAbstractAnimation::Running) {
> - animation->pause();
> - }
> -
> - if (m_fadeIn) {
> - animation->setDirection(QAbstractAnimation::Forward);
> - animation->start(QAbstractAnimation::KeepWhenStopped);
> - } else {
> - animation->setDirection(QAbstractAnimation::Backward);
> - animation->start(QAbstractAnimation::DeleteWhenStopped);
> - }
> -}
> -
> -qreal Pastebin::animationValue() const
> -{
> - return m_alpha;
> -}
> -
> -void Pastebin::animationUpdate(qreal progress)
> -{
> - m_alpha = progress;
> - update();
> -}
> -
> -void Pastebin::getNewStuff()
> -{
> - if (!m_newStuffDialog) {
> - QString ghns("pastebin.knsrc");
> - m_newStuffDialog = new KNS3::DownloadDialog( ghns );
> - connect(m_newStuffDialog, SIGNAL(accepted()),
> - this, SLOT(newStuffFinished()));
> - }
> - m_newStuffDialog->show();
> -}
> -
> -void Pastebin::newStuffFinished()
> -{
> - if ( m_newStuffDialog->changedEntries().count() ) {
> - // refresh the options of config dialog
> - refreshConfigDialog();
> -
> - // setup the config dialog to last options
> - KConfigGroup cg = config();
> - uiConfig.textServer->setCurrentItem(cg.readEntry("TextProvider",
> "")); -
> uiConfig.imageServer->setCurrentItem(cg.readEntry("ImageProvider", "")); -
> }
> -}
> -
> -void Pastebin::refreshConfigDialog()
> -{
> - // setup text
> - uiConfig.textServer->clear();
> - uiConfig.textServer->addItems(m_txtServers.keys());
> -
> - // setup image
> - uiConfig.imageServer->clear();
> - uiConfig.imageServer->addItems(m_imgServers.keys());
> -}
> -
> -QString Pastebin::getDefaultTextServer()
> -{
> - QString defaultServer = "paste.kde.org";
> - if ( m_txtServers.contains(defaultServer) ) {
> - return defaultServer;
> - } else {
> - return m_txtServers.keys().at(0);
> - }
> -}
> -
> -void Pastebin::createConfigurationInterface(KConfigDialog *parent)
> -{
> - KConfigGroup cg = config();
> -
> - QWidget *general = new QWidget();
> - uiConfig.setupUi(general);
> -
> - connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
> - connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
> - parent->addPage(general, i18n("General"), Applet::icon());
> -
> - uiConfig.ghnsButton->setIcon(KIcon("get-hot-new-stuff"));
> - connect(uiConfig.ghnsButton, SIGNAL(clicked()), this,
> SLOT(getNewStuff())); -
> - refreshConfigDialog();
> - uiConfig.textServer->setCurrentItem(cg.readEntry("TextProvider",
> getDefaultTextServer())); -
> uiConfig.imageServer->setCurrentItem(cg.readEntry("ImageProvider",
> m_imgServers.keys().at(0))); -
> uiConfig.historySize->setValue(m_historySize);
> -
> - connect(uiConfig.textServer , SIGNAL(currentIndexChanged(int)) ,
> parent, SLOT(settingsModified())); - connect(uiConfig.imageServer ,
> SIGNAL(currentIndexChanged(int)) , parent, SLOT(settingsModified())); -
> connect(uiConfig.historySize , SIGNAL(valueChanged(int)) , parent,
> SLOT(settingsModified())); -}
> -
> -void Pastebin::configAccepted()
> -{
> - KConfigGroup cg = config();
> - int historySize = uiConfig.historySize->value();
> - setHistorySize(historySize);
> -
> - cg.writeEntry("TextProvider", uiConfig.textServer->currentText());
> - cg.writeEntry("ImageProvider", uiConfig.imageServer->currentText());
> - cg.writeEntry("HistorySize", historySize);
> - saveHistory();
> -
> - emit configNeedsSaving();
> -}
> -
> -void Pastebin::configChanged()
> -{
> - KConfigGroup cg = config();
> - int historySize = cg.readEntry("HistorySize", "3").toInt();
> - QStringList history = cg.readEntry("History", "").split('|',
> QString::SkipEmptyParts); -
> - m_actionHistory.clear();
> - setHistorySize(historySize);
> - const int numberOfItems = history.size();
> - for (int i = 0; i < numberOfItems; ++i) {
> - addToHistory(history.at(i));
> - }
> -}
> -
> -void Pastebin::showResults(const QString &url)
> -{
> - m_timer->stop();
> - m_url = url;
> - setActionState(IdleSuccess);
> - copyToClipboard(url);
> - addToHistory(url);
> -}
> -
> -void Pastebin::copyToClipboard(const QString &url)
> -{
> - QApplication::clipboard()->setText(url, lastMode);
> - kDebug() << "Copying:" << url;
> - m_oldUrl = url;
> - QPixmap pix = KIcon("edit-paste").pixmap(KIconLoader::SizeMedium,
> KIconLoader::SizeMedium); -
> - KNotification *notify = new KNotification("urlcopied");
> - notify->setComponentData(KComponentData("plasma_pastebin"));
> - notify->setText(i18nc("Notification when the pastebin applet has copied
> the URL to the clipboard", - "The URL for your
> paste has been copied to the clipboard")); - notify->setPixmap(pix);
> - notify->setActions(QStringList(i18n("Open browser")));
> - connect(notify, SIGNAL(action1Activated()), this, SLOT(openLink()));
> - notify->sendEvent();
> -}
> -
> -void Pastebin::showErrors()
> -{
> - setActionState(IdleError);
> -}
> -
> -void Pastebin::openLink(bool old)
> -{
> - if(old) {
> - KToolInvocation::invokeBrowser(m_oldUrl);
> - } else {
> - KToolInvocation::invokeBrowser(m_url);
> - }
> -}
> -
> -void Pastebin::resetActionState()
> -{
> - setActionState(Idle);
> - update();
> -}
> -
> -void Pastebin::mousePressEvent(QGraphicsSceneMouseEvent *event)
> -{
> - if (m_url.isEmpty() || event->button() != Qt::LeftButton) {
> - Plasma::Applet::mousePressEvent(event);
> - } else {
> - openLink(false);
> - }
> - if (event->button() == Qt::MidButton) {
> - if (m_actionState == Idle) {
> - // paste clipboard content
> - postClipboard(true);
> - } else {
> - // Now releasing the middlebutton click copies to clipboard
> - event->accept();
> - }
> - }
> -}
> -
> -void Pastebin::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
> -{
> - if (!m_url.isEmpty() && event->button() == Qt::MidButton &&
> m_actionState == IdleSuccess) { - copyToClipboard(m_url);
> - }
> -}
> -
> -void Pastebin::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
> -{
> - InteractionState istate = Rejected;
> - if (event->mimeData()->hasFormat("text/plain")) {
> - event->acceptProposedAction();
> - }
> - foreach (const QString &f, event->mimeData()->formats()) {
> - if (f.indexOf("image/") != -1) {
> - istate = DraggedOver;
> - }
> - }
> - if (event->mimeData()->hasImage() || event->mimeData()->hasText()) {
> - istate = DraggedOver;
> - }
> - setInteractionState(istate);
> -}
> -
> -void Pastebin::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
> -{
> - Q_UNUSED(event);
> - setInteractionState(Waiting);
> -}
> -
> -void Pastebin::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
> -{
> - event->accept();
> -}
> -
> -void Pastebin::dropEvent(QGraphicsSceneDragDropEvent *event)
> -{
> - if (event->mimeData()->objectName() != QString("Pastebin-applet")) {
> - lastMode = QClipboard::Clipboard;
> -#ifdef Q_WS_WIN
> - // Apparently, Windows doesn't pass any actual image data when
> drag'n'dropping - // image files. Though, it does provide us with
> those files' Urls. Since posting - // multiple images isn't yet
> implemented - we'll use first Url from list - QImage image;
> - QString imageFileName;
> - if (event->mimeData()->hasUrls()) {
> - imageFileName = event->mimeData()->urls().at(0).toLocalFile();
> - image.load(imageFileName);
> - postContent(imageFileName, image);
> - } else {
> - postContent(event->mimeData()->text(), image);
> - };
> -#else
> - QImage image =
> qvariant_cast<QImage>(event->mimeData()->imageData()); -
> postContent(event->mimeData()->text(), image);
> -#endif //Q_WS_WIN
> - event->acceptProposedAction();
> - }
> -}
> -
> -void Pastebin::addToHistory(const QString &url)
> -{
> - if (m_historySize <= 0) {
> - return;
> - }
> -
> - if (m_actionHistory.size() >= m_historySize) {
> - delete m_actionHistory.takeLast();
> - }
> -
> - QAction *ac = new QAction(url, this);
> - m_actionHistory.insert(0, ac);
> - m_signalMapper->setMapping(ac, url);
> - connect(ac, SIGNAL(triggered(bool)), m_signalMapper, SLOT(map()));
> -}
> -
> -QList<QAction*> Pastebin::contextualActions()
> -{
> - if (!m_paste) {
> - m_paste = KStandardAction::paste(this);
> - connect(m_paste, SIGNAL(triggered(bool)), this,
> SLOT(postClipboard())); - }
> - if (!m_topSeparator) {
> - m_topSeparator = new QAction(this);
> - m_topSeparator->setSeparator(true);
> - }
> - if (!m_bottomSeparator) {
> - m_bottomSeparator = new QAction(this);
> - m_bottomSeparator->setSeparator(true);
> - }
> -
> - m_contextualActions.clear();
> -
> - m_contextualActions.append(m_paste);
> - m_contextualActions.append(m_topSeparator);
> - m_contextualActions.append(m_actionHistory);
> -
> - if (!m_actionHistory.isEmpty()) {
> - m_contextualActions.append(m_bottomSeparator);
> - }
> -
> - return m_contextualActions;
> -}
> -
> -void Pastebin::postClipboard()
> -{
> - postClipboard(false);
> -}
> -
> -void Pastebin::postClipboard(bool preferSelection)
> -{
> - lastMode = QClipboard::Clipboard;
> -#ifdef Q_WS_WIN
> -// Same as for D'n'D, Windows doesn't pass any actual image data when
> pasting -// image files. Though, it does provide us with those files' Urls.
> Since posting -// multiple images isn't yet implemented - we'll use first
> Url from list - QImage image;
> - QString imageFileName;
> - if (QApplication::clipboard()->mimeData()->hasUrls()) {
> - imageFileName =
> QApplication::clipboard()->mimeData()->urls().at(0).toLocalFile(); -
> image.load(imageFileName);
> - postContent(imageFileName, image);
> - } else {
> - postContent(QApplication::clipboard()->mimeData()->text(), image);
> - };
> -#else
> - if (preferSelection) {
> - lastMode = QApplication::clipboard()->supportsSelection() ?
> QClipboard::Selection : QClipboard::Clipboard; -
> postContent(QApplication::clipboard()->text(lastMode),
> QApplication::clipboard()->image(lastMode)); - } else {
> - postContent(QApplication::clipboard()->text(),
> QApplication::clipboard()->image()); - }
> -#endif //Q_WS_WIN
> -}
> -
> -void Pastebin::postContent(QString text, const QImage& imageData)
> -{
> - QString sourceName;
> - KUrl testPath(text);
> - bool validPath = true;
> -
> - // use KIO to check if the file exists using mimetype job
> - KIO::MimetypeJob *mjob = KIO::mimetype(testPath);
> - if (!mjob->exec()) {
> - // it's not a file - usually this happens when we are
> - // just sharing plain text or image
> - validPath = false;
> - }
> -
> - KConfigGroup cg = config();
> - // This is needed to provide smooth transition between old config and
> new one - const QString txtProvider = cg.readEntry("TextProvider",
> getDefaultTextServer()); - const QString imgProvider =
> cg.readEntry("ImageProvider", m_imgServers.keys().at(0)); -
> - bool isTemporary = false;
> - if (validPath) {
> - KMimeType::Ptr type = KMimeType::findByPath(testPath.path());
> -
> - if (type->name().indexOf("image/") != -1) {
> - // its image
> - sourceName = m_imgServers.value(imgProvider);
> - } else {
> - // its text
> - sourceName = m_txtServers.value(txtProvider);
> - }
> - } else if (imageData.isNull()) {
> - sourceName = m_txtServers.value(txtProvider);
> - } else {
> - sourceName = m_imgServers.value(imgProvider);
> -
> - KTemporaryFile tempFile;
> - tempFile.setSuffix(".png");
> - if (tempFile.open()) {
> - tempFile.setAutoRemove(false);
> -
> - imageData.save(&tempFile, "PNG");
> - tempFile.close();
> -
> - text = tempFile.fileName();
> -
> - isTemporary = true;
> - } else {
> - setActionState(IdleError);
> - return;
> - }
> - }
> -
> - kDebug() << "Is valid path: " << validPath;
> - kDebug() << "Provider used: " << sourceName;
> -
> - if (sourceName.isEmpty()) {
> - // no provider was configured
> - showErrors();
> - return;
> - }
> -
> - m_postingService = m_engine->serviceForSource(sourceName);
> - KConfigGroup ops = m_postingService->operationDescription("share");
> - ops.writeEntry("content", text);
> -
> - Plasma::ServiceJob *job = m_postingService->startOperationCall(ops);
> - if (isTemporary) // Store tempfile-job mapping for cleanup when
> finished. - m_pendingTempFileJobs[job] = text;
> - connect(job, SIGNAL(finished(KJob*)), this,
> SLOT(postingFinished(KJob*))); -
> - setActionState(Sending);
> - m_timer->start(20000);
> -}
> -
> -void Pastebin::postingFinished(KJob *job)
> -{
> - Plasma::ServiceJob *sjob = static_cast<Plasma::ServiceJob*>(job);
> - if (sjob->error()) {
> - showErrors();
> - } else {
> - showResults(sjob->result().toString());
> - }
> -
> - // Cleanup of temp file...
> - QString tempUrl = m_pendingTempFileJobs.take(job);
> - if (!tempUrl.isEmpty())
> - KIO::file_delete(KUrl(tempUrl), KIO::HideProgressInfo);
> -}
> -
> -
> -
> -#include "pastebin.moc"
> diff --git a/applets/pastebin/pastebin.h b/applets/pastebin/pastebin.h
> deleted file mode 100644
> index 931057f..0000000
> --- a/applets/pastebin/pastebin.h
> +++ /dev/null
> @@ -1,182 +0,0 @@
> -/**************************************************************************
> * - * Copyright (C) 2007 by Thomas Georgiou <TAGeorgiou at gmail.com>
> * - * Artur Duque de Souza <asouza at 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 PASTEBIN_H
> -#define PASTEBIN_H
> -
> -#include "ui_pastebinConfig.h"
> -
> -#include <KDE/KIO/TransferJob>
> -#include <KDE/KIO/Job>
> -
> -#include <Plasma/Applet>
> -#include <Plasma/Label>
> -
> -#include <Plasma/ToolTipContent>
> -#include <Plasma/ToolTipManager>
> -
> -#include <QClipboard>
> -#include <QTimer>
> -#include <QPen>
> -#include <QWeakPointer>
> -
> -class QSignalMapper;
> -class KAction;
> -class QPropertyAnimation;
> -
> -namespace Plasma
> -{
> - class Service;
> -}
> -
> -namespace KNS3 {
> - class DownloadDialog;
> -}
> -
> -class Pastebin : public Plasma::Applet
> -{
> - Q_OBJECT
> - Q_PROPERTY(qreal animationUpdate READ animationValue WRITE
> animationUpdate) -public:
> - Pastebin(QObject *parent, const QVariantList &args);
> - ~Pastebin();
> -
> - void init();
> - QList<QAction*> contextualActions();
> - void setHistorySize(int max);
> -
> - void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem
> *option, - const QRect &contents);
> - void constraintsEvent(Plasma::Constraints constraints);
> -
> - qreal animationValue() const;
> -
> - enum InteractionState { /* What is the user doing, used for visual
> feedback on user actions */ - Off = 0, /* Not set */
> - Waiting = 1, /* Applet hanging around idle */
> - Hovered = 2, /* "empty" mouse over effect */
> - Rejected = 3, /* unsuitable content is dragged over us */
> - DraggedOver = 5 /* suitable content is dragged over us */
> - };
> -
> - enum ActionState { /* What is the applet doing */
> - Unset = 0, /* Not set */
> - Idle = 1, /* The applet has been started but nothing done
> yet */ - IdleError = 2, /* The last action went wrong, but we're
> ready to give it another try */ - IdleSuccess = 4, /* Last action
> succeeded */
> - Sending = 8 /* Sending data to the server, waiting for reply
> */ - };
> -
> - enum textServers { PASTEBINCA, PASTEBINCOM };
> - enum imageServers { IMAGEBINCA, IMAGESHACK, SIMPLESTIMAGEHOSTING, IMGUR
> }; -
> -public slots:
> - void configAccepted();
> - void configChanged();
> - void dataUpdated(const QString &source, const Plasma::DataEngine::Data
> &data); - void sourceAdded(const QString &source);
> - void sourceRemoved(const QString &source);
> -
> -protected slots:
> - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
> - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
> - void showResults(const QString &url);
> - void showErrors();
> - void openLink(bool old = true);
> - void postClipboard();
> -
> -protected:
> - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
> - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
> - void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
> - void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
> - void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
> - void dropEvent(QGraphicsSceneDragDropEvent *event);
> - void createConfigurationInterface(KConfigDialog *parent);
> - void paintPixmap(QPainter *painter, QPixmap &pixmap,
> - const QRectF &rect, qreal opacity = 1.0);
> -
> -private slots:
> - void animationUpdate(qreal progress);
> - void updateTheme();
> - void resetActionState();
> - void copyToClipboard(const QString &url);
> - void postingFinished(KJob *job);
> - void getNewStuff();
> - void newStuffFinished();
> - void refreshConfigDialog();
> -
> -private:
> - int iconSize();
> - void showOverlay(bool show);
> - void postContent(QString text, const QImage& imageData);
> - void postClipboard(bool preferSelection);
> -
> - void addToHistory(const QString &url);
> -
> - void setInteractionState(InteractionState state);
> - void setActionState(ActionState state);
> - QString getDefaultTextServer();
> -
> - void saveHistory();
> -
> - ActionState m_actionState;
> - InteractionState m_interactionState;
> -
> - bool m_isHovered;
> - bool m_fadeIn;
> - qreal m_alpha;
> -
> - QTimer *m_timer;
> - QWeakPointer<QPropertyAnimation> m_animation;
> -
> - QFont m_font;
> - QPen m_linePen;
> - QColor m_fgColor;
> - QColor m_bgColor;
> -
> - Plasma::ToolTipContent toolTipData;
> - QString m_url;
> - QString m_oldUrl;
> -
> - QSignalMapper *m_signalMapper;
> - QList<QAction*> m_contextualActions;
> - QList<QAction*> m_actionHistory;
> - KAction *m_paste;
> - QAction *m_topSeparator;
> - QAction *m_bottomSeparator;
> -
> - // New version - below here vars after refactor
> - int m_historySize;
> -
> - QHash<KJob *, QString> m_pendingTempFileJobs;
> - QHash<QString, QString> m_txtServers;
> - QHash<QString, QString> m_imgServers;
> - Plasma::DataEngine *m_engine;
> - Plasma::Service *m_postingService;
> - Ui::pastebinConfig uiConfig;
> - KNS3::DownloadDialog* m_newStuffDialog;
> -
> - QClipboard::Mode lastMode;
> -};
> -
> -K_EXPORT_PLASMA_APPLET(pastebin, Pastebin)
> -
> -#endif
> diff --git a/applets/pastebin/pastebin.knsrc
> b/applets/pastebin/pastebin.knsrc deleted file mode 100644
> index f7fc904..0000000
> --- a/applets/pastebin/pastebin.knsrc
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -[KNewStuff3]
> -ProvidersUrl=http://download.kde.org/ocs/providers.xml
> -Categories=Pastebin Script
> -TargetDir=plasma/shareprovider
> -Uncompress=never
> -InstallationCommand=plasmapkg -t Plasma/ShareProvider -u %f
> -UninstallCommand=plasmapkg -t Plasma/ShareProvider -r %f
> diff --git a/applets/pastebin/pastebinConfig.ui
> b/applets/pastebin/pastebinConfig.ui deleted file mode 100644
> index 540fae7..0000000
> --- a/applets/pastebin/pastebinConfig.ui
> +++ /dev/null
> @@ -1,163 +0,0 @@
> -<?xml version="1.0" encoding="UTF-8"?>
> -<ui version="4.0">
> - <class>pastebinConfig</class>
> - <widget class="QWidget" name="pastebinConfig">
> - <property name="geometry">
> - <rect>
> - <x>0</x>
> - <y>0</y>
> - <width>509</width>
> - <height>200</height>
> - </rect>
> - </property>
> - <property name="minimumSize">
> - <size>
> - <width>300</width>
> - <height>200</height>
> - </size>
> - </property>
> - <property name="windowTitle">
> - <string>Pastebin Config Dialog</string>
> - </property>
> - <layout class="QGridLayout" name="gridLayout_2">
> - <item row="0" column="0">
> - <layout class="QGridLayout" name="gridLayout">
> - <property name="sizeConstraint">
> - <enum>QLayout::SetDefaultConstraint</enum>
> - </property>
> - <item row="0" column="0">
> - <widget class="QLabel" name="textServerLabel">
> - <property name="layoutDirection">
> - <enum>Qt::LeftToRight</enum>
> - </property>
> - <property name="text">
> - <string>Pastebin server:</string>
> - </property>
> - <property name="alignment">
> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> - </property>
> - <property name="buddy">
> - <cstring>textServer</cstring>
> - </property>
> - </widget>
> - </item>
> - <item row="0" column="1">
> - <widget class="KComboBox" name="textServer">
> - <property name="sizePolicy">
> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="minimumSize">
> - <size>
> - <width>150</width>
> - <height>0</height>
> - </size>
> - </property>
> - <property name="maximumSize">
> - <size>
> - <width>250</width>
> - <height>16777215</height>
> - </size>
> - </property>
> - </widget>
> - </item>
> - <item row="1" column="0">
> - <widget class="QLabel" name="imageServerLabel">
> - <property name="layoutDirection">
> - <enum>Qt::LeftToRight</enum>
> - </property>
> - <property name="text">
> - <string>Imagebin server:</string>
> - </property>
> - <property name="alignment">
> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> - </property>
> - <property name="buddy">
> - <cstring>imageServer</cstring>
> - </property>
> - </widget>
> - </item>
> - <item row="1" column="1">
> - <widget class="KComboBox" name="imageServer">
> - <property name="sizePolicy">
> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
> - <horstretch>0</horstretch>
> - <verstretch>0</verstretch>
> - </sizepolicy>
> - </property>
> - <property name="minimumSize">
> - <size>
> - <width>150</width>
> - <height>0</height>
> - </size>
> - </property>
> - <property name="maximumSize">
> - <size>
> - <width>250</width>
> - <height>16777215</height>
> - </size>
> - </property>
> - </widget>
> - </item>
> - <item row="2" column="0">
> - <widget class="QLabel" name="historySizeLabel">
> - <property name="layoutDirection">
> - <enum>Qt::LeftToRight</enum>
> - </property>
> - <property name="text">
> - <string>History size:</string>
> - </property>
> - <property name="alignment">
> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> - </property>
> - <property name="buddy">
> - <cstring>historySize</cstring>
> - </property>
> - </widget>
> - </item>
> - <item row="2" column="1">
> - <widget class="KIntSpinBox" name="historySize">
> - <property name="maximumSize">
> - <size>
> - <width>50</width>
> - <height>16777215</height>
> - </size>
> - </property>
> - <property name="value">
> - <number>3</number>
> - </property>
> - </widget>
> - </item>
> - <item row="3" column="1">
> - <widget class="KPushButton" name="ghnsButton">
> - <property name="text">
> - <string>&Get New Providers</string>
> - </property>
> - </widget>
> - </item>
> - </layout>
> - </item>
> - </layout>
> - </widget>
> - <customwidgets>
> - <customwidget>
> - <class>KIntSpinBox</class>
> - <extends>QSpinBox</extends>
> - <header>knuminput.h</header>
> - </customwidget>
> - <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>
> diff --git a/applets/pastebin/plasma-applet-pastebin.desktop
> b/applets/pastebin/plasma-applet-pastebin.desktop deleted file mode 100644
> index a21dcfc..0000000
> --- a/applets/pastebin/plasma-applet-pastebin.desktop
> +++ /dev/null
> @@ -1,129 +0,0 @@
> -[Desktop Entry]
> -Name=Pastebin
> -Name[ar]=سلة اللصق
> -Name[ast]=Pastebin
> -Name[bs]=Pastebin
> -Name[ca]=Pastebin
> -Name[ca at valencia]=Pastebin
> -Name[cs]=Vkládací koš
> -Name[da]=Pastebin
> -Name[de]=Pastebin
> -Name[el]=Κάδος επικόλλησης
> -Name[en_GB]=Pastebin
> -Name[es]=Pastebin
> -Name[et]=Pastebin
> -Name[eu]=Pastebin
> -Name[fi]=Pastebin
> -Name[fr]=Pastebin
> -Name[ga]=Pastebin
> -Name[gl]=Pastebin
> -Name[he]=Pastebin
> -Name[hr]=Pastebin
> -Name[hu]=Pastebin
> -Name[is]=Límklippusafn (pastebin)
> -Name[it]=Pastebin
> -Name[ja]=Pastebin
> -Name[kk]=Pastebin
> -Name[km]=Pastebin
> -Name[ko]=Pastebin
> -Name[ku]=Pastebin
> -Name[lt]=Pastebin
> -Name[lv]=Pastebin
> -Name[mr]=पेस्टबिन
> -Name[nb]=Pastebin
> -Name[nds]=Pastebin
> -Name[nl]=Pastebin
> -Name[nn]=Teksttavle
> -Name[pa]=ਪੇਸਟਬਿਨ
> -Name[pl]=Pastebin
> -Name[pt]=Colagem
> -Name[pt_BR]=Pastebin
> -Name[ro]=Coș de lipire
> -Name[ru]=Pastebin
> -Name[sk]=Pastebin
> -Name[sl]=Pastebin
> -Name[sq]=Pastebin
> -Name[sr]=корпа налепака
> -Name[sr at ijekavian]=корпа наљепака
> -Name[sr at ijekavianlatin]=korpa naljepaka
> -Name[sr at latin]=korpa nalepaka
> -Name[sv]=Pastebin
> -Name[th]=ถังแปะ (Pastebin)
> -Name[tr]=Pastebin
> -Name[ug]=Pastebin
> -Name[uk]=Вставлячка
> -Name[wa]=Pastebin
> -Name[x-test]=xxPastebinxx
> -Name[zh_CN]=Pastebin
> -Name[zh_TW]=Pastebin
> -Comment=Paste text/images to a remote server
> -Comment[ar]=الصق نص/صور في خادم بعيد
> -Comment[ast]=Pegar testu/imáxenes a un sirvidor remotu
> -Comment[bs]=Umeće tekst/slike na udaljeni server
> -Comment[ca]=Enganxa text/imatges en un servidor remot
> -Comment[ca at valencia]=Apega text/imatges en un servidor remot
> -Comment[cs]=Vložit text/obrázky na vzdálený server
> -Comment[da]=Indsæt tekst/billeder på en ekstern server.
> -Comment[de]=Text und Bilder auf einen entfernten Server hochladen
> -Comment[el]=Επικόλληση κειμένου/εικόνων σε έναν απομακρυσμένο εξυπηρετητή
> -Comment[en_GB]=Paste text/images to a remote server
> -Comment[es]=Pegar texto/imágenes a un servidor remoto
> -Comment[et]=Tekstide/piltide kopeerimine võrguserverisse
> -Comment[eu]=Itsatsi testua/irudiak urruneko zerbitzari batera
> -Comment[fi]=Liittää tekstiä tai kuvaa etäpalvelimeen
> -Comment[fr]=Colle du texte ou des images vers un serveur distant
> -Comment[ga]=Greamaigh téacs/íomhánna ar fhreastalaí cianda
> -Comment[gl]=Pega texto/imaxes nun servidor remoto
> -Comment[he]=מעתיק טקסט או תמונות לשרת חיצוני
> -Comment[hr]=Zalijepi tekst/slike na udaljeni poslužitelj
> -Comment[hu]=Szöveg vagy kép beillesztése távoli kiszolgálóra
> -Comment[is]=Líma texta/myndir yfir á fjarlægan þjón
> -Comment[it]=Incolla testo/immagini su un server remoto
> -Comment[ja]=テキストや画像をリモートサーバに貼り付けます
> -Comment[kk]=Мәтін/Кескінді қашық серверінде орналастыру
> -Comment[km]=បិទភ្ជាប់អត្ថបទ/រូបភាពទៅម៉ាស៊ីនបម្រើពីចម្ងាយ
> -Comment[ko]=원격 서버에 텍스트/이미지 붙여넣기
> -Comment[ku]=Nivîs/wêne yan pêve bike di pêşkêşkera dûr de
> -Comment[lt]=Padėti tekstą/paveikslėlius į nutolusį serverį
> -Comment[lv]=Ielīmēt tekstu/attēlus attālinātā serverī
> -Comment[mr]=दूरस्थ सर्व्हरवर मजकूर / प्रतिमा चिटकवा
> -Comment[nb]=Lim «inn» tekst/bilder til en nettverkstjener
> -Comment[nds]=Text oder Biller op en feern Server infögen
> -Comment[nl]=Tekst/afbeeldingen plakken op een externe server
> -Comment[nn]=Kopier tekst og bilete til tenar på nettet
> -Comment[pa]=ਟੈਕਸਟ/ਚਿੱਤਰ ਰਿਮੋਟ ਸਰਵਰ ਉੱਤੇ ਚੇਪੋ
> -Comment[pl]=Wklejanie tekstu/obrazów na zdalny serwer
> -Comment[pt]=Colar o texto/imagens num servidor remoto
> -Comment[pt_BR]=Cola textos e imagens em um servidor remoto
> -Comment[ro]=Lipește text/imagini spre un server distant
> -Comment[ru]=Временная публикация текста и изображений на удалённых серверах
> -Comment[sk]=Vloženie textu/obrázkov na vzdialený server
> -Comment[sl]=Prilepi besedilo/slike na oddaljeni strežnik
> -Comment[sr]=Налепљује текст и слике на удаљени сервер
> -Comment[sr at ijekavian]=Наљепљује текст и слике на удаљени сервер
> -Comment[sr at ijekavianlatin]=Naljepljuje tekst i slike na udaljeni server
> -Comment[sr at latin]=Nalepljuje tekst i slike na udaljeni server
> -Comment[sv]=Klistra in text eller bilder på en fjärrserver
> -Comment[th]=แปะข้อความ/รูปภาพ ไปยังเครื่อแม่ข่ายทางไกล
> -Comment[tr]=Bir uzak sunucuya metin/resim yapıştır
> -Comment[uk]=Викласти текст/зображення на віддалений сервер
> -Comment[wa]=Aclaper do tecse/imådjes viè on sierveu då lon
> -Comment[x-test]=xxPaste text/images to a remote serverxx
> -Comment[zh_CN]=向远程服务器粘贴文本/图像
> -Comment[zh_TW]=將文字/影像貼到遠端伺服器
> -Type=Service
> -Icon=edit-paste
> -
> -X-KDE-ServiceTypes=Plasma/Applet
> -X-KDE-Library=plasma_applet_pastebin
> -X-KDE-PluginInfo-Author=The Plasma Team
> -X-KDE-PluginInfo-Email=plasma-devel at kde.org
> -X-KDE-PluginInfo-Name=pastebin
> -X-KDE-PluginInfo-Version=1.0
> -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=Required
> diff --git a/applets/pastebin/plasma_pastebin.notifyrc
> b/applets/pastebin/plasma_pastebin.notifyrc deleted file mode 100644
> index c0a23c4..0000000
> --- a/applets/pastebin/plasma_pastebin.notifyrc
> +++ /dev/null
> @@ -1,217 +0,0 @@
> -[Global]
> -Name=Pastebin
> -Name[ar]=سلة اللصق
> -Name[ast]=Pastebin
> -Name[bs]=Pastebin
> -Name[ca]=Pastebin
> -Name[ca at valencia]=Pastebin
> -Name[cs]=Vkládací koš
> -Name[da]=Pastebin
> -Name[de]=Pastebin
> -Name[el]=Κάδος επικόλλησης
> -Name[en_GB]=Pastebin
> -Name[es]=Pastebin
> -Name[et]=Pastebin
> -Name[eu]=Pastebin
> -Name[fi]=Pastebin
> -Name[fr]=Pastebin
> -Name[ga]=Pastebin
> -Name[gl]=Pastebin
> -Name[he]=Pastebin
> -Name[hr]=Pastebin
> -Name[hu]=Pastebin
> -Name[is]=Límklippusafn (pastebin)
> -Name[it]=Pastebin
> -Name[ja]=Pastebin
> -Name[kk]=Pastebin
> -Name[km]=Pastebin
> -Name[ko]=Pastebin
> -Name[ku]=Pastebin
> -Name[lt]=Pastebin
> -Name[lv]=Pastebin
> -Name[mr]=पेस्टबिन
> -Name[nb]=Pastebin
> -Name[nds]=Pastebin
> -Name[nl]=Pastebin
> -Name[nn]=Teksttavle
> -Name[pa]=ਪੇਸਟਬਿਨ
> -Name[pl]=Pastebin
> -Name[pt]=Colagem
> -Name[pt_BR]=Pastebin
> -Name[ro]=Coș de lipire
> -Name[ru]=Pastebin
> -Name[sk]=Pastebin
> -Name[sl]=Pastebin
> -Name[sq]=Pastebin
> -Name[sr]=корпа налепака
> -Name[sr at ijekavian]=корпа наљепака
> -Name[sr at ijekavianlatin]=korpa naljepaka
> -Name[sr at latin]=korpa nalepaka
> -Name[sv]=Pastebin
> -Name[th]=ถังแปะ (Pastebin)
> -Name[tr]=Pastebin
> -Name[ug]=Pastebin
> -Name[uk]=Вставлячка
> -Name[wa]=Pastebin
> -Name[x-test]=xxPastebinxx
> -Name[zh_CN]=Pastebin
> -Name[zh_TW]=Pastebin
> -IconName=edit-paste
> -Comment=Pastebin Widget
> -Comment[ar]=ودجة سلة اللصق
> -Comment[ast]=Miniaplicación de Pastebin
> -Comment[bs]=Pastebin kontrola
> -Comment[ca]=Estri Pastebin
> -Comment[ca at valencia]=Estri Pastebin
> -Comment[cs]=Pastebin applet
> -Comment[da]=Pastebin-widget
> -Comment[de]=Pastebin-Miniprogramm
> -Comment[el]=Γραφικό συστατικό κάδου επικόλλησης
> -Comment[en_GB]=Pastebin Widget
> -Comment[es]=Control de Pastebin
> -Comment[et]=Pastebini vidin
> -Comment[fi]=Pastebin-sovelma
> -Comment[fr]=Composant graphique Pastebin
> -Comment[ga]=Giuirléid Pastebin
> -Comment[gl]=Widget dos retallos remotos
> -Comment[hr]=Widget Pastebin
> -Comment[hu]=Pastebin widget
> -Comment[is]=Límklippugræja
> -Comment[it]=Oggetto Pastebin
> -Comment[ja]=Pastebin ウィジェット
> -Comment[kk]=Pastebin виджеті
> -Comment[km]=ធាតុក្រាហ្វិក Pastebin
> -Comment[ko]=Pastebin 위젯
> -Comment[lt]=Pastebin valdiklis
> -Comment[lv]=Pastebin sīkrīks
> -Comment[mr]=पेस्टबिन विजेट
> -Comment[nb]=Pastebin skjermelement
> -Comment[nds]=Pastebin-Stüerelement
> -Comment[nl]=Pastebin-widget
> -Comment[nn]=Teksttavle-element
> -Comment[pa]=ਪੇਸਟਬਿਨ ਵਿਦਜੈੱਟ
> -Comment[pl]=Element interfejsu: Pastebin
> -Comment[pt]=Item de Colagem
> -Comment[pt_BR]=Widget do Pastebin
> -Comment[ro]=Control Coș de lipire
> -Comment[ru]=Виджет Pastebin
> -Comment[sk]=Widget Pastebin
> -Comment[sl]=Gradnik Pastebin
> -Comment[sq]=Pastebin Widget
> -Comment[sr]=Виџет корпе налепака
> -Comment[sr at ijekavian]=Виџет корпе наљепака
> -Comment[sr at ijekavianlatin]=Vidžet korpe naljepaka
> -Comment[sr at latin]=Vidžet korpe nalepaka
> -Comment[sv]=Grafisk Pastebin-komponent
> -Comment[th]=วิดเจ็ตถังแปะ (Pastebin)
> -Comment[tr]=Pastebin Programcığı
> -Comment[uk]=Віджет Pastebin
> -Comment[wa]=Ahesse Pastebin
> -Comment[x-test]=xxPastebin Widgetxx
> -Comment[zh_CN]=Pastebin 部件
> -Comment[zh_TW]=Pastebin 元件
> -Version=1
> -
> -[Event/urlcopied]
> -Name=Copied pastebin link
> -Name[ar]=وصلة سلطة اللصق منسوخة
> -Name[ast]=Enllaz de pastebin copiáu
> -Name[bs]=Kopirana pastebin veza
> -Name[ca]=Enllaç pastebin copiat
> -Name[ca at valencia]=Enllaç pastebin copiat
> -Name[cs]=Pastebin odkaz zkopírován
> -Name[da]=Kopieret pastebin-link
> -Name[de]=Kopierte Pastebin-Verknüpfung
> -Name[el]=Αντιγραφή δεσμού κάδου επικόλλησης
> -Name[en_GB]=Copied pastebin link
> -Name[es]=Enlace de pastebin copiado
> -Name[et]=Pastebini lingi kopeerimine
> -Name[fi]=Kopioitiin Pastebin-linkki
> -Name[fr]=Lien Pastebin copié
> -Name[ga]=Cóipeáladh nasc pastebin
> -Name[gl]=Copiouse a ligazón a pastebin
> -Name[hr]=Kopirani link pastebina
> -Name[hu]=Másolt pastebin-hivatkozás
> -Name[is]=Afritaður tengill á límklippusafn
> -Name[it]=Collegamento pastebin copiato
> -Name[ja]=pastebin リンクをコピーしました
> -Name[kk]=Көшіріп алған pastebin сілтемесі
> -Name[km]=តំណ pastebin ដែលបានចម្លង
> -Name[ko]=pastebin 링크 복사됨
> -Name[lt]=Nukopijuota Pastebin nuoroda
> -Name[lv]=Nokopēta pastebin saite
> -Name[mr]=पेस्टबिन लिंकची प्रत केली
> -Name[nb]=Kopierte pastebin-lenke
> -Name[nds]=Pastebin-Link kopeert
> -Name[nl]=Pastebin-koppeling gekopieerd
> -Name[nn]=Kopiert teksttavle-lenkje
> -Name[pa]=ਕਾਪੀ ਕੀਤਾ ਗਿਆ ਪੇਸਟਬਿਨ ਲਿੰਕ
> -Name[pl]=Skopiowany odnośnik pastebin
> -Name[pt]=Ligação do PasteBin copiada
> -Name[pt_BR]=Link do pastebin copiado
> -Name[ro]=Legătura pentru Coșul de lipire copiată
> -Name[ru]=Скопированная ссылка на Pastebin
> -Name[sk]=Pastebin odkaz skopírovaný
> -Name[sl]=Skopirana povezava Pastebin
> -Name[sr]=Веза копирана из корпе налепака
> -Name[sr at ijekavian]=Веза копирана из корпе наљепака
> -Name[sr at ijekavianlatin]=Veza kopirana iz korpe naljepaka
> -Name[sr at latin]=Veza kopirana iz korpe nalepaka
> -Name[sv]=Kopierade Pastebin-länk
> -Name[tr]=Pastebin bağlantısı kopyalandı
> -Name[uk]=Скопійоване посилання pastebin
> -Name[wa]=Hårdêye copieye di pastebin
> -Name[x-test]=xxCopied pastebin linkxx
> -Name[zh_CN]=已复制 pastebin 链接
> -Name[zh_TW]=已複製 pastebin 連結
> -Comment=The pastebin URL has been copied to the clipboard
> -Comment[ar]=نسخت وصلة سلة اللصق إلى الحافظة.
> -Comment[ast]=Copióse'l URL de pastebin al cartafueyu
> -Comment[bs]=Pastebin URL je kopiran u međuspremnik
> -Comment[ca]=S'ha copiat l'URL de pastebin al porta-retalls
> -Comment[ca at valencia]=S'ha copiat l'URL de pastebin al porta-retalls
> -Comment[cs]=Pastebin URL bylo zkopírováno do schránky
> -Comment[da]=Pastebin-URL'en er blevet kopieret til udklipsholderen.
> -Comment[de]=Die Pastebin-Adresse wurde in die Zwischenablage kopiert
> -Comment[el]=Το URL του κάδου επικόλλησης αντιγράφτηκε στο πρόχειρο
> -Comment[en_GB]=The pastebin URL has been copied to the clipboard
> -Comment[es]=Se ha copiado la URL de pastebin al portapapeles
> -Comment[et]=Pastebini URL kopeeriti lõikepuhvrisse
> -Comment[fi]=Pastebin-osoite kopioitiin leikepöydälle
> -Comment[fr]=L'URL Pastebin a été copiée dans le presse-papier
> -Comment[ga]=Cóipeáladh URL pastebin go dtí an ghearrthaisce
> -Comment[gl]=O URL de pastebin copiouse no portarretallos
> -Comment[hr]=URL pastebina kopiran je u odlagalište
> -Comment[hu]=A beillesztett szöveg pastebin URL-címe a vágólapra került
> -Comment[is]=Slóð á límklippusafn hefur verið afrituð á klippispjald
> -Comment[it]=L'URL pastebin è stato copiato negli appunti
> -Comment[ja]=pastebin の URL をクリップボードにコピーしました
> -Comment[kk]=Алмасу буферіне pastebin URL сілтемесі көшіріп алынды
> -Comment[km]=URL pastebin ត្រូវបានចម្លងទៅក្ដារតម្បៀតខ្ទាស់
> -Comment[ko]=pastebin URL을 클립보드에 복사했습니다
> -Comment[lt]=Pastebin URL buvo nukopijuotas į iškarpinę
> -Comment[lv]=Pastebin URL tika iekopēts starpliktuvē
> -Comment[mr]=पेस्टबिन URL ची प्रत क्लिपबोर्ड वर केली आहे
> -Comment[nb]=Pastebin-URL-en er kopiert til utklippstavla
> -Comment[nds]=De Pastebin-URL wöör na de Twischenaflaag kopeert
> -Comment[nl]=De pastebin-URL is gekopieerd naar het klembord
> -Comment[nn]=Teksttavle-adressa er kopiert til utklippstavla
> -Comment[pl]=Adres pastebin został skopiowany do schowka
> -Comment[pt]=O URL do PasteBin foi copiado para a área de transferência
> -Comment[pt_BR]=A URL do pastebin foi copiada para a área de transferência
> -Comment[ro]=URL-ul coșului de lipire a fost copiat în clipboard
> -Comment[ru]=Ссылка на Pastebin была скопирована в буфер обмена
> -Comment[sk]=Pastebin URL adresa bola skopírovaná do schránky
> -Comment[sl]=URL za Pastebin je bil skopiran na odložišče
> -Comment[sr]=УРЛ корпе налепака копиран је у клипборд
> -Comment[sr at ijekavian]=УРЛ корпе наљепака копиран је у клипборд
> -Comment[sr at ijekavianlatin]=URL korpe naljepaka kopiran je u klipbord
> -Comment[sr at latin]=URL korpe nalepaka kopiran je u klipbord
> -Comment[sv]=Pastebin-webbadressen har kopierats till klippbordet
> -Comment[tr]=Pastebin adresi panoya kopyalandı
> -Comment[uk]=Адресу URL pastebin було скопійовано до буфера обміну даними
> -Comment[wa]=L' URL di pastebin a stî copieye e presse-papî
> -Comment[x-test]=xxThe pastebin URL has been copied to the clipboardxx
> -Comment[zh_CN]=Pastebin URL 已复制到剪贴板
> -Comment[zh_TW]=Pastebin 網址已複製到剪貼簿。
> -Action=Popup
> diff --git a/applets/quickshare/contents/config/config.qml
> b/applets/quickshare/contents/config/config.qml new file mode 100644
> index 0000000..f9d08b6
> --- /dev/null
> +++ b/applets/quickshare/contents/config/config.qml
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright 2014 Aleix Pol Gonzalez <aleixpol at blue-systems.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) 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/>
> + */
> +
> +import QtQuick 2.0
> +
> +import org.kde.plasma.configuration 2.0
> +
> +ConfigModel {
> + ConfigCategory {
> + name: i18n("General")
> + icon: "edit-paste"
> + source: "settingsGeneral.qml"
> + }
> +}
> diff --git a/applets/quickshare/contents/config/main.xml
> b/applets/quickshare/contents/config/main.xml new file mode 100644
> index 0000000..db46b70
> --- /dev/null
> +++ b/applets/quickshare/contents/config/main.xml
> @@ -0,0 +1,15 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
> + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
> + <kcfgfile name=""/>
> +
> + <group name="Appearance">
> + <entry name="text" type="String"> <default>kde</default> </entry>
> + <entry name="image" type="String"> <default>wstaw</default> </entry>
> +
> + <entry name="historySize" type="int"> <default>3</default> </entry>
> + </group>
> +
> +</kcfg>
> diff --git a/applets/quickshare/contents/ui/PasteMenuItem.qml
> b/applets/quickshare/contents/ui/PasteMenuItem.qml new file mode 100644
> index 0000000..3aacf10
> --- /dev/null
> +++ b/applets/quickshare/contents/ui/PasteMenuItem.qml
> @@ -0,0 +1,28 @@
> +/**************************************************************************
> * + * Copyright (C) 2013 by Aleix Pol Gonzalez <aleixpol at blue-systems.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 . * +
> ***************************************************************************
> / +
> +import QtQuick 2.2
> +import org.kde.plasma.components 2.0 as PlasmaComponents
> +
> +PlasmaComponents.MenuItem
> +{
> + onClicked: {
> + Qt.openUrlExternally(text);
> + }
> +}
> diff --git a/applets/quickshare/contents/ui/main.qml
> b/applets/quickshare/contents/ui/main.qml new file mode 100644
> index 0000000..2ab85ff
> --- /dev/null
> +++ b/applets/quickshare/contents/ui/main.qml
> @@ -0,0 +1,223 @@
> +/**************************************************************************
> * + * Copyright (C) 2013 by Aleix Pol Gonzalez <aleixpol at blue-systems.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 . * +
> ***************************************************************************
> / +
> +import QtQuick 2.2
> +import org.kde.plasma.core 2.0 as PlasmaCore
> +import org.kde.plasma.components 2.0 as PlasmaComponents
> +import org.kde.qtextracomponents 2.0 as QtExtra
> +
> +DropArea {
> + id: root
> +
> + property string url: ""
> + property bool properlySent: true
> + property QtObject lastJob: null
> +
> + function isImage(drop) {
> + for(var x in drop.formats) {
> + if(x.indexOf("image/")==0) {
> + return true;
> + }
> + }
> + return false;
> + }
> +
> + function preferredSourceForDrop(mime) {
> + var category = mime.substr(0, mime.indexOf("/"));
> + var ret = plasmoid.configuration[category];
> + if (ret == "") {
> + console.log("Couldn't find a backend for", mime);
> + }
> + return ret;
> + }
> +
> + onEntered: {
> + if(drag.hasText)
> + icon.source = "text-plain"
> + else if(isImage(drag))
> + icon.source = "application-vnd.oasis.opendocument.image"
> + }
> +
> + QtExtra.Clipboard {
> + id: clipboard
> + }
> +
> + Component {
> + id: menuItemComponent
> + PasteMenuItem {}
> + }
> +
> + function sendData(format, data) {
> + var service =
> shareDataSource.serviceForSource(preferredSourceForDrop(format)); +
> var operation = service.operationDescription("share");
> + operation.content = data;
> + root.lastJob = service.startOperationCall(operation);
> + root.lastJob.finished.connect(function(){
> + root.state = root.lastJob.error==0 ? "success" : "failure";
> + var resultUrl = root.lastJob.result;
> +
> + if (root.lastJob.error==0) {
> + root.url = resultUrl;
> + clipboard.content = root.url;
> +
> + menuItemComponent.createObject(menu, {"text": root.url});
> + if(menu.content.length >=
> 2+plasmoid.configuration.historySize) { +
> menu.at(2).deleteLater()
> + }
> + }
> + });
> + root.state = "sending";
> + }
> +
> + onDropped: {
> + sendData(drop.formats[0], drop.getDataAsString(drop.formats[0]))
> + drop.accept();
> + }
> +
> + onExited: icon.source = "edit-paste"
> +
> + PlasmaComponents.ContextMenu {
> + id: menu
> + visualParent: parent
> +
> + PlasmaComponents.MenuItem {
> + text: i18n("Paste")
> + icon: "edit-paste"
> +
> + onClicked: {
> + sendData(clipboard.formats[0], clipboard.content);
> + }
> + }
> +
> + PlasmaComponents.MenuItem { separator: true }
> + }
> +
> + PlasmaCore.Dialog {
> + id: tooltipDialog
> + visualParent: parent
> +
> + mainItem: Item {
> + width: 300
> + height: 100
> +
> + PlasmaCore.IconItem {
> + id: tooltipIcon
> + width: parent.width*.25
> + anchors {
> + left: parent.left
> + top: parent.top
> + bottom: parent.bottom
> + }
> + source: "edit-paste"
> + }
> +
> + PlasmaComponents.Label {
> + id: tooltipText
> + wrapMode: Text.WordWrap
> + verticalAlignment: Text.AlignVCenter
> + horizontalAlignment: Text.AlignHCenter
> +
> + onLinkActivated: Qt.openUrlExternally(link)
> + anchors {
> + left: tooltipIcon.right
> + right: parent.right
> + bottom: parent.bottom
> + top: parent.top
> + }
> + }
> + }
> + }
> +
> + PlasmaCore.IconItem {
> + id: icon
> + anchors.fill: parent
> + }
> +
> + PlasmaComponents.BusyIndicator {
> + id: busy
> + anchors.fill: parent
> + visible: false
> + }
> +
> + Rectangle {
> + border {
> + color: theme.textColor
> + width: root.containsDrag ? 5 : 1
> + }
> + color: theme.backgroundColor
> + radius: 35
> + anchors.fill: parent
> + opacity: root.containsDrag || mouseArea.containsMouse ? .3 : 0
> +
> + Behavior on opacity { NumberAnimation { duration: 100 } }
> + }
> +
> + MouseArea {
> + id: mouseArea
> + anchors.fill: parent
> + hoverEnabled: true
> + acceptedButtons: Qt.RightButton
> +
> + onClicked: {
> + menu.open()
> + }
> + }
> +
> + PlasmaCore.DataSource {
> + id: shareDataSource
> + engine: "org.kde.plasma.dataengine.share"
> + connectedSources: sources
> + }
> +
> + state: "idle"
> + states: [
> + State {
> + name: "idle"
> + PropertyChanges { target: icon; source: "edit-paste" }
> + PropertyChanges { target: tooltipIcon; source: "edit-paste" }
> + PropertyChanges { target: tooltipText; text: i18n("Drop text or
> an image onto me to upload it to an online service.") } + },
> + State {
> + name: "sending"
> + PropertyChanges { target: icon; visible: false }
> + PropertyChanges { target: busy; visible: true }
> + PropertyChanges { target: busy; running: true }
> +
> + PropertyChanges { target: tooltipIcon; source: "view-history" }
> + PropertyChanges { target: tooltipText; text:
> i18n("Sending...") } + PropertyChanges { target: tooltipDialog;
> visible: true } + },
> + State {
> + name: "success"
> + PropertyChanges { target: icon; source: "dialog-ok" }
> +
> + PropertyChanges { target: tooltipIcon; source: "dialog-ok" }
> + PropertyChanges { target: tooltipText; text: i18n("Successfully
> uploaded to <a href='%1'>%1</a>.", root.url) } + PropertyChanges
> { target: tooltipDialog; visible: true } + },
> + State {
> + name: "failure"
> + PropertyChanges { target: icon; source: "dialog-cancel" }
> +
> + PropertyChanges { target: tooltipIcon; source: icon.source }
> + PropertyChanges { target: tooltipText; text: i18n("Error during
> upload. Try again.") } + PropertyChanges { target:
> tooltipDialog; visible: true } + }
> + ]
> +}
> diff --git a/applets/quickshare/contents/ui/settingsGeneral.qml
> b/applets/quickshare/contents/ui/settingsGeneral.qml new file mode 100644
> index 0000000..102f8d0
> --- /dev/null
> +++ b/applets/quickshare/contents/ui/settingsGeneral.qml
> @@ -0,0 +1,71 @@
> +/**************************************************************************
> * + * Copyright (C) 2013 by Aleix Pol Gonzalez <aleixpol at blue-systems.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 . * +
> ***************************************************************************
> / +
> +import QtQuick 2.2
> +import QtQuick.Controls 1.0 as QtControls
> +import QtQuick.Layouts 1.0 as QtLayouts
> +import org.kde.plasma.core 2.0 as PlasmaCore
> +
> +Item
> +{
> + id: configRoot
> + property string cfg_text
> + property string cfg_image
> + property alias cfg_historySize: historySpin.value
> +
> + onCfg_textChanged: textServicesCombo.currentIndex =
> textServicesCombo.find(configRoot.cfg_text); + onCfg_imageChanged:
> imageServicesCombo.currentIndex =
> imageServicesCombo.find(configRoot.cfg_image); +
> + QtLayouts.GridLayout {
> + anchors {
> + left: parent.left
> + right: parent.right
> + top: parent.top
> + }
> + columns: 2
> +
> + PlasmaCore.DataSource {
> + id: shareDataSource
> + engine: "org.kde.plasma.dataengine.share"
> + connectedSources: ["Mimetypes"]
> + }
> +
> + QtControls.Label { text: i18n("Text Service:") }
> + QtControls.ComboBox {
> + id: textServicesCombo
> + enabled: shareDataSource.data["Mimetypes"] != null
> + model: shareDataSource.data["Mimetypes"]["text/*"]
> + onCurrentTextChanged: configRoot.cfg_text = currentText
> + }
> +
> + QtControls.Label { text: i18n("Image Service:") }
> + QtControls.ComboBox {
> + id: imageServicesCombo
> + enabled: shareDataSource.data["Mimetypes"] != null
> + model: shareDataSource.data["Mimetypes"]["image/*"]
> + onCurrentTextChanged: configRoot.cfg_image = currentText
> + }
> +
> + QtControls.Label { text: i18n("History Size:") }
> + QtControls.SpinBox {
> + id: historySpin
> + value: 3
> + }
> + }
> +}
> diff --git a/applets/quickshare/metadata.desktop
> b/applets/quickshare/metadata.desktop new file mode 100644
> index 0000000..6888bca
> --- /dev/null
> +++ b/applets/quickshare/metadata.desktop
> @@ -0,0 +1,26 @@
> +[Desktop Entry]
> +Name=Quick Share
> +Comment=Paste text/images to a remote server
> +Encoding=UTF-8
> +
> +Icon=edit-paste
> +Type=Service
> +X-KDE-ServiceTypes=Plasma/Applet
> +
> +X-Plasma-API=declarativeappletscript
> +
> +X-Plasma-MainScript=ui/main.qml
> +
> +X-KDE-ServiceTypes=Plasma/Applet
> +X-KDE-PluginInfo-Author=The Plasma Team
> +X-KDE-PluginInfo-Email=plasma-devel at kde.org
> +X-KDE-PluginInfo-Name=org.kde.plasma.quickshare
> +X-KDE-PluginInfo-Version=2.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
> +
> +X-Plasma-Requires-FileDialog=Unused
> +X-Plasma-Requires-LaunchApp=Required
More information about the Plasma-devel
mailing list