[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,7 +1,7 @@
<services>
<service name="tar_git">
- <param name="url">https://github.com/monich/harbour-mmslog.git</param>
+ <param name="url">http://git.monich.net/git/harbour-mmslog</param>
<param name="branch">master</param>
- <param name="revision">ce14d48</param>
+ <param name="revision">0442b03</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/harbour-mmslog.pro
^
|
@@ -69,12 +69,14 @@
HEADERS += \
$${HARBOUR_LIB_INCLUDE}/HarbourDebug.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourProcessState.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSigChildHandler.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSystemInfo.h \
$${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodInfo.h \
$${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodsModel.h
SOURCES += \
+ $${HARBOUR_LIB_SRC}/HarbourProcessState.cpp \
$${HARBOUR_LIB_SRC}/HarbourSigChildHandler.cpp \
$${HARBOUR_LIB_SRC}/HarbourSystemInfo.cpp \
$${HARBOUR_LIB_SRC}/HarbourTransferMethodInfo.cpp \
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/qml/main.qml
^
|
@@ -1,20 +1,21 @@
/*
- Copyright (C) 2014-2015 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2021 Jolla Ltd.
+ Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Jolla Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the names of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -34,10 +35,9 @@
import "pages"
import "cover"
-ApplicationWindow
-{
+ApplicationWindow {
id: window
allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted
- initialPage: Component { LogPage { } }
+ initialPage: Component { LogPage { allowedOrientations: window.allowedOrientations } }
cover: Component { CoverPage { } }
}
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/qml/pages/LogPage.qml
^
|
@@ -32,20 +32,28 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+import org.nemomobile.notifications 1.0
Page {
- id: page
- allowedOrientations: window.allowedOrientations
- property bool _clear
-
function packAndShare() {
FsIoLog.pack()
- pageStack.push(sharePageComponent)
+ pageStack.push(Qt.resolvedUrl("SharePage.qml"), {
+ allowedOrientations: allowedOrientations,
+ })
}
- Component {
- id: sharePageComponent
- SharePage {}
+ Notification {
+ id: clipboardNotification
+
+ //: Pop-up notification
+ //% "Copied to clipboard"
+ previewBody: qsTrId("mmslog-notification-copied_to_clipboard")
+ expireTimeout: 2000
+ Component.onCompleted: {
+ if ("icon" in clipboardNotification) {
+ clipboardNotification.icon = "icon-s-clipboard"
+ }
+ }
}
SilicaFlickable {
@@ -108,13 +116,18 @@
//% "MMS engine log"
title: qsTrId("mmslog-logpage-title")
}
- delegate: Item {
+ delegate: BackgroundItem {
width: parent.width
height: textLabel.height
+ enabled: timeLabel.text.length > 0 || textLabel.text.length > 0
Label {
id: timeLabel
text: timestamp
- font.pixelSize: view.textSize
+ color: model.highlight ? Theme.highlightColor : Theme.primaryColor
+ font {
+ pixelSize: view.textSize
+ bold: model.highlight
+ }
anchors {
top: parent.top
left: parent.left
@@ -125,8 +138,12 @@
Label {
id: textLabel
text: plaintext
- font.pixelSize: view.textSize
wrapMode: Text.WordWrap
+ color: model.highlight ? Theme.highlightColor : Theme.primaryColor
+ font {
+ pixelSize: view.textSize
+ bold: model.highlight
+ }
anchors {
top: parent.top
left: timeLabel.right
@@ -135,6 +152,11 @@
rightMargin: Theme.paddingLarge
}
}
+ onPressAndHold: {
+ Clipboard.text = (timeLabel.text.length > 0) ?
+ (timeLabel.text + " " + textLabel.text) : textLabel.text
+ clipboardNotification.publish()
+ }
}
onCountChanged: {
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/qml/pages/SharePage.qml
^
|
@@ -39,7 +39,6 @@
Page {
id: page
- allowedOrientations: window.allowedOrientations
// backNavigation has to be true when the page is pushed to the page stack
// so that the right animation is used (consistent with the settings page)
backNavigation: _readyToShare || (status === PageStatus.Activating || status === PageStatus.Inactive)
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/settings/SettingsPage.qml
^
|
@@ -61,7 +61,7 @@
description: inApp ? "" :
//: Settings page header description (app version)
//% "Version %1"
- qsTrId("mmslog-settings-version").arg("1.0.18")
+ qsTrId("mmslog-settings-version").arg("1.0.19")
Image {
id: appIcon
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/harbour-lib/include/HarbourAztecCodeGenerator.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -11,8 +11,8 @@
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
* distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
@@ -39,25 +39,42 @@
class HarbourAztecCodeGenerator : public QObject {
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(int ecLevel READ ecLevel WRITE setEcLevel NOTIFY ecLevelChanged)
Q_PROPERTY(QString code READ code NOTIFY codeChanged)
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+ Q_ENUMS(ECLevel)
public:
+ enum ECLevel {
+ ECLevelDefault = -1,
+ ECLevelLowest = 5,
+ ECLevelLow = 10,
+ ECLevelMedium = 23,
+ ECLevelHigh = 36,
+ ECLevelVeryHigh = 50,
+ ECLevelHighest = 95,
+ ECLevelCount
+ };
+
HarbourAztecCodeGenerator(QObject* aParent = Q_NULLPTR);
QString text() const;
void setText(QString aValue);
+ int ecLevel() const;
+ void setEcLevel(int aValue);
+
QString code() const;
bool running() const;
- static QByteArray generate(QString aText);
+ static QByteArray generate(QString aText, int aEcLevel = ECLevelDefault);
// Callback for qmlRegisterSingletonType<HarbourAztecCodeGenerator>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
Q_SIGNALS:
void textChanged();
+ void ecLevelChanged();
void codeChanged();
void runningChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/harbour-lib/include/HarbourProcessState.h
^
|
@@ -44,6 +44,7 @@
Q_OBJECT
Q_DISABLE_COPY(HarbourProcessState)
Q_PROPERTY(bool jailedApp READ isJailedApp CONSTANT)
+ Q_PROPERTY(bool provileged READ isPrivileged CONSTANT)
public:
explicit HarbourProcessState(QObject* aParent = Q_NULLPTR);
@@ -52,6 +53,7 @@
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
static bool isJailedApp();
+ static bool isPrivileged();
};
#endif // HARBOUR_PROCESS_STATE_H
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/harbour-lib/src/HarbourAztecCodeGenerator.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -11,8 +11,8 @@
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
* distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
@@ -48,22 +48,25 @@
class HarbourAztecCodeGenerator::Task : public HarbourTask {
Q_OBJECT
public:
- Task(QThreadPool* aPool, QString aText);
+ Task(QThreadPool* aPool, QString aText, int aEcLevel);
void performTask() Q_DECL_OVERRIDE;
public:
QString iText;
QString iCode;
+ int iEcLevel;
};
-HarbourAztecCodeGenerator::Task::Task(QThreadPool* aPool, QString aText) :
+HarbourAztecCodeGenerator::Task::Task(QThreadPool* aPool, QString aText,
+ int aEcLevel) :
HarbourTask(aPool),
- iText(aText)
+ iText(aText),
+ iEcLevel(aEcLevel)
{
}
void HarbourAztecCodeGenerator::Task::performTask()
{
- QByteArray bytes(generate(iText));
+ QByteArray bytes(generate(iText, iEcLevel));
if (!bytes.isEmpty()) {
iCode = HarbourBase32::toBase32(bytes);
}
@@ -82,6 +85,10 @@
HarbourAztecCodeGenerator* parentObject() const;
void setText(QString aValue);
+ void setEcLevel(int aValue);
+ void regenerate();
+
+ static int realEcLevel(int aEcLevel);
public Q_SLOTS:
void onTaskDone();
@@ -89,6 +96,7 @@
public:
QThreadPool* iThreadPool;
Task* iTask;
+ int iEcLevel;
QString iText;
QString iCode;
};
@@ -96,7 +104,8 @@
HarbourAztecCodeGenerator::Private::Private(HarbourAztecCodeGenerator* aParent) :
QObject(aParent),
iThreadPool(new QThreadPool(this)),
- iTask(Q_NULLPTR)
+ iTask(Q_NULLPTR),
+ iEcLevel(ECLevelDefault)
{
// Serialize the tasks:
iThreadPool->setMaxThreadCount(1);
@@ -112,19 +121,45 @@
return qobject_cast<HarbourAztecCodeGenerator*>(parent());
}
+int HarbourAztecCodeGenerator::Private::realEcLevel(int aEcLevel)
+{
+ return (aEcLevel == ECLevelDefault) ? AZTEC_CORRECTION_DEFAULT :
+ (aEcLevel < ECLevelLowest) ? ECLevelLowest :
+ (aEcLevel > ECLevelHighest) ? ECLevelHighest :
+ aEcLevel;
+}
+
void HarbourAztecCodeGenerator::Private::setText(QString aText)
{
if (iText != aText) {
iText = aText;
- HarbourAztecCodeGenerator* obj = parentObject();
- const bool wasRunning = (iTask != Q_NULLPTR);
- if (iTask) iTask->release(this);
- iTask = new Task(iThreadPool, aText);
- iTask->submit(this, SLOT(onTaskDone()));
- Q_EMIT obj->textChanged();
- if (!wasRunning) {
- Q_EMIT obj->runningChanged();
+ regenerate();
+ Q_EMIT parentObject()->textChanged();
+ }
+}
+
+void HarbourAztecCodeGenerator::Private::setEcLevel(int aValue)
+{
+ const int level = (aValue == ECLevelDefault) ? ECLevelDefault : realEcLevel(aValue);
+ if (iEcLevel != level) {
+ const int prevRealLevel = realEcLevel(iEcLevel);
+ iEcLevel = level;
+ HDEBUG(level);
+ if (realEcLevel(level) != prevRealLevel) {
+ regenerate();
}
+ Q_EMIT parentObject()->ecLevelChanged();
+ }
+}
+
+void HarbourAztecCodeGenerator::Private::regenerate()
+{
+ const bool wasRunning = (iTask != Q_NULLPTR);
+ if (iTask) iTask->release(this);
+ iTask = new Task(iThreadPool, iText, iEcLevel);
+ iTask->submit(this, SLOT(onTaskDone()));
+ if (!wasRunning) {
+ Q_EMIT parentObject()->runningChanged();
}
}
@@ -169,6 +204,16 @@
iPrivate->setText(aValue);
}
+int HarbourAztecCodeGenerator::ecLevel() const
+{
+ return iPrivate->iEcLevel;
+}
+
+void HarbourAztecCodeGenerator::setEcLevel(int aValue)
+{
+ iPrivate->setEcLevel(aValue);
+}
+
QString HarbourAztecCodeGenerator::code() const
{
return iPrivate->iCode;
@@ -179,12 +224,12 @@
return iPrivate->iTask != Q_NULLPTR;
}
-QByteArray HarbourAztecCodeGenerator::generate(QString aText)
+QByteArray HarbourAztecCodeGenerator::generate(QString aText, int aEcLevel)
{
HDEBUG(aText);
QByteArray in(aText.toUtf8()), out;
AztecSymbol* aztec = aztec_encode_inv(in.constData(), in.size(),
- AZTEC_CORRECTION_DEFAULT);
+ Private::realEcLevel(aEcLevel));
if (aztec) {
const int bytesPerRow = (aztec->size + 7) / 8;
out.reserve(bytesPerRow * aztec->size);
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/harbour-lib/src/HarbourProcessState.cpp
^
|
@@ -35,6 +35,8 @@
#include "HarbourDebug.h"
#include <unistd.h>
+#include <grp.h>
+#include <sys/types.h>
HarbourProcessState::HarbourProcessState(QObject* aParent) :
QObject(aParent)
@@ -73,3 +75,25 @@
}
return processJailed > 0;
}
+
+bool HarbourProcessState::isPrivileged()
+{
+ static gid_t privilegedGid = 0;
+
+ if (!privilegedGid) {
+ const struct group* gr = getgrnam("privileged");
+
+ if (gr) {
+ privilegedGid = gr->gr_gid;
+ HDEBUG("privileged =" << privilegedGid);
+ }
+ }
+ const gid_t egid = getegid();
+ if (egid == privilegedGid) {
+ HDEBUG("Yes, we are privileged :)");
+ return true;
+ } else {
+ HDEBUG("Oops, we are not privileged :(");
+ return false;
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/main.cpp
^
|
@@ -1,34 +1,34 @@
/*
- Copyright (C) 2014-2021 Jolla Ltd.
- Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
-
- You may use this file under the terms of BSD license as follows:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the names of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
#include "appsettings.h"
#include "mmslogmodel.h"
@@ -113,8 +113,8 @@
HarbourTransferMethodsModel* tm = new HarbourTransferMethodsModel(app);
HarbourSystemInfo* si = new HarbourSystemInfo(app);
tm->setFilter(mmsLog->archiveType());
- mmsLog->connect(mmsEngine, SIGNAL(message(QString,bool)),
- SLOT(append(QString,bool)));
+ mmsLog->connect(mmsEngine, SIGNAL(logMessage(QString)), SLOT(logMessage(QString)));
+ mmsLog->connect(mmsEngine, SIGNAL(warning(QString)), SLOT(warning(QString)));
if (sigChildHandler) {
mmsEngine->connect(sigChildHandler,
SIGNAL(processDied(int,int)),
@@ -124,7 +124,7 @@
SLOT(processDied(int,int)));
}
- // Create ans show the view
+ // Create and show the view
QQuickView* view = SailfishApp::createView();
QQmlContext* context = view->rootContext();
context->setContextProperty("FsIoLog", mmsLog);
@@ -139,7 +139,8 @@
QString dir(mmsLog->dirName());
save_disk_usage(dir);
- QFile::copy("/etc/sailfish-release", dir + "/sailfish-release");
+ QFile::copy("/etc/os-release", dir + "/os-release");
+ QFile::copy("/etc/hw-release", dir + "/hw-release");
OfonoLogger* ofono = new OfonoLogger(dir, settings, app);
ofono->connect(mmsLog, SIGNAL(flushed()), SLOT(flush()));
int ret = app->exec();
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/mmsengine.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2020 Jolla Ltd.
- * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -170,7 +170,7 @@
void MMSEngine::engineDied()
{
- emit message("MMS engine died", false);
+ emit warning("MMS engine died");
if (iRestartCount < MMS_ENGINE_MAX_RESTARTS) {
if (!iRestartTimer) {
iRestartTimer = new QTimer(this);
@@ -193,17 +193,11 @@
iEngineLog = startEngine();
}
-void MMSEngine::forward(QString aMessage)
-{
- HDEBUG(aMessage);
- emit message(aMessage, true);
-}
-
MMSEngineLog* MMSEngine::startLogThread(int aDescriptor)
{
MMSEngineLog* logThread = new MMSEngineLog(aDescriptor);
connect(logThread, SIGNAL(message(QString)),
- SLOT(forward(QString)), Qt::QueuedConnection);
+ SIGNAL(logMessage(QString)), Qt::QueuedConnection);
connect(logThread, SIGNAL(done(int)),
SLOT(pipeClosed(int)), Qt::QueuedConnection);
logThread->start();
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/mmsengine.h
^
|
@@ -1,33 +1,34 @@
/*
- Copyright (C) 2014-2015 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
-
- You may use this file under the terms of BSD license as follows:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Jolla Ltd nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef MMSENGINE_H
#define MMSENGINE_H
@@ -51,10 +52,10 @@
MMSEngineLog* startLogThread(int aDescriptor);
Q_SIGNALS:
- void message(QString message, bool aMmsEngineLog);
+ void warning(QString aMessage);
+ void logMessage(QString aMessage);
private Q_SLOTS:
- void forward(QString aMessage);
void processDied(int aPid, int aStatus);
void pipeClosed(int aPipe);
void restart();
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/mmslogmodel.cpp
^
|
@@ -1,39 +1,40 @@
/*
- Copyright (C) 2014-2021 Jolla Ltd.
- Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
-
- You may use this file under the terms of BSD license as follows:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the names of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
#include "mmslogmodel.h"
#include "appsettings.h"
#include "HarbourDebug.h"
+#include "HarbourProcessState.h"
#include <QDateTime>
#include <QRunnable>
@@ -51,7 +52,8 @@
enum FsIoLogRole {
TimeRole = Qt::UserRole,
- TextRole
+ TextRole,
+ HighlightRole
};
// ==========================================================================
@@ -60,18 +62,25 @@
class FsIoLogModel::Entry {
public:
- Entry(QString aMessage, bool aFromMmsEngine);
+ enum {
+ FROM_MMS_ENGINE = 0x01,
+ HIGHLIGHT = 0x02
+ };
+
+ Entry(QString aMessage, int aFlags = 0);
QString iMessage;
QString iTimestamp;
QString iText;
+ bool iHighlight;
};
-FsIoLogModel::Entry::Entry(QString aMessage, bool aFromMmsEngine) :
- iMessage(aMessage)
+FsIoLogModel::Entry::Entry(QString aMessage, int aFlags) :
+ iMessage(aMessage),
+ iHighlight((aFlags & HIGHLIGHT) != 0)
{
// MMS engine starts each line with YYYY-MM-DD hh:mm:ss
// Skip the date part and split time and text
- if (aFromMmsEngine &&
+ if ((aFlags & FROM_MMS_ENGINE) &&
aMessage.length() > 20 && // YYYY-MM-DD
aMessage[0].isDigit() && aMessage[1].isDigit() &&
aMessage[2].isDigit() && aMessage[3].isDigit() &&
@@ -152,11 +161,16 @@
connect(iSettings, SIGNAL(logSizeLimitChanged()), SLOT(updateLogSizeLimit()));
iTempDir.setAutoRemove(true);
HDEBUG("Temporary directory" << iTempDir.path());
+ // Do these messages below need to be localized?
+ if (!HarbourProcessState::isPrivileged()) {
+ warning(QString("This application doesn't seem to be running in privileged mode. "
+ "It may not work properly."));
+ }
if (!QDir(iRootDir).mkpath(iRootDir)) {
- append(QString("Failed to create ").append(iRootDir));
+ warning(QString("Failed to create %1").arg(iRootDir));
}
if (!iLogFile.open(QFile::Text | QFile::ReadWrite)) {
- append(QString("Failed to open ").append(iLogFile.fileName()));
+ warning(QString("Failed to open %1").arg(iLogFile.fileName()));
}
}
@@ -179,6 +193,7 @@
QHash<int, QByteArray> roles;
roles[TimeRole] = "timestamp";
roles[TextRole] = "plaintext";
+ roles[HighlightRole] = "highlight";
return roles;
}
@@ -188,7 +203,7 @@
return iMessages.count() + 1;
}
-QVariant FsIoLogModel::data(const QModelIndex& index, int role) const
+QVariant FsIoLogModel::data(const QModelIndex& index, int aRole) const
{
QVariant value;
const int row = index.row();
@@ -196,25 +211,17 @@
const int count = iMessages.count();
if (row < count) {
const Entry* entry = iMessages.at(row);
- switch (role) {
- case TimeRole:
- value = entry->iTimestamp;
- break;
- case TextRole:
- value = entry->iText;
- break;
- default:
- break;
+ switch ((FsIoLogRole)aRole) {
+ case TimeRole: return entry->iTimestamp;
+ case TextRole: return entry->iText;
+ case HighlightRole: return entry->iHighlight;
}
} else if (row == count) {
// Last row is empty
- switch (role) {
+ switch ((FsIoLogRole)aRole) {
case TimeRole:
- case TextRole:
- value = QString();
- break;
- default:
- break;
+ case TextRole: return QString();
+ case HighlightRole: return false;
}
}
}
@@ -237,27 +244,39 @@
}
}
-void FsIoLogModel::append(QString aMessage, bool aMmsEngineLog)
+void FsIoLogModel::append(QString aMessage, int aFlags)
{
- if (aMmsEngineLog) {
+ if (aFlags & Entry::FROM_MMS_ENGINE) {
iLogFile.write(aMessage.toUtf8());
iLogFile.write("\n");
}
removeExtraLines(1);
const int count = iMessages.count();
beginInsertRows(QModelIndex(), count+1, count+1);
- iMessages.append(new Entry(aMessage, aMmsEngineLog));
+ iMessages.append(new Entry(aMessage, aFlags));
endInsertRows();
QModelIndex index(createIndex(count, 0));
emit dataChanged(index, index);
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/src/mmslogmodel.h
^
|
@@ -1,34 +1,34 @@
/*
- Copyright (C) 2014-2016 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
-
- You may use this file under the terms of BSD license as follows:
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Jolla Ltd nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef MMSLOGMODEL_H
#define MMSLOGMODEL_H
@@ -80,7 +80,8 @@
void flushed();
private Q_SLOTS:
- void append(QString aMessage, bool aMmsEngineLog = false);
+ void warning(QString aMessage);
+ void logMessage(QString aMessage);
void processDied(int aPid, int aStatus);
void updateLogSizeLimit();
void onSaveTaskDone(bool aSuccess);
@@ -88,6 +89,7 @@
private:
void deleteAllMessages();
bool removeExtraLines(int aReserve);
+ void append(QString aMessage, int aFlags);
private:
AppSettings* iSettings;
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/translations/harbour-mmslog-nl.ts
^
|
@@ -7,6 +7,11 @@
<source>MMS</source>
<translation>Mms</translation>
</message>
+ <message id="mmslog-notification-copied_to_clipboard">
+ <source>Copied to clipboard</source>
+ <extracomment>Pop-up notification</extracomment>
+ <translation>Gekopieerd naar klembord</translation>
+ </message>
<message id="mmslog-logpage-pm-settings">
<source>Settings</source>
<extracomment>Pulley menu item</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/translations/harbour-mmslog-ru.ts
^
|
@@ -7,6 +7,11 @@
<source>MMS</source>
<translation>MMS</translation>
</message>
+ <message id="mmslog-notification-copied_to_clipboard">
+ <source>Copied to clipboard</source>
+ <extracomment>Pop-up notification</extracomment>
+ <translation>Скопировано</translation>
+ </message>
<message id="mmslog-logpage-pm-settings">
<source>Settings</source>
<extracomment>Pulley menu item</extracomment>
@@ -24,7 +29,7 @@
</message>
<message id="mmslog-logpage-title">
<source>MMS engine log</source>
- <translation>Журнал</translation>
+ <translation>Журнал MMS</translation>
</message>
<message id="mmslog-sharemethodlist-add-account">
<source>Add account</source>
@@ -38,7 +43,7 @@
<message id="mmslog-sharepage-sharing_broken">
<source>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</source>
<extracomment>Info label displayed instead of sharing method list</extracomment>
- <translation>Увы, но в этой версии Sailfish OS ничего так просто расшарить не получится. Вы можете сохранить тарбол в документы, а дальше разбирайтесь сами, что с ним делать.</translation>
+ <translation>Увы, но в этой версии Sailfish OS ничего так просто расшарить не получится. Вы можете сохранить тарбол в документы, а дальше сами разбирайтесь, что и как с ним делать.</translation>
</message>
<message id="mmslog-sharepage-warning">
<source>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</source>
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/translations/harbour-mmslog-sv.ts
^
|
@@ -7,6 +7,11 @@
<source>MMS</source>
<translation>MMS</translation>
</message>
+ <message id="mmslog-notification-copied_to_clipboard">
+ <source>Copied to clipboard</source>
+ <extracomment>Pop-up notification</extracomment>
+ <translation>Kopierat till urklipp</translation>
+ </message>
<message id="mmslog-logpage-pm-settings">
<source>Settings</source>
<extracomment>Pulley menu item</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:openrepos-mmslog-1.0.19.tar.bz2/translations/harbour-mmslog.ts
^
|
@@ -7,6 +7,11 @@
<source>MMS</source>
<translation>MMS</translation>
</message>
+ <message id="mmslog-notification-copied_to_clipboard">
+ <source>Copied to clipboard</source>
+ <extracomment>Pop-up notification</extracomment>
+ <translation>Copied to clipboard</translation>
+ </message>
<message id="mmslog-logpage-pm-settings">
<source>Settings</source>
<extracomment>Pulley menu item</extracomment>
|