Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ssu dependency. JB#58681 #3

Merged
merged 2 commits into from Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions rpm/obex-capability.spec
Expand Up @@ -6,26 +6,21 @@ License: GPLv2
Source: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(ssu)
BuildRequires: pkgconfig(systemsettings) >= 0.6.0

%description
%{summary}.

%files
%defattr(-,root,root,-)
%license COPYING
%{_bindir}/obex-capability


%prep
%setup -q


%build
%qmake5
make %{?_smp_mflags}


%install
make INSTALL_ROOT=%{buildroot} install

%files
%license COPYING
%{_bindir}/obex-capability
33 changes: 19 additions & 14 deletions src/obex-capability.cpp
Expand Up @@ -9,11 +9,11 @@
#include <QTimer>
#include <QDebug>
#include <deviceinfo.h>
#include <ssudeviceinfo.h>

#include "obex-capability.h"

ObexCapability::ObexCapability(){
ObexCapability::ObexCapability()
{
doc = new QDomDocument("Capability SYSTEM \"obex-capability.dtd\"");
QDomProcessingInstruction inst = doc->createProcessingInstruction("xml", "version=\"1.0\"");
doc->appendChild(inst);
Expand All @@ -23,7 +23,8 @@ ObexCapability::ObexCapability(){
doc->appendChild(root);
}

QDomElement ObexCapability::appendElement(QDomElement &parent, const QString &element, const QString &text){
QDomElement ObexCapability::appendElement(QDomElement &parent, const QString &element, const QString &text)
{
QDomElement e = doc->createElement(element);
parent.appendChild(e);
QDomText t = doc->createTextNode(text);
Expand All @@ -32,9 +33,10 @@ QDomElement ObexCapability::appendElement(QDomElement &parent, const QString &el
return e;
}

QDomElement ObexCapability::appendChildren(QDomElement &parent, const QHash<QString, QString> &children){
QDomElement ObexCapability::appendChildren(QDomElement &parent, const QHash<QString, QString> &children)
{
QHashIterator<QString, QString> i(children);
while (i.hasNext()){
while (i.hasNext()) {
i.next();
QDomElement c = doc->createElement(i.key());
parent.appendChild(c);
Expand All @@ -47,7 +49,8 @@ QDomElement ObexCapability::appendChildren(QDomElement &parent, const QHash<QStr
}

QDomElement ObexCapability::appendElementWithChildren(QDomElement &parent, const QString &element,
const QHash<QString, QString> &children){
const QHash<QString, QString> &children)
{
QDomElement e = doc->createElement(element);
parent.appendChild(e);

Expand All @@ -56,9 +59,9 @@ QDomElement ObexCapability::appendElementWithChildren(QDomElement &parent, const
return e;
}

void ObexCapability::getDeviceInfo(){
DeviceInfo info;
SsuDeviceInfo ssu;
void ObexCapability::getDeviceInfo()
{
DeviceInfo info(true);

QDomElement p = doc->createElement("General");
root.appendChild(p);
Expand All @@ -67,7 +70,7 @@ void ObexCapability::getDeviceInfo(){
appendElement(p, "Model", info.prettyName());

//appendElement(p, "Language", info.currentLanguage());
appendElement(p, "SN", ssu.deviceUid());
appendElement(p, "SN", info.deviceUid());

QString version = info.osVersion();
QStringList versionBits = version.split(".");
Expand All @@ -85,10 +88,10 @@ void ObexCapability::getDeviceInfo(){
os.setAttribute("version", versionBits[0] + "." + versionBits[1]);

// add: version

}

void ObexCapability::getSyncMLServices(){
void ObexCapability::getSyncMLServices()
{
// TODO: read the supported syncml modules from device configuration
QHash<QString, QString> h;

Expand All @@ -112,7 +115,8 @@ void ObexCapability::getSyncMLServices(){
appendElementWithChildren(o, "Ext", h);
}

void ObexCapability::run(){
void ObexCapability::run()
{
QTextStream qout(stdout);
// first get general-section
// in separate function, try to figure out which service sections we need
Expand All @@ -125,7 +129,8 @@ void ObexCapability::run(){
QCoreApplication::quit();
}

int main (int argc, char **argv){
int main (int argc, char **argv)
{
QCoreApplication app(argc, argv);

ObexCapability mw;
Expand Down
34 changes: 17 additions & 17 deletions src/obex-capability.h
Expand Up @@ -14,23 +14,23 @@
class ObexCapability: public QObject {
Q_OBJECT

public:
ObexCapability();

private:
QDomElement appendElement(QDomElement &parent, const QString &element, const QString &text);
QDomElement appendChildren(QDomElement &parent, const QHash<QString, QString> &children);
QDomElement appendElementWithChildren(QDomElement &parent, const QString &element,
const QHash<QString, QString> &children);
void getDeviceInfo();
void getSyncMLServices();

public slots:
void run();

private:
QDomDocument *doc;
QDomElement root;
public:
ObexCapability();

private:
QDomElement appendElement(QDomElement &parent, const QString &element, const QString &text);
QDomElement appendChildren(QDomElement &parent, const QHash<QString, QString> &children);
QDomElement appendElementWithChildren(QDomElement &parent, const QString &element,
const QHash<QString, QString> &children);
void getDeviceInfo();
void getSyncMLServices();

public slots:
void run();

private:
QDomDocument *doc;
QDomElement root;
};

#endif
1 change: 0 additions & 1 deletion src/src.pro
Expand Up @@ -4,7 +4,6 @@ TARGET = obex-capability
QT += xml
QT -= gui
CONFIG += link_pkgconfig
PKGCONFIG += ssu
PKGCONFIG += systemsettings

HEADERS = obex-capability.h
Expand Down