Created
December 19, 2009 02:03
-
-
Save mnogu/259908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: microblogs/twitter/twittersearch.cpp | |
=================================================================== | |
--- microblogs/twitter/twittersearch.cpp (revision 1056359) | |
+++ microblogs/twitter/twittersearch.cpp (working copy) | |
@@ -36,11 +36,13 @@ | |
TwitterSearch::TwitterSearch(QObject* parent): TwitterApiSearch(parent) | |
{ | |
kDebug(); | |
- mSearchCode[CustomSearch] = QString(); | |
- mSearchCode[ToUser] = "to:"; | |
- mSearchCode[FromUser] = "from:"; | |
- mSearchCode[ReferenceUser] = '@'; | |
- mSearchCode[ReferenceHashtag] = '#'; | |
+ mSearchCode[CustomSearch].append(QString()); | |
+ mSearchCode[ToUser].append("to:"); | |
+ mSearchCode[FromUser].append("from:"); | |
+ mSearchCode[ReferenceUser].append("@"); | |
+ mSearchCode[ReferenceUser].append(QChar(0xFF20)); // FULLWIDTH COMMERCIAL AT | |
+ mSearchCode[ReferenceHashtag].append("#"); | |
+ mSearchCode[ReferenceHashtag].append(QChar(0xFF03)); // FULLWIDTH NUMBER SIGN | |
mSearchTypes[CustomSearch].first = i18n( "Custom Search" ); | |
mSearchTypes[CustomSearch].second = true; | |
@@ -187,7 +189,7 @@ | |
QString TwitterSearch::optionCode(int option) | |
{ | |
- return mSearchCode[option]; | |
+ return mSearchCode[option][0]; | |
} | |
TwitterSearch::~TwitterSearch() | |
@@ -198,7 +200,13 @@ | |
uint count, uint page) | |
{ | |
kDebug(); | |
- QString formattedQuery = mSearchCode[option] + query; | |
+ QStringList codeList = mSearchCode[option]; | |
+ QString formattedQuery; | |
+ for (int i = 0; i < codeList.size(); i++) { | |
+ if (i != 0) | |
+ formattedQuery += " OR "; | |
+ formattedQuery += codeList.at(i) + query; | |
+ } | |
KUrl url( "http://search.twitter.com/search.atom" ); | |
url.addQueryItem("q", formattedQuery); | |
if( !sinceStatusId.isEmpty() ) | |
Index: microblogs/twitter/twitterpostwidget.cpp | |
=================================================================== | |
--- microblogs/twitter/twitterpostwidget.cpp (revision 1056359) | |
+++ microblogs/twitter/twitterpostwidget.cpp (working copy) | |
@@ -44,7 +44,7 @@ | |
QString TwitterPostWidget::prepareStatus(const QString& text) | |
{ | |
QString res = TwitterApiPostWidget::prepareStatus(text); | |
- res.replace(mHashtagRegExp,"\\1#<a href='tag://\\2'>\\2</a>"); | |
+ res.replace(mHashtagRegExp,"\\1\\2<a href='tag://\\3'>\\3</a>"); | |
return res; | |
} | |
Index: microblogs/twitter/twittersearch.h | |
=================================================================== | |
--- microblogs/twitter/twittersearch.h (revision 1056359) | |
+++ microblogs/twitter/twittersearch.h (working copy) | |
@@ -25,6 +25,8 @@ | |
#ifndef TWITTERSEARCH_H | |
#define TWITTERSEARCH_H | |
+#include <QStringList> | |
+ | |
#include "twitterapihelper/twitterapisearch.h" | |
/** | |
@@ -57,7 +59,7 @@ | |
uint count = 0, uint page = 1 ); | |
QList<Choqok::Post*> parseAtom( const QByteArray &buffer ); | |
- QMap<int, QString> mSearchCode; | |
+ QMap<int, QStringList> mSearchCode; | |
QMap<KJob*, SearchInfo> mSearchJobs; | |
static const QRegExp m_rId; | |
}; | |
Index: helperlibs/twitterapihelper/twitterapipostwidget.cpp | |
=================================================================== | |
--- helperlibs/twitterapihelper/twitterapipostwidget.cpp (revision 1056359) | |
+++ helperlibs/twitterapihelper/twitterapipostwidget.cpp (working copy) | |
@@ -33,8 +33,10 @@ | |
#include <mediamanager.h> | |
#include <choqokappearancesettings.h> | |
-const QRegExp TwitterApiPostWidget::mUserRegExp("([\\s]|^)@([^\\s\\W]+)"); | |
-const QRegExp TwitterApiPostWidget::mHashtagRegExp("([\\s]|^)#([^\\s\\W]+)"); | |
+// \xFF20 is a Unicode character 'FULLWIDTH COMMERCIAL AT' | |
+const QRegExp TwitterApiPostWidget::mUserRegExp("([\\s]|^)(@|\\xFF20)([^\\s\\W]+)"); | |
+// \xFF03 is a Unicode character 'FULLWIDTH NUMBER SIGN' | |
+const QRegExp TwitterApiPostWidget::mHashtagRegExp("([\\s]|^)(#|\\xFF03)([^\\s\\W]+)"); | |
const KIcon TwitterApiPostWidget::unFavIcon(Choqok::MediaManager::convertToGrayScale(KIcon("rating").pixmap(16)) ); | |
class TwitterApiPostWidget::Private | |
@@ -75,9 +77,9 @@ | |
QString TwitterApiPostWidget::prepareStatus(const QString& text) | |
{ | |
QString res = Choqok::UI::PostWidget::prepareStatus(text); | |
- res.replace(mUserRegExp,"\\1@<a href='user://\\2'>\\2</a> <a href='"+ | |
- currentAccount()->microblog()->profileUrl( currentAccount(), "\\2") + "' title='" + | |
- currentAccount()->microblog()->profileUrl( currentAccount(), "\\2") + "'>"+ webIconText +"</a>"); | |
+ res.replace(mUserRegExp,"\\1\\2<a href='user://\\3'>\\3</a> <a href='"+ | |
+ currentAccount()->microblog()->profileUrl( currentAccount(), "\\3") + "' title='" + | |
+ currentAccount()->microblog()->profileUrl( currentAccount(), "\\3") + "'>"+ webIconText +"</a>"); | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment