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

Fix WebDAV + Thumbnail + Open + Share + port.text + another fix #60

Draft
wants to merge 10 commits into
base: do-webdav
Choose a base branch
from
8 changes: 1 addition & 7 deletions qml/pages/AddWebDavAccount.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Page {
width: parent.width
//placeholderText: qsTr("Service name")
label: qsTr("Service name")
_labelItem.opacity: 1
enabled: !working
focus: true
EnterKey.enabled: name.text.length>0
Expand All @@ -78,7 +77,6 @@ Page {
placeholderText: "webdav.service.com"
inputMethodHints: Qt.ImhNoAutoUppercase
label: qsTr("Server")
_labelItem.opacity: 1
enabled: !working
EnterKey.enabled: host.text.length>0
EnterKey.onClicked: path.forceActiveFocus()
Expand All @@ -90,7 +88,6 @@ Page {
placeholderText: "/"
text: "/"
label: qsTr("Path")
_labelItem.opacity: 1
enabled: !working
EnterKey.enabled: path.text.length>0
EnterKey.onClicked: port.forceActiveFocus()
Expand All @@ -102,7 +99,6 @@ Page {
placeholderText: host.text.indexOf("http://")>-1? "80" : "443"
text: host.text.indexOf("http://")>-1? "80" : "443"
label: qsTr("Port")
_labelItem.opacity: 1
inputMethodHints: Qt.ImhDigitsOnly
enabled: !working
EnterKey.enabled: port.text.length>0
Expand All @@ -114,7 +110,6 @@ Page {
width: parent.width
//placeholderText: qsTr("User")
label: qsTr("User")
_labelItem.opacity: 1
inputMethodHints: Qt.ImhNoAutoUppercase
enabled: !working
EnterKey.enabled: user.text.length>0
Expand All @@ -126,7 +121,6 @@ Page {
width: parent.width
//placeholderText: qsTr("Password")
label: qsTr("Password")
_labelItem.opacity: 1
enabled: !working
echoMode: TextInput.Password
inputMethodHints: Qt.ImhNoAutoUppercase
Expand All @@ -146,7 +140,7 @@ Page {
enabled: !working && name.text.length>0 && host.text.length>0 && path.text.length>0 && user.text.length>0 && pass.text.length>0
onClicked: {
working = true
webdav.createAccount(name.text, host.text, path.text, user.text, pass.text)
webdav.createAccount(name.text, host.text, path.text, user.text, pass.text, port.text)
}
}

Expand Down
2 changes: 1 addition & 1 deletion qml/pages/FileDelegate.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import FileCase 1.0
import org.nemomobile.thumbnailer 1.0
import Nemo.Thumbnailer 1.0

ListItem {

Expand Down
4 changes: 2 additions & 2 deletions qml/pages/FileInfo.qml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import FileCase 1.0
import org.nemomobile.thumbnailer 1.0
import QtMultimedia 5.0
import Nemo.Thumbnailer 1.0

Page {
id: infoPage
Expand Down Expand Up @@ -108,7 +108,7 @@ Page {
MenuItem {
text: isPackage && !cloudFile? qsTr("Install") : qsTr("Open")
visible: !cloudFile && !isTextFile
onClicked: utilities.openFile(fileInfo.data.path + "/" + fileInfo.data.name)
onClicked: Qt.openUrlExternally(fileInfo.data.path + "/" + fileInfo.data.name)
}

MenuItem {
Expand Down
29 changes: 15 additions & 14 deletions qml/pages/UploadFiles.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
import FileCase 1.0
import QtMultimedia 5.0
import Sailfish.TransferEngine 1.0
import Sailfish.Share 1.0

Page {

Expand All @@ -20,11 +20,16 @@ Page {
pageStack.pop()
}

SailfishTransferMethodsModel {
id: transferMethodsModel
// filter: fileInfo.data.mime // Debatable, if no filter is better, as it allows for all files

ShareAction {
id: shareAction
}

// SailfishTransferMethodsModel {
// id: transferMethodsModel
// // filter: fileInfo.data.mime // Debatable, if no filter is better, as it allows for all files
// }

ListModel {
id: emptyModel
}
Expand Down Expand Up @@ -72,13 +77,16 @@ Page {
}
}



Repeater {
id: rootList
property url source: fileInfo.data.path + "/" + fileInfo.data.name
property variant content: ({})
//property alias filter: transferMethodsModel.filter

model: fileInfo.data.icon!==""? transferMethodsModel : emptyModel
// model: fileInfo.data.icon!==""? transferMethodsModel : emptyModel
model: emptyModel

objectName: "menuList"
//source: fileInfo.path + "/" + fileInfo.name
Expand All @@ -90,15 +98,8 @@ Page {
title: qsTrId(displayName)
description: userName
onClicked: {
clearSelectionItems()
pageStack.replace(shareUIPath, {
source: rootList.source,
content: rootList.content,
methodId: methodId,
displayName: displayName,
accountId: accountId,
accountName: userName
})
shareAction.fileUrls = [rootList.source]
shareAction.share()

}

Expand Down
5 changes: 5 additions & 0 deletions rpm/filecase.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Sat Nov 25 2023 Amer Almadani (Logic-gate) <amer@ma.tc> - 0.4.4
- Fix QML rendering error in AddWebDavAccount
- Fix Transfer View For Webdav Upload
- Fix Webdav Upload

* Fri Nov 24 2023 olf <Olf0@users.noreply.github.com> - 0.4.3
- Update Swedish translation (PR #47) by @eson57
- Introduce a quick & dirty workaround for issue #15 (PR #46) by @simonschmeisser
Expand Down
4 changes: 2 additions & 2 deletions rpm/filecase.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Name: filecase
Summary: An advanced file-manager for SailfishOS
# The <version> tag must adhere to semantic versioning: Among multiple other
# reasons due to its use for `qmake5` in line 107. See https://semver.org/
Version: 0.4.3
Version: 0.4.4
# The <release> tag comprises one of {alpha,beta,rc,release} postfixed with a
# natural number greater or equal to 1 (e.g., "beta3") and may additionally be
# postfixed with a plus character ("+"), the name of the packager and a release
Expand All @@ -21,7 +21,7 @@ Version: 0.4.3
# build at GitHub and OBS, when configured accordingly; mind the sorting
# (`adud` < `alpha`). For details and reasons, see
# https://github.com/storeman-developers/harbour-storeman/wiki/Git-tag-format
Release: rc4
Release: rc5
# The Group tag should comprise one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Applications/File
Expand Down
37 changes: 20 additions & 17 deletions src/thumbgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <QImage>
#include <QSettings>
#include <QDebug>

#include <QProcess>
#include <QLibrary>

typedef QImage (*CreateThumbnailFunc)(const QString &fileName, const QSize &requestedSize, bool crop);
Expand Down Expand Up @@ -94,28 +94,31 @@ void ThumbGenerator::generate(QString filename)
file.replace("#","%2523");
file.replace(",","%2C");
file.replace(" ","%20");
file = "file://"+file;
file = "file://" + file;
md.addData(file.toUtf8());
QString tf = Config::getHome() + "/.thumbnails/whatsup/"+ QString(md.result().toHex().constData()) + ".jpeg";
QString tf = Config::getHome() + "/.thumbnails/whatsup/" + QString(md.result().toHex().constData()) + ".jpeg";
thumb = tf;

if ( !QFileInfo(tf).exists() )
if (!QFileInfo(thumb).exists())
{
//Utilities::logData("Generating video thumbnail for " + fileInfo.absoluteFilePath());
//VideoThumbnailer *thumbnailer = new VideoThumbnailer;
//QImage result = thumbnailer->createThumbnail(filename.remove("file://"), QSize(170,170), true);
QImage image;

static CreateThumbnailFunc createThumbnail = (CreateThumbnailFunc)QLibrary::resolve(
QLatin1String("/usr/lib/qt5/qml/org/nemomobile/thumbnailer/thumbnailers/libvideothumbnailer.so"), "createThumbnail");

if (createThumbnail) {
image = createThumbnail(filename, QSize(800,800), false);
QString command = "ffmpeg"; //used to replace "/usr/lib/qt5/qml/org/nemomobile/thumbnailer/thumbnailers/libvideothumbnailer.so" solution
QStringList arguments;
arguments << "-i" << fileInfo.absoluteFilePath()
<< "-ss" << "00:00:01" // Arbitrary time can be anything (1 second here)
<< "-vframes" << "1"
<< "-q:v" << "2" // Quality factor. Lower is better. Higher gives lower bitrate. 2 is 1735 kb/s Check https://ffmpeg.org/ffmpeg-codecs.html#Options-22
<< thumb;

QProcess process;
process.start(command, arguments);
process.waitForFinished();

if (process.exitCode() != 0) {
//Need to test what might go wrong..should add .close()
qDebug() << "ffmpeg ERROR: " << file;
}

image.save( tf, "JPEG" );
}
emit imgLoaded(tf);
emit imgLoaded(thumb);
}

imagesToProcess.removeAt(0);
Expand Down
10 changes: 9 additions & 1 deletion src/transfers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,19 @@ void Transfers::transferFile(QStringList file)
}




QStringList uploadPath = settings.value(file.at(0)+"/upload_folder","/||/").toString().split("||");

// qDebug() << "TEST POINT 3: " << uploadPath;

currentFile = QFileInfo(file.at(3)).fileName();
currentFile = uploadPath[1] + "/" + currentFile;
currentFile = uploadPath[0] + "/" + currentFile; //List only has one element, hench changing to first. This is due to a change in UploadFiles.qml
currentFile = currentFile.replace("https:/","https://");
currentFile = currentFile.replace("//","/");
uploadFile = new QFile(file.at(3));


if(!uploadFile->open(QFile::ReadOnly))
{
qDebug() << "ERROR OPENING FILE FOR UPLOAD!!!";
Expand All @@ -299,6 +304,9 @@ void Transfers::transferFile(QStringList file)

QByteArray myFile = uploadFile->readAll();

qDebug() << "TEST POINT 9";


if (file.at(0).startsWith("OneDrive"))
{
QUrl url(currentFile);
Expand Down
1 change: 1 addition & 0 deletions src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void Utilities::removeFromBookmarks(QString folder)

void Utilities::openFile(QString file)
{
// This is no longer needed since we will be using Qt.openUrlExternally. Keeping it here until final testing.
QProcess * process = new QProcess();
process->start(QString("xdg-open \"%2\"").arg(file));

Expand Down