-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8350c7a
commit 29fa338
Showing
28 changed files
with
425 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[Dolphin] | ||
Timestamp=2012,4,19,13,5,47 | ||
Timestamp=2012,6,16,20,11,44 | ||
Version=3 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<profile name="nonameim" type="client" > | ||
</profile> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[D-BUS Service] | ||
Name=org.nonameim | ||
Exec=/usr/bin/invoker --splash=/opt/nonameIM/share/splash/portrait.png --splash-landscape=/opt/nonameIM/share/splash/landscape.png --single-instance --type=e /opt/nonameIM/bin/nonameIM |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
TEMPLATE = lib | ||
TARGET = nonameim-client | ||
DEPENDPATH += . | ||
INCLUDEPATH += . \ | ||
/usr/include/libsynccommon \ | ||
/usr/include/libsyncprofile \ | ||
/usr/include/gq \ | ||
$$PWD/../vk/src/api | ||
DEPENDPATH += $$PWD/../vk/src/api | ||
LIBS += -lsyncpluginmgr -lsyncprofile -lgq-gconf -L$$OUT_PWD/../vk/src/api/ -lvk | ||
|
||
CONFIG += debug plugin meegotouchevents | ||
|
||
QT += dbus network | ||
QT -= gui | ||
|
||
QMAKE_CXXFLAGS = -Wall \ | ||
-g \ | ||
-Wno-cast-align \ | ||
-O2 -finline-functions | ||
|
||
#install | ||
target.path = /usr/lib/sync/ | ||
|
||
client.path = /etc/sync/profiles/client | ||
client.files = client/nonameim.xml | ||
|
||
sync.path = /etc/sync/profiles/sync | ||
sync.files = sync/* | ||
|
||
service.path = /etc/sync/profiles/service | ||
service.files = service/* | ||
|
||
settingsdesktop.path = /usr/share/duicontrolpanel/desktops | ||
settingsdesktop.files = settings/nonameim.desktop | ||
|
||
settingsxml.path = /usr/share/duicontrolpanel/uidescriptions | ||
settingsxml.files = settings/nonameim.xml | ||
|
||
INSTALLS += target client sync service settingsdesktop settingsxml | ||
|
||
HEADERS += \ | ||
newsfeed_client.h | ||
|
||
SOURCES += \ | ||
newsfeed_client.cpp | ||
|
||
!isEmpty(MEEGO_VERSION_MAJOR) { | ||
QMAKE_LFLAGS += -Wl,--rpath=/opt/nonameIM/lib | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#include "newsfeed_client.h" | ||
#include <QSettings> | ||
#include <client.h> | ||
#include <gconfitem.h> | ||
#include <meventfeed.h> | ||
#include <roster.h> | ||
#include <attachment.h> | ||
|
||
extern "C" NewsFeedClient* createPlugin(const QString& aPluginName, | ||
const Buteo::SyncProfile& aProfile, | ||
Buteo::PluginCbInterface *aCbInterface) | ||
{ | ||
return new NewsFeedClient(aPluginName, aProfile, aCbInterface); | ||
} | ||
|
||
extern "C" void destroyPlugin(NewsFeedClient *aClient) | ||
{ | ||
delete aClient; | ||
} | ||
|
||
NewsFeedClient::NewsFeedClient(const QString &aPluginName, const Buteo::SyncProfile &aProfile, Buteo::PluginCbInterface *aCbInterface) : | ||
Buteo::ClientPlugin(aPluginName, aProfile, aCbInterface) | ||
{ | ||
} | ||
|
||
NewsFeedClient::~NewsFeedClient() | ||
{ | ||
} | ||
|
||
bool NewsFeedClient::init() | ||
{ | ||
m_client = new vk::Client(this); | ||
m_feed = new vk::NewsFeed(m_client.data()); | ||
|
||
connect(m_feed.data(), SIGNAL(newsRecieved(vk::NewsItemList)), SLOT(newsRecieved(vk::NewsItemList))); | ||
connect(m_client.data(), SIGNAL(onlineStateChanged(bool)), SLOT(connectedToHost(bool))); | ||
return true; | ||
} | ||
|
||
bool NewsFeedClient::uninit() | ||
{ | ||
m_client.data()->deleteLater(); | ||
return true; | ||
} | ||
|
||
bool NewsFeedClient::startSync() | ||
{ | ||
//GConfItem enabledConfItem("/apps/ControlPanel/NonameIM/EnableFeed"); | ||
//QVariant enabledVariant = enabledConfItem.value(); | ||
|
||
//if (enabledVariant.isValid()) { | ||
// bool enabled = enabledVariant.toBool(); | ||
// if (!enabled) { | ||
// MEventFeed::instance()->removeItemsBySourceName("SyncFW-nonameim"); | ||
// return false; | ||
// } | ||
//} else { | ||
// enabledConfItem.set(true); | ||
//} | ||
|
||
QSettings settings("noname", "nonameIM"); | ||
settings.beginGroup("connection"); | ||
QString login = settings.value("login").toString(); | ||
QString password = settings.value("password").toString(); | ||
settings.endGroup(); | ||
if (login.isEmpty() || password.isEmpty()) | ||
return false; | ||
|
||
m_client.data()->setPassword(password); | ||
m_client.data()->setLogin(login); | ||
return true; | ||
} | ||
|
||
void NewsFeedClient::abortSync(Sync::SyncStatus aStatus) | ||
{ | ||
Q_UNUSED(aStatus); | ||
} | ||
|
||
Buteo::SyncResults NewsFeedClient::getSyncResults() const | ||
{ | ||
return m_results; | ||
} | ||
|
||
bool NewsFeedClient::cleanUp() | ||
{ | ||
return true; | ||
} | ||
|
||
void NewsFeedClient::connectivityStateChanged(Sync::ConnectivityType aType, bool aState) | ||
{ | ||
Q_UNUSED(aType); | ||
if (aState) | ||
m_client.data()->connectToHost(); | ||
} | ||
|
||
void NewsFeedClient::newsRecieved(const vk::NewsItemList &news) | ||
{ | ||
foreach (vk::NewsItem item, news) { | ||
vk::Contact *from = m_client.data()->roster()->contact(item.sourceId()); | ||
vk::Attachment::List attachments = item.attachments(vk::Attachment::Photo); | ||
QStringList list; | ||
foreach (vk::Attachment attach, attachments) | ||
list.append(attach.property("src").toString()); | ||
|
||
MEventFeed::instance()->addItem(from->photoSource(), | ||
from->name(), | ||
item.body(), | ||
list, | ||
item.date(), | ||
QString(), | ||
false, | ||
QUrl(), | ||
QString("SyncFW-nonameim"), | ||
QString("NonameIM") | ||
); | ||
} | ||
MEventFeed::instance()->removeItemsBySourceName("SyncFW-nonameim"); | ||
} | ||
|
||
void NewsFeedClient::connectedToHost(bool success) | ||
{ | ||
if (success) { | ||
m_feed.data()->getNews(vk::NewsFeed::FilterPost | vk::NewsFeed::FilterPhoto); //TODO add offset check and others | ||
} | ||
} | ||
|
||
void NewsFeedClient::syncSuccess() | ||
{ | ||
updateResults(Buteo::SyncResults(QDateTime::currentDateTime(), Buteo::SyncResults::SYNC_RESULT_SUCCESS, Buteo::SyncResults::NO_ERROR)); | ||
emit success(getProfileName(), "Success!!"); | ||
} | ||
|
||
void NewsFeedClient::syncFailed() | ||
{ | ||
updateResults(Buteo::SyncResults(QDateTime::currentDateTime(), | ||
Buteo::SyncResults::SYNC_RESULT_FAILED, Buteo::SyncResults::ABORTED)); | ||
emit error(getProfileName(), "Error!!", Buteo::SyncResults::SYNC_RESULT_FAILED); | ||
} | ||
|
||
void NewsFeedClient::updateResults(const Buteo::SyncResults &aResults) | ||
{ | ||
m_results = aResults; | ||
m_results.setScheduled(true); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef NEWSFEEDCLIENT_H | ||
#define NEWSFEEDCLIENT_H | ||
|
||
#include <libsyncpluginmgr/ClientPlugin.h> | ||
#include <libsyncprofile/SyncResults.h> | ||
#include <QWeakPointer> | ||
#include <newsitem.h> | ||
#include <newsfeed.h> | ||
|
||
class NewsFeedClient : public Buteo::ClientPlugin | ||
{ | ||
Q_OBJECT | ||
public: | ||
NewsFeedClient( const QString& aPluginName, | ||
const Buteo::SyncProfile& aProfile, | ||
Buteo::PluginCbInterface *aCbInterface ); | ||
|
||
virtual ~NewsFeedClient(); | ||
virtual bool init(); | ||
virtual bool uninit(); | ||
virtual bool startSync(); | ||
virtual void abortSync(Sync::SyncStatus aStatus = Sync::SYNC_ABORTED); | ||
virtual Buteo::SyncResults getSyncResults() const; | ||
virtual bool cleanUp(); | ||
public slots: | ||
virtual void connectivityStateChanged(Sync::ConnectivityType aType, | ||
bool aState); | ||
|
||
protected slots: | ||
void newsRecieved(const vk::NewsItemList &news); | ||
void connectedToHost(bool success); | ||
void syncSuccess(); | ||
void syncFailed(); | ||
private: | ||
void updateResults(const Buteo::SyncResults &aResults); | ||
private: | ||
Buteo::SyncResults m_results; | ||
QWeakPointer<vk::Client> m_client; | ||
QWeakPointer<vk::NewsFeed> m_feed; | ||
}; | ||
|
||
extern "C" NewsFeedClient* createPlugin(const QString& aPluginName, | ||
const Buteo::SyncProfile& aProfile, | ||
Buteo::PluginCbInterface *aCbInterface); | ||
|
||
extern "C" void destroyPlugin(NewsFeedClient *aClient); | ||
|
||
#endif // NEWSFEEDCLIENT_H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<profile name="nonameim" type="service"> | ||
<key name="destinationtype" value="device"/> | ||
<profile name="nonameim" type="client" > | ||
</profile> | ||
</profile> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Desktop Entry] | ||
Type=ControlPanelApplet | ||
Name=NonameIM | ||
Exec= | ||
X-logical-id=qtn_noname_events_feed | ||
X-translation-catalog=nonameim | ||
|
||
[DUI] | ||
X-DUIApplet-Applet=libdeclarative.so | ||
|
||
[DCP] | ||
Category=Events Feed | ||
Order=100 | ||
Part=nonameim.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<settings> | ||
<boolean key="/apps/ControlPanel/NonameIM/EnableFeed" title="Publish to Feed"></boolean> | ||
</settings> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<profile name="nonameim" type="sync" > | ||
<key name="displayname" value="NonameIM"/> | ||
<key name="enabled" value="true" /> | ||
<key name="use_accounts" value="false" /> | ||
<key name="hidden" value="true" /> | ||
<profile type="service" name="nonameim" > | ||
</profile> | ||
<schedule enabled="true" interval="30" days="1,2,3,4,5,6,7" syncconfiguredtime="" time=""> | ||
</schedule> | ||
</profile> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
/usr/bin/aegis-exec -s -u user dbus-send --dest=com.meego.msyncd --print-reply /synchronizer com.meego.msyncd.installPlugin string:'nonameim' | ||
|
||
# Make sure the installation is always considered successful | ||
exit 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
/usr/bin/aegis-exec -s -u user dbus-send --dest=com.meego.msyncd --print-reply /synchronizer com.meego.msyncd.uninstallPlugin string:'nonameim' | ||
|
||
# Clean up the feed items published by this application | ||
/usr/bin/aegis-exec -s -u user dbus-send --dest=com.nokia.home.NonameIM --print-reply /eventfeed com.nokia.home.NonameIM.removeItemsBySourceName string:'SyncFW-event-nonameim' | ||
|
||
# Make sure the uninstallation is always considered successful | ||
exit 0 |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ Page { | |
} | ||
} | ||
currentIndex: -1 | ||
cacheBuffer: 100500 | ||
} | ||
|
||
ScrollDecorator { | ||
|
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
Oops, something went wrong.