[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:23:06 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=0cd3262
The following commit has been merged in the master branch:
commit 0cd3262738f93474895d9756f8689c71313ebd65
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Fri Jan 4 00:30:44 2013 +0000
remove newly added dependency on KDEPIM libs 4.10, by copying relevant code
Reviewed-by: Dan Vratil
---
CMakeLists.txt | 5 +-
app/CMakeLists.txt | 5 +-
app/chat-window.cpp | 4 +-
app/emoticon-text-edit-action.cpp | 65 ++++++++++++++++++
app/emoticon-text-edit-action.h | 40 +++++++++++
app/emoticon-text-edit-selector.cpp | 132 ++++++++++++++++++++++++++++++++++++
app/emoticon-text-edit-selector.h | 62 +++++++++++++++++
7 files changed, 309 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e639404..f9d44be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,10 @@ find_package (KDE4 ${KDE_MIN_VERSION} REQUIRED)
find_package (TelepathyQt4 0.9.1 REQUIRED)
find_package (KTp REQUIRED)
find_package (TelepathyLoggerQt4 0.5.60 REQUIRED)
-find_package(KdepimLibs ${KDE_MIN_VERSION} REQUIRED)
+
+
+# FUTURE: When we can depend on KDE 4.10, use emoticoncontexteditaction from here
+# find_package(KdepimLibs 4.10 REQUIRED)
include (CheckIncludeFiles)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index a9d87bb..39f009d 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -5,7 +5,9 @@ set(ktp-text-ui_SRCS
telepathy-chat-ui.cpp
chat-window.cpp
chat-tab.cpp
- invite-contact-dialog.cpp
+ emoticon-text-edit-action.cpp
+ emoticon-text-edit-selector.cpp
+ invite-contact-dialog.cpp
)
kde4_add_executable(ktp-text-ui ${ktp-text-ui_SRCS})
@@ -14,6 +16,7 @@ target_link_libraries(ktp-text-ui
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
+ ${KDE4_KEMOTICONS_LIBS}
${TELEPATHY_QT4_LIBRARIES}
${KTP_LIBRARIES}
${KTP_MODELS_LIBRARIES}
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 1de8484..53d4b2e 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -56,8 +56,8 @@
#include <TelepathyQt/TextChannel>
#include <Sonnet/DictionaryComboBox>
-#include <kpimtextedit/emoticontexteditaction.h>
+#include "emoticon-text-edit-action.h"
#include "invite-contact-dialog.h"
#define PREFERRED_RFB_HANDLER "org.freedesktop.Telepathy.Client.krfb_rfb_handler"
@@ -647,7 +647,7 @@ void ChatWindow::setupCustomActions()
clearViewAction->setToolTip(i18nc("Toolbar icon tooltip", "Clear all messages from current chat tab"));
connect(clearViewAction, SIGNAL(triggered()), this, SLOT(onClearViewTriggered()));
- KPIMTextEdit::EmoticonTextEditAction *addEmoticonAction = new KPIMTextEdit::EmoticonTextEditAction(this);
+ EmoticonTextEditAction *addEmoticonAction = new EmoticonTextEditAction(this);
connect(addEmoticonAction, SIGNAL(emoticonActivated(QString)), this, SLOT(onAddEmoticon(QString)) );
// add custom actions to the collection
diff --git a/app/emoticon-text-edit-action.cpp b/app/emoticon-text-edit-action.cpp
new file mode 100644
index 0000000..439c594
--- /dev/null
+++ b/app/emoticon-text-edit-action.cpp
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2012 Montel Laurent <montel at kde.org>
+ based on code from kopete
+
+ This library 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 of the License, or (at your
+ option) any later version.
+
+ This library 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 Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+#include "emoticon-text-edit-action.h"
+#include "emoticon-text-edit-selector.h"
+#include <KLocale>
+
+#include <KMenu>
+
+#include <QWidgetAction>
+
+class EmoticonTextEditAction::EmoticonTextEditActionPrivate
+{
+public:
+ EmoticonTextEditActionPrivate() {
+ emoticonMenu = new KMenu();
+ selector = new EmoticonTextEditSelector( emoticonMenu );
+ QWidgetAction *action = new QWidgetAction( emoticonMenu );
+ action->setDefaultWidget( selector );
+ emoticonMenu->addAction( action );
+ connect( emoticonMenu, SIGNAL(aboutToShow()), selector, SLOT(slotCreateEmoticonList()) );
+
+ }
+ ~EmoticonTextEditActionPrivate() {
+ delete emoticonMenu;
+ }
+
+ KMenu *emoticonMenu;
+ EmoticonTextEditSelector *selector;
+};
+
+EmoticonTextEditAction::EmoticonTextEditAction( QObject * parent )
+ : KActionMenu( i18n( "Add Smiley" ), parent ), d( new EmoticonTextEditActionPrivate() )
+{
+ setMenu( d->emoticonMenu );
+ setIcon( KIcon( QLatin1String( "face-smile" ) ) );
+ setShortcutConfigurable( false );
+ setDelayed( false );
+ connect( d->selector, SIGNAL(itemSelected(QString)),
+ this, SIGNAL(emoticonActivated(QString)) );
+
+}
+
+EmoticonTextEditAction::~EmoticonTextEditAction()
+{
+ delete d;
+}
+
+#include "emoticon-text-edit-action.moc"
diff --git a/app/emoticon-text-edit-action.h b/app/emoticon-text-edit-action.h
new file mode 100644
index 0000000..a5ae531
--- /dev/null
+++ b/app/emoticon-text-edit-action.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (c) 2012 Montel Laurent <montel at kde.org>
+ based on code from kopete
+
+ This library 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 of the License, or (at your
+ option) any later version.
+
+ This library 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 Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#ifndef EMOTICONTEXTEDITACTION_H
+#define EMOTICONTEXTEDITACTION_H
+
+#include <KActionMenu>
+
+class EmoticonTextEditAction : public KActionMenu
+{
+ Q_OBJECT
+public:
+ explicit EmoticonTextEditAction( QObject * parent );
+ ~EmoticonTextEditAction();
+Q_SIGNALS:
+ void emoticonActivated(const QString&);
+private:
+ class EmoticonTextEditActionPrivate;
+ EmoticonTextEditActionPrivate *d;
+};
+
+#endif /* EMOTICONTEXTEDITACTION_H */
+
diff --git a/app/emoticon-text-edit-selector.cpp b/app/emoticon-text-edit-selector.cpp
new file mode 100644
index 0000000..1fad99b
--- /dev/null
+++ b/app/emoticon-text-edit-selector.cpp
@@ -0,0 +1,132 @@
+/*
+ Copyright (c) 2012 Montel Laurent <montel at kde.org>
+ based on code from kopete
+
+ This library 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 of the License, or (at your
+ option) any later version.
+
+ This library 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 Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#include "emoticon-text-edit-selector.h"
+
+#include <KEmoticons>
+#include <kemoticonstheme.h>
+
+#include <QListWidget>
+#include <QPixmap>
+#include <QHBoxLayout>
+
+// Use a static for this as calls to the KEmoticons constructor are expensive.
+K_GLOBAL_STATIC( KEmoticons, sEmoticons )
+
+EmoticonTextEditItem::EmoticonTextEditItem(const QString &emoticonText, const QString &pixmapPath, QListWidget *parent)
+ : QListWidgetItem( parent )
+{
+ mText = emoticonText;
+ mPixmapPath = pixmapPath;
+ QPixmap p( mPixmapPath );
+ // Some of the custom icons are rather large
+ // so lets limit them to a maximum size for this display panel
+ //
+ if ( p.width() > 32 || p.height() > 32 ) {
+ p = p.scaled( QSize( 32, 32 ), Qt::KeepAspectRatio );
+ }
+
+ setIcon( p );
+ setToolTip( mText );
+}
+
+QString EmoticonTextEditItem::text() const
+{
+ return mText;
+}
+
+QString EmoticonTextEditItem::pixmapPath() const
+{
+ return mPixmapPath;
+}
+
+class EmoticonTextEditSelector::EmoticonTextEditSelectorPrivate
+{
+public:
+ EmoticonTextEditSelectorPrivate() {
+ }
+ QListWidget *listEmoticon;
+};
+
+EmoticonTextEditSelector::EmoticonTextEditSelector( QWidget * parent )
+ :QWidget( parent ), d( new EmoticonTextEditSelectorPrivate() )
+{
+ QHBoxLayout *lay = new QHBoxLayout( this );
+ lay->setSpacing( 0 );
+ lay->setContentsMargins( 0, 0, 0, 0 );
+ d->listEmoticon = new QListWidget( this );
+ lay->addWidget( d->listEmoticon );
+ d->listEmoticon->setViewMode( QListView::IconMode );
+ d->listEmoticon->setSelectionMode( QAbstractItemView::SingleSelection );
+ d->listEmoticon->setMouseTracking( true );
+ d->listEmoticon->setDragEnabled( false );
+ connect( d->listEmoticon, SIGNAL(itemEntered(QListWidgetItem*)),
+ this, SLOT(slotMouseOverItem(QListWidgetItem*)) );
+ connect( d->listEmoticon, SIGNAL(itemClicked(QListWidgetItem*)),
+ this, SLOT(slotEmoticonClicked(QListWidgetItem*)) );
+}
+
+EmoticonTextEditSelector::~EmoticonTextEditSelector()
+{
+ delete d;
+}
+
+void EmoticonTextEditSelector::slotCreateEmoticonList()
+{
+ d->listEmoticon->clear();
+ static QString cachedEmoticonsThemeName;
+ if ( cachedEmoticonsThemeName.isEmpty() ) {
+ cachedEmoticonsThemeName = KEmoticons::currentThemeName();
+ }
+ const QHash<QString, QStringList> list = sEmoticons->theme( cachedEmoticonsThemeName ).emoticonsMap();
+
+ QHash<QString, QStringList>::const_iterator end = list.constEnd();
+ for ( QHash<QString, QStringList>::const_iterator it = list.constBegin(); it != end; ++it ) {
+ new EmoticonTextEditItem( it.value().first(), it.key(), d->listEmoticon );
+ }
+
+ d->listEmoticon->setIconSize( QSize( 32, 32 ) );
+}
+
+
+void EmoticonTextEditSelector::slotMouseOverItem(QListWidgetItem* item)
+{
+ item->setSelected( true );
+ if ( !d->listEmoticon->hasFocus() ) {
+ d->listEmoticon->setFocus();
+ }
+}
+
+
+void EmoticonTextEditSelector::slotEmoticonClicked(QListWidgetItem*item)
+{
+ if ( !item ) {
+ return;
+ }
+ EmoticonTextEditItem *itemEmoticon = static_cast<EmoticonTextEditItem*>( item );
+
+ Q_EMIT itemSelected ( itemEmoticon->text() );
+ if ( isVisible() && parentWidget() &&
+ parentWidget()->inherits( "QMenu" ) ) {
+ parentWidget()->close();
+ }
+}
+
+#include "emoticon-text-edit-selector.moc"
diff --git a/app/emoticon-text-edit-selector.h b/app/emoticon-text-edit-selector.h
new file mode 100644
index 0000000..fb1584f
--- /dev/null
+++ b/app/emoticon-text-edit-selector.h
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2012 Montel Laurent <montel at kde.org>
+ based on code from kopete
+
+ This library 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 of the License, or (at your
+ option) any later version.
+
+ This library 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 Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+#ifndef EMOTICONTEXTEDITSELECTOR_H
+#define EMOTICONTEXTEDITSELECTOR_H
+
+#include <QWidget>
+#include <QListWidgetItem>
+
+class EmoticonTextEditItem : public QListWidgetItem
+{
+public:
+ explicit EmoticonTextEditItem(const QString &emoticonText, const QString &pixmapPath, QListWidget *parent);
+
+ QString text() const;
+ QString pixmapPath() const;
+
+private:
+ QString mText;
+ QString mPixmapPath;
+};
+
+class EmoticonTextEditSelector : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit EmoticonTextEditSelector( QWidget * parent = 0 );
+ ~EmoticonTextEditSelector();
+
+public Q_SLOTS:
+ void slotCreateEmoticonList();
+
+private Q_SLOTS:
+ void slotMouseOverItem(QListWidgetItem*);
+ void slotEmoticonClicked(QListWidgetItem*);
+
+Q_SIGNALS:
+ void itemSelected ( const QString& );
+
+private:
+ class EmoticonTextEditSelectorPrivate;
+ EmoticonTextEditSelectorPrivate *d;
+};
+
+#endif /* EMOTICONTEXTEDITSELECTOR_H */
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list