diff options
author | Theo Chatzimichos <tampakrap@gentoo.org> | 2009-05-27 23:20:45 +0000 |
---|---|---|
committer | Theo Chatzimichos <tampakrap@gentoo.org> | 2009-05-27 23:20:45 +0000 |
commit | 86416e494be496917266b62bdc667daf6eb4bc32 (patch) | |
tree | 6f33bcf15c7f7ad29dbbf995e9c59d26bdb41599 /kde-base | |
parent | Version bump. (diff) | |
download | gentoo-2-86416e494be496917266b62bdc667daf6eb4bc32.tar.gz gentoo-2-86416e494be496917266b62bdc667daf6eb4bc32.tar.bz2 gentoo-2-86416e494be496917266b62bdc667daf6eb4bc32.zip |
Add emoticons theme manager, enhancement bug 245604
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'kde-base')
-rw-r--r-- | kde-base/kopete/ChangeLog | 6 | ||||
-rw-r--r-- | kde-base/kopete/files/emoticon-manager.patch | 184 | ||||
-rw-r--r-- | kde-base/kopete/kopete-3.5.10-r4.ebuild | 8 | ||||
-rw-r--r-- | kde-base/kopete/metadata.xml | 1 |
4 files changed, 196 insertions, 3 deletions
diff --git a/kde-base/kopete/ChangeLog b/kde-base/kopete/ChangeLog index a486798e00f4..e8d63a069e94 100644 --- a/kde-base/kopete/ChangeLog +++ b/kde-base/kopete/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for kde-base/kopete # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/kopete/ChangeLog,v 1.189 2009/05/27 19:38:07 tampakrap Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/kopete/ChangeLog,v 1.190 2009/05/27 23:20:45 tampakrap Exp $ + + 27 May 2009; Theo Chatzimichos <tampakrap@gentoo.org> + kopete-3.5.10-r4.ebuild, +files/emoticon-manager.patch, metadata.xml: + Add emoticons theme manager, enhancement bug 245604 *kopete-3.5.10-r4 (27 May 2009) diff --git a/kde-base/kopete/files/emoticon-manager.patch b/kde-base/kopete/files/emoticon-manager.patch new file mode 100644 index 000000000000..890a2e4a18ba --- /dev/null +++ b/kde-base/kopete/files/emoticon-manager.patch @@ -0,0 +1,184 @@ +diff -ur kopete-0.12.1.orig/kopete/kopete/chatwindow/chatmessagepart.cpp kopete-0.12.1/kopete/kopete/chatwindow/chatmessagepart.cpp +--- kopete-0.12.1.orig/kopete/kopete/chatwindow/chatmessagepart.cpp 2006-07-13 02:55:47.000000000 +0200 ++++ kopete-0.12.1/kopete/kopete/chatwindow/chatmessagepart.cpp 2006-07-15 21:18:28.000000000 +0200 +@@ -43,6 +43,7 @@ + #include <dom/html_base.h> + #include <dom/html_document.h> + #include <dom/html_inline.h> ++#include <qurloperator.h> + + + // KDE includes +@@ -60,8 +61,10 @@ + #include <ktempfile.h> + #include <kurldrag.h> + #include <kio/netaccess.h> ++#include <kio/job.h> + #include <kstandarddirs.h> + #include <kiconloader.h> ++#include <kinputdialog.h> + + // Kopete includes + #include "chatmemberslistwidget.h" +@@ -118,7 +121,7 @@ + Private() + : tt(0L), manager(0L), scrollPressed(false), + copyAction(0L), saveAction(0L), printAction(0L), +- closeAction(0L),copyURLAction(0L), currentChatStyle(0L), latestContact(0L), ++ closeAction(0L),copyURLAction(0L), currentChatStyle(0L), latestContact(0L), importEmoticon(0L), + latestDirection(Kopete::Message::Inbound), latestType(Kopete::Message::TypeNormal) + {} + +@@ -144,6 +147,7 @@ + KAction *printAction; + KAction *closeAction; + KAction *copyURLAction; ++ KAction *importEmoticon; + + ChatWindowStyle *currentChatStyle; + Kopete::Contact *latestContact; +@@ -259,6 +263,7 @@ + d->saveAction = KStdAction::saveAs( this, SLOT(save()), actionCollection() ); + d->printAction = KStdAction::print( this, SLOT(print()),actionCollection() ); + d->closeAction = KStdAction::close( this, SLOT(slotCloseView()),actionCollection() ); ++ d->importEmoticon = new KAction( i18n( "Import Emoticon"), QString::fromLatin1( "importemot" ), 0, this, SLOT( slotImportEmoticon() ), actionCollection() ); + d->copyURLAction = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), actionCollection() ); + + // read formatting override flags +@@ -281,6 +286,47 @@ + d->scrollPressed = true; + } + ++void ChatMessagePart::slotImportEmoticon() ++{ ++ kdDebug() << "ChatMessagePart::slotImportEmoticon()" << d->activeElement.getAttribute("src") << endl; ++ QString emoticonString = KInputDialog::getText( i18n("Import Emoticon"), i18n("<qt><img src=\"%1\"><br>Insert here a shortcut that will be replaced by this emoticon (for instance :P ).</qt>").arg( d->activeElement.getAttribute("src").string() ) ); ++ if (emoticonString.isNull() ) return; ++ QString xmldirname = KGlobal::dirs()->saveLocation( "emoticons", QString::fromLatin1( "~custom" ), true ); ++ // check if xmlname exists, if not create it ++ if(xmldirname.isNull() ) ++ { ++ KMessageBox::error( view(), i18n("There was an error creating the directory for imported emoticons.") ); ++ return; ++ } ++ QString xmlname= xmldirname + QString::fromLatin1("/emoticons.xml"); ++ QFile xmlfile(xmlname); ++ QString text; ++ QRegExp emoticonMap("(<[\\s]*/[\\s]*messaging-emoticon-map[\\s]*>)"); ++ ++ if( xmlfile.exists() && xmlfile.open(IO_ReadOnly) ) ++ { ++ text=static_cast<QCString>(xmlfile.readAll()); ++ if(text.contains(emoticonMap)<=0) text=QString::null; ++ xmlfile.close(); ++ } ++ if(text.isNull() ) ++ { ++ text= "<?xml version=\"1.0\"?>\n"; ++ text+= "<messaging-emoticon-map >\n"; ++ text+= "</messaging-emoticon-map>\n"; ++ } ++ KIO::copy( d->activeElement.getAttribute("src").string(), xmldirname); ++ QString toAppend="<emoticon file=\"" + QFileInfo(d->activeElement.getAttribute("src").string() ).baseName() + "\">\n"; ++ toAppend+=" <string>" + emoticonString + "</string>\n</emoticon>\n\\1"; ++ xmlfile.open( IO_WriteOnly | IO_Truncate ); ++ QTextStream stream( &xmlfile ); ++ emoticonMap.setCaseSensitive(false); ++ text=text.replace(emoticonMap, toAppend); ++ stream << text; ++ xmlfile.close(); ++ QTimer::singleShot(1500, Kopete::Emoticons::self(), SLOT(reload() ) ); ++} ++ + void ChatMessagePart::save() + { + KFileDialog dlg( QString::null, QString::fromLatin1( "text/html text/plain" ), view(), "fileSaveDialog", false ); +@@ -666,11 +712,12 @@ + d->copyURLAction->plug( chatWindowPopup ); + chatWindowPopup->insertSeparator(); + } +- ++ kdDebug() << "ChatMessagePart::slotRightClick(): " << d->activeElement.tagName().lower() << endl; + d->copyAction->setEnabled( hasSelection() ); + d->copyAction->plug( chatWindowPopup ); + d->saveAction->plug( chatWindowPopup ); + d->printAction->plug( chatWindowPopup ); ++ if( d->activeElement.tagName().lower() == "img" ) d->importEmoticon->plug( chatWindowPopup ); + chatWindowPopup->insertSeparator(); + d->closeAction->plug( chatWindowPopup ); + +Only in kopete-0.12.1/kopete/kopete/chatwindow: chatmessagepart.cpp.orig +Only in kopete-0.12.1/kopete/kopete/chatwindow: chatmessagepart.cpp.rej +diff -ur kopete-0.12.1.orig/kopete/kopete/chatwindow/chatmessagepart.h kopete-0.12.1/kopete/kopete/chatwindow/chatmessagepart.h +--- kopete-0.12.1.orig/kopete/kopete/chatwindow/chatmessagepart.h 2006-07-13 02:55:47.000000000 +0200 ++++ kopete-0.12.1/kopete/kopete/chatwindow/chatmessagepart.h 2006-07-15 21:17:45.000000000 +0200 +@@ -148,6 +148,7 @@ + void slotCopyURL(); + + void slotCloseView( bool force = false ); ++ void slotImportEmoticon(); + + /** + * Do the actual style change. +diff -ur kopete-0.12.1.orig/kopete/kopete/config/appearance/appearanceconfig.cpp kopete-0.12.1/kopete/kopete/config/appearance/appearanceconfig.cpp +--- kopete-0.12.1.orig/kopete/kopete/config/appearance/appearanceconfig.cpp 2006-07-13 02:55:45.000000000 +0200 ++++ kopete-0.12.1/kopete/kopete/config/appearance/appearanceconfig.cpp 2006-07-15 21:17:45.000000000 +0200 +@@ -515,7 +515,7 @@ + { + QStringList themes = themeQDir.entryList(QDir::Dirs, QDir::Name); + // We don't care for '.' and '..' +- if ( themeQDir[y] != "." && themeQDir[y] != ".." ) ++ if ( themeQDir[y] != "." && themeQDir[y] != ".." && themeQDir[y] != "~custom" ) + { + // Add ourselves to the list, using our directory name FIXME: use the first emoticon of the theme. + QPixmap previewPixmap = QPixmap(locate("emoticons", themeQDir[y]+"/smile.png")); +diff -ur kopete-0.12.1.orig/kopete/libkopete/private/kopeteemoticons.cpp kopete-0.12.1/kopete/libkopete/private/kopeteemoticons.cpp +--- kopete-0.12.1.orig/kopete/libkopete/private/kopeteemoticons.cpp 2006-07-13 02:55:52.000000000 +0200 ++++ kopete-0.12.1/kopete/libkopete/private/kopeteemoticons.cpp 2006-07-15 21:17:45.000000000 +0200 +@@ -345,8 +345,19 @@ + } + } + ++void Emoticons::reload() ++{ ++ initEmoticons( QString::null ); ++} ++ + void Emoticons::initEmoticons( const QString &theme ) + { ++ if(theme.compare( QString::fromLatin1("~custom") ) ) ++ { ++ d->emoticonAndPicList.clear(); ++ d->emoticonMap.clear(); ++ initEmoticons( QString::fromLatin1("~custom") ); ++ } + if(theme.isNull()) + { + if ( d->theme == KopetePrefs::prefs()->iconTheme() ) +@@ -360,8 +371,6 @@ + } + + // kdDebug(14010) << k_funcinfo << "Called" << endl; +- d->emoticonAndPicList.clear(); +- d->emoticonMap.clear(); + + QString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + QString::fromLatin1( "/emoticons.xml" ) ); + if(!filename.isEmpty()) +diff -ur kopete-0.12.1.orig/kopete/libkopete/private/kopeteemoticons.h kopete-0.12.1/kopete/libkopete/private/kopeteemoticons.h +--- kopete-0.12.1.orig/kopete/libkopete/private/kopeteemoticons.h 2006-07-13 02:55:52.000000000 +0200 ++++ kopete-0.12.1/kopete/libkopete/private/kopeteemoticons.h 2006-07-15 21:17:45.000000000 +0200 +@@ -162,6 +162,13 @@ + struct EmoticonNode; + class Private; + Private *d; ++public slots: ++ /** ++ * Reload emoticons ++ * Use this when changing current theme, for instance. ++ */ ++ void reload(); ++ + private slots: + + /** + diff --git a/kde-base/kopete/kopete-3.5.10-r4.ebuild b/kde-base/kopete/kopete-3.5.10-r4.ebuild index 87191b869a11..55ae654d2533 100644 --- a/kde-base/kopete/kopete-3.5.10-r4.ebuild +++ b/kde-base/kopete/kopete-3.5.10-r4.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/kde-base/kopete/kopete-3.5.10-r4.ebuild,v 1.1 2009/05/27 19:38:07 tampakrap Exp $ +# $Header: /var/cvsroot/gentoo-x86/kde-base/kopete/kopete-3.5.10-r4.ebuild,v 1.2 2009/05/27 23:20:45 tampakrap Exp $ KMNAME=kdenetwork EAPI="1" @@ -11,7 +11,7 @@ HOMEPAGE="http://kopete.kde.org/" KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" -IUSE="jingle ssl xscreensaver slp kernel_linux kdehiddenvisibility" +IUSE="emoticons-manager jingle ssl xscreensaver slp kernel_linux kdehiddenvisibility" PLUGINS="addbookmarks alias autoreplace connectionstatus contactnotes crypt highlight history latex netmeeting nowlistening statistics texteffect translator webpresence" PROTOCOLS="gadu groupwise irc jabber oscar msn sametime sms v4l2 winpopup yahoo" @@ -92,6 +92,10 @@ src_unpack() { epatch "${FILESDIR}/${P}-libgadu-CVE-2008-4776.patch" epatch "${FILESDIR}/${P}-icq-protocol-change2.patch" + if use emoticons-manager; then + epatch "${FILESDIR}/emoticon-manager.patch" + fi + use addbookmarks || kopete_disable plugin addbookmarks use alias || kopete_disable plugin alias use autoreplace || kopete_disable plugin autoreplace diff --git a/kde-base/kopete/metadata.xml b/kde-base/kopete/metadata.xml index 9fbfab0e3f97..cee393a01451 100644 --- a/kde-base/kopete/metadata.xml +++ b/kde-base/kopete/metadata.xml @@ -2,6 +2,7 @@ <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <use> + <flag name="emoticons-manager">Enables emoticons theme manager so that the user can edit and remove emoticons or add custom ones etc</flag> <!-- PLUGINS --> <flag name="addbookmarks">Automaticaly add incoming urls to bookmarks.</flag> <flag name="alias">Enables creating of your own aliases for commands.</flag> |