Skip to content

Commit

Permalink
#1198, start of Nextcloud bookmarks import implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Apr 30, 2019
1 parent c116f29 commit f1ebf47
Show file tree
Hide file tree
Showing 50 changed files with 149,287 additions and 148,590 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
Slovak, Slovenian, Danish, Hungarian, Norwegian, Czech, Greek, Spanish translation
(thank you MGuerra, mlimacarlos, vistausss, tiwi90, Fabijenna, richarson, pu.sash)


## 19.4.1
- added support for **listing** the **note folders** and **changing** the
**current note folder** to the websocket api
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ qt5_wrap_ui(dialogs/ui_issueassistantdialog.h issueassistantdialog.ui)
qt5_wrap_ui(dialogs/ui_tagadddialog.h tagadddialog.ui)
qt5_wrap_ui(widgets/ui_fontcolorwidget.h fontcolorwidget.ui)
qt5_wrap_ui(widgets/ui_evernoteimportdialog.h ui_evernoteimportdialog.ui)
qt5_wrap_ui(widgets/ui_serverbookmarksimportdialog.h ui_serverbookmarksimportdialog.ui)
qt5_wrap_ui(widgets/ui_layoutwidget.ui ui_layoutwidget.ui)
qt5_wrap_ui(dialogs/ui_orphanedimagesdialog.h orphanedimagesdialog.ui)
qt5_wrap_ui(dialogs/ui_orphanedattachmentsdialog.h orphanedattachmentsdialog.ui)
Expand Down Expand Up @@ -109,6 +110,9 @@ set(SOURCE_FILES
dialogs/evernoteimportdialog.cpp
dialogs/evernoteimportdialog.h
dialogs/evernoteimportdialog.ui
dialogs/serverbookmarksimportdialog.cpp
dialogs/serverbookmarksimportdialog.h
dialogs/serverbookmarksimportdialog.ui
dialogs/orphanedimagesdialog.cpp
dialogs/orphanedimagesdialog.h
dialogs/orphanedimagesdialog.ui
Expand Down
9 changes: 6 additions & 3 deletions src/QOwnNotes.pro
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ SOURCES += main.cpp\
widgets/scriptlistwidget.cpp \
widgets/notefolderlistwidget.cpp \
widgets/notetreewidgetitem.cpp \
widgets/layoutwidget.cpp
widgets/layoutwidget.cpp \
dialogs/serverbookmarksimportdialog.cpp

HEADERS += mainwindow.h \
build_number.h \
Expand Down Expand Up @@ -225,7 +226,8 @@ HEADERS += mainwindow.h \
widgets/scriptlistwidget.h \
widgets/notefolderlistwidget.h \
widgets/notetreewidgetitem.h \
widgets/layoutwidget.h
widgets/layoutwidget.h \
dialogs/serverbookmarksimportdialog.h

FORMS += mainwindow.ui \
dialogs/notediffdialog.ui \
Expand Down Expand Up @@ -254,7 +256,8 @@ FORMS += mainwindow.ui \
widgets/qtexteditsearchwidget.ui \
widgets/scriptsettingwidget.ui \
widgets/notetreewidgetitem.ui \
widgets/layoutwidget.ui
widgets/layoutwidget.ui \
dialogs/serverbookmarksimportdialog.ui

RESOURCES += \
images.qrc \
Expand Down
2 changes: 1 addition & 1 deletion src/build_number.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD 533
#define BUILD 534
47 changes: 47 additions & 0 deletions src/dialogs/serverbookmarksimportdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <QtQml/QJSValueIterator>
#include "serverbookmarksimportdialog.h"
#include "ui_serverbookmarksimportdialog.h"

ServerBookmarksImportDialog::ServerBookmarksImportDialog(
QJSValue bookmarks, MainWindow *mainWindow, QWidget *parent) :
MasterDialog(parent),
ui(new Ui::ServerBookmarksImportDialog) {
ui->setupUi(this);

// init the iterator for the versions
QJSValueIterator bookmarksIterator(bookmarks);

QString url;
QString title;
QString description;
QStringList tags;

// iterate over the bookmarks
while (bookmarksIterator.hasNext()) {
bookmarksIterator.next();

QJSValue property = bookmarksIterator.value().property("url");

if (property.isUndefined()) {
continue;
}

url = property.toString();

qDebug() << __func__ << " - 'url': " << url;

if (url == "") {
continue;
}

title = bookmarksIterator.value().property("title").toString();
description = bookmarksIterator.value().property("description").toString();
tags = bookmarksIterator.value().property("tags").toVariant().toStringList();

qDebug() << __func__ << " - 'tags': " << tags;
}
}

ServerBookmarksImportDialog::~ServerBookmarksImportDialog() {
delete ui;
}
26 changes: 26 additions & 0 deletions src/dialogs/serverbookmarksimportdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef SERVERBOOKMARKSIMPORTDIALOG_H
#define SERVERBOOKMARKSIMPORTDIALOG_H

#include <QDialog>
#include <QJSValue>
#include <mainwindow.h>
#include "masterdialog.h"

namespace Ui {
class ServerBookmarksImportDialog;
}

class ServerBookmarksImportDialog : public MasterDialog
{
Q_OBJECT

public:
explicit ServerBookmarksImportDialog(QJSValue bookmarks,
MainWindow *mainWindow, QWidget *parent = 0);
~ServerBookmarksImportDialog();

private:
Ui::ServerBookmarksImportDialog *ui;
};

#endif // SERVERBOOKMARKSIMPORTDIALOG_H
19 changes: 19 additions & 0 deletions src/dialogs/serverbookmarksimportdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServerBookmarksImportDialog</class>
<widget class="QDialog" name="ServerBookmarksImportDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Import bookmarks</string>
</property>
</widget>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit f1ebf47

Please sign in to comment.