Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 84720fed authored by Camilo Higuita's avatar Camilo Higuita

initial work on links saving

parent 3f4f43e3
......@@ -13,7 +13,8 @@ SOURCES += \
src/db/db.cpp \
src/db/dbactions.cpp \
src/buho.cpp \
src/documenthandler.cpp
src/documenthandler.cpp \
src/linker.cpp
RESOURCES += \
qml.qrc
......@@ -56,5 +57,6 @@ HEADERS += \
src/db/dbactions.h \
src/buho.h \
src/utils/owl.h \
src/documenthandler.h
src/documenthandler.h \
src/linker.h
......@@ -6,5 +6,6 @@
<file>src/widgets/CardsView.qml</file>
<file>src/views/notes/NotesView.qml</file>
<file>src/widgets/CardDelegate.qml</file>
<file>src/widgets/NewLinkDialog.qml</file>
</qresource>
</RCC>
......@@ -14,3 +14,11 @@ title TEXT NOT NULL,
fav INTEGER NOT NULL,
addDate DATE
);
CREATE TABLE IF NOT EXISTS LINKS (
url TEXT PRIMARY KEY,
title TEXT,
body TEXT,
preview TEXT,
addDate DATE
);
#include "linker.h"
linker::linker(QObject *parent) : QObject(parent)
{
}
#ifndef LINKER_H
#define LINKER_H
#include <QObject>
class linker : public QObject
{
Q_OBJECT
public:
explicit linker(QObject *parent = nullptr);
signals:
public slots:
};
#endif // LINKER_H
\ No newline at end of file
......@@ -89,6 +89,7 @@ enum class KEY :uint8_t
COLOR,
ADD_DATE,
TAG,
PREVIEW,
NONE
};
......@@ -105,7 +106,8 @@ static const DB KEYMAP =
{KEY::FAV, "fav"},
{KEY::COLOR, "color"},
{KEY::ADD_DATE, "addDate"},
{KEY::TAG, "tag"}
{KEY::TAG, "tag"},
{KEY::PREVIEW, "preview"}
};
const QString CollectionDBPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/buho/";
......
......@@ -89,10 +89,20 @@ ItemDelegate
Item
{
id: preview
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumHeight: control.height * 0.3
Image
{
id: img
visible: model.preview
asynchronous: true
height: parent.height
width: parent.width
sourceSize.height: height
sourceSize.width: width
fillMode: Image.PreserveAspectCrop
source: model.preview
}
}
}
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import org.kde.maui 1.0 as Maui
import org.buho.editor 1.0
Popup
{
parent: ApplicationWindow.overlay
height: parent.height * (isMobile ? 0.8 : 0.7)
width: parent.width * (isMobile ? 0.9 : 0.7)
signal linkSaved(var note)
property bool previewReady : false
x: (parent.width / 2) - (width / 2)
y: (parent.height /2 ) - (height / 2)
padding: 1
Rectangle
{
id: bg
color: selectedColor
z: -1
anchors.fill: parent
}
ColumnLayout
{
id: content
anchors.fill: parent
TextField
{
id: link
Layout.fillWidth: true
Layout.margins: space.medium
height: 24
placeholderText: qsTr("Title")
font.weight: Font.Bold
font.bold: true
background: Rectangle
{
color: "transparent"
}
}
ScrollView
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.margins: space.medium
TextArea
{
id: body
placeholderText: qsTr("Body")
textFormat : TextEdit.AutoText
enabled: false
background: Rectangle
{
color: "transparent"
}
}
}
Row
{
Layout.fillWidth: true
width: parent.width
Layout.margins: space.medium
Layout.alignment: Qt.AlignRight
spacing: space.medium
Button
{
id: save
text: qsTr("Save")
onClicked:
{
close()
noteSaved({
title: title.text,
body: body.text,
color: selectedColor,
tags: ""
})
clearNote()
}
}
Button
{
id: discard
text: qsTr("Discard")
onClicked:
{
close()
clearNote()
}
}
}
}
function clearNote()
{
title.clear()
body.clear()
}
function fill(note)
{
document.load("qrc:/texteditor.html")
title.text = note.title
body.text = note.body
selectedColor = note.color
open()
}
}
......@@ -27,6 +27,7 @@ Popup
ColumnLayout
{
id: content
anchors.fill: parent
Maui.ToolBar
......@@ -247,7 +248,6 @@ Popup
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment