Skip to content
Permalink
Browse files

#1198, more Nextcloud bookmarks import implementation

  • Loading branch information...
pbek committed May 1, 2019
1 parent f1ebf47 commit 7c260d694f5ceb8c584d0b8a36241da1e30d1350
Showing with 1,213 additions and 901 deletions.
  1. +2 −0 CHANGELOG.md
  2. +32 −5 src/dialogs/serverbookmarksimportdialog.cpp
  3. +5 −4 src/dialogs/serverbookmarksimportdialog.h
  4. +53 −2 src/dialogs/serverbookmarksimportdialog.ui
  5. +29 −23 src/languages/QOwnNotes_ar.ts
  6. +29 −23 src/languages/QOwnNotes_bn.ts
  7. +29 −23 src/languages/QOwnNotes_ca.ts
  8. +29 −23 src/languages/QOwnNotes_ceb.ts
  9. +29 −23 src/languages/QOwnNotes_cs.ts
  10. +29 −23 src/languages/QOwnNotes_da.ts
  11. +29 −23 src/languages/QOwnNotes_de.ts
  12. +29 −23 src/languages/QOwnNotes_el.ts
  13. +29 −23 src/languages/QOwnNotes_en.ts
  14. +29 −23 src/languages/QOwnNotes_es.ts
  15. +29 −23 src/languages/QOwnNotes_fi.ts
  16. +29 −23 src/languages/QOwnNotes_fil.ts
  17. +29 −23 src/languages/QOwnNotes_fr.ts
  18. +29 −23 src/languages/QOwnNotes_gl.ts
  19. +29 −23 src/languages/QOwnNotes_hi.ts
  20. +29 −23 src/languages/QOwnNotes_hil.ts
  21. +29 −23 src/languages/QOwnNotes_hr.ts
  22. +29 −23 src/languages/QOwnNotes_hu.ts
  23. +29 −23 src/languages/QOwnNotes_id.ts
  24. +29 −23 src/languages/QOwnNotes_it.ts
  25. +29 −23 src/languages/QOwnNotes_ja.ts
  26. +29 −23 src/languages/QOwnNotes_nl.ts
  27. +29 −23 src/languages/QOwnNotes_no.ts
  28. +29 −23 src/languages/QOwnNotes_pl.ts
  29. +29 −23 src/languages/QOwnNotes_pt_BR.ts
  30. +29 −23 src/languages/QOwnNotes_pt_PT.ts
  31. +29 −23 src/languages/QOwnNotes_ro.ts
  32. +29 −23 src/languages/QOwnNotes_ru.ts
  33. +29 −23 src/languages/QOwnNotes_sk.ts
  34. +29 −23 src/languages/QOwnNotes_sl.ts
  35. +29 −23 src/languages/QOwnNotes_sv.ts
  36. +29 −23 src/languages/QOwnNotes_tl.ts
  37. +29 −23 src/languages/QOwnNotes_tr.ts
  38. +29 −23 src/languages/QOwnNotes_uk.ts
  39. +29 −23 src/languages/QOwnNotes_ur.ts
  40. +29 −23 src/languages/QOwnNotes_zh_CN.ts
  41. +29 −23 src/languages/QOwnNotes_zh_TW.ts
  42. +0 −1 src/services/owncloudservice.cpp
  43. +46 −38 src/services/websocketserverservice.cpp
  44. +2 −0 src/services/websocketserverservice.h
@@ -1,6 +1,8 @@
# QOwnNotes Changelog

## 19.5.0
- you are now able to **import bookmarks** from [Nextcloud bookmarks](https://github.com/nextcloud/bookmarks)
in the *Notes / Import* menu (for [#1198](https://github.com/pbek/QOwnNotes/issues/1198))
- **QOwnNotesAPI** is now ready for **Nextcloud 16**
- see [QOwnNotesAPI for Nextcloud](https://apps.nextcloud.com/apps/qownnotesapi)

@@ -1,4 +1,5 @@
#include <QtQml/QJSValueIterator>
#include <QtCore/QJsonArray>
#include "serverbookmarksimportdialog.h"
#include "ui_serverbookmarksimportdialog.h"

@@ -11,10 +12,13 @@ ServerBookmarksImportDialog::ServerBookmarksImportDialog(
// init the iterator for the versions
QJSValueIterator bookmarksIterator(bookmarks);

QJsonArray bookmarkList;
QString url;
QString title;
QString description;
QStringList tags;
int bookmarksCount = 0;
qDebug() << __func__ << " - 'jsonObject': " << jsonObject;

// iterate over the bookmarks
while (bookmarksIterator.hasNext()) {
@@ -28,20 +32,43 @@ ServerBookmarksImportDialog::ServerBookmarksImportDialog(

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();
description = bookmarksIterator.value().property("description")
.toString().remove("#");
tags = bookmarksIterator.value().property("tags").toVariant()
.toStringList();

Q_FOREACH(QString tag, tags) {
description.prepend("#" + tag.replace(" ", "-") + " ");
}

qDebug() << __func__ << " - 'tags': " << tags;
QJsonObject data {
{"name", title},
{"url", url},
{"description", description.trimmed()}
};

bookmarkList.append(data);
bookmarksCount++;
}

jsonObject = QJsonObject{
{"type", "newBookmarks"},
{"data", bookmarkList}
};

ui->progressBar->setMaximum(bookmarksCount);
}

ServerBookmarksImportDialog::~ServerBookmarksImportDialog() {
delete ui;
}

void ServerBookmarksImportDialog::on_importButton_clicked() {
QJsonArray bookmarkList = WebSocketServerService::createBookmarks(jsonObject);
ui->progressBar->setValue(bookmarkList.count());
}
@@ -1,5 +1,4 @@
#ifndef SERVERBOOKMARKSIMPORTDIALOG_H
#define SERVERBOOKMARKSIMPORTDIALOG_H
#pragma once

#include <QDialog>
#include <QJSValue>
@@ -19,8 +18,10 @@ class ServerBookmarksImportDialog : public MasterDialog
MainWindow *mainWindow, QWidget *parent = 0);
~ServerBookmarksImportDialog();

private slots:
void on_importButton_clicked();

private:
Ui::ServerBookmarksImportDialog *ui;
QJsonObject jsonObject;
};

#endif // SERVERBOOKMARKSIMPORTDIALOG_H
@@ -7,13 +7,64 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>113</height>
</rect>
</property>
<property name="windowTitle">
<string>Import bookmarks</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="importButton">
<property name="text">
<string>Import bookmarks</string>
</property>
<property name="icon">
<iconset theme="document-import" resource="../breeze-qownnotes.qrc">
<normaloff>:/icons/breeze-qownnotes/16x16/document-import.svg</normaloff>:/icons/breeze-qownnotes/16x16/document-import.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="format">
<string>%v of %m bookmark(s) imported</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../breeze-qownnotes.qrc"/>
</resources>
<connections/>
</ui>
@@ -3223,103 +3223,103 @@ If the trash is enabled on your ownCloud server you should be able to restore th
<context>
<name>OwnCloudService</name>
<message>
<location filename="../services/owncloudservice.cpp" line="190"/>
<location filename="../services/owncloudservice.cpp" line="189"/>
<source>Username / password error</source>
<translation>خطأ في اسم المستخدم/ كلمة السر</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="191"/>
<location filename="../services/owncloudservice.cpp" line="190"/>
<source>Your calendar username or password is incorrect!</source>
<translation>اسم المستخدم أو كلمة السر لتقويمك غير صحيحة!</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="517"/>
<location filename="../services/owncloudservice.cpp" line="516"/>
<source>API app version too low</source>
<translation type="unfinished">API app version too low</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="518"/>
<location filename="../services/owncloudservice.cpp" line="517"/>
<source>Please consider updating your QOwnNotesAPI app on your server, your app version %1 is too low and may cause troubles in QOwnNotes.</source>
<translation>يرجى تحديث تطبيق QOwnNotesAPI على السيرفر الخاصة بك، إصدار تطبيقك %1 منخفض جداً وقد يسبب مشاكل في QOwnNotesAPI.</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1003"/>
<location filename="../services/owncloudservice.cpp" line="1002"/>
<source>ownCloud server connection error</source>
<translation>خطأ في الاتصال بخادم ownCloud</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1007"/>
<location filename="../services/owncloudservice.cpp" line="1006"/>
<source>ownCloud server error: &lt;strong&gt;%1&lt;/strong&gt;&lt;br /&gt;Please check your ownCloud configuration.</source>
<translation>خطأ في خادم ownCloud: &lt;strong&gt;%1&lt;/strong&gt;&lt;br /&gt; الرجاء التحقق من إعداداتك لـ ownCloud</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1025"/>
<location filename="../services/owncloudservice.cpp" line="1024"/>
<source>You need to setup your ownCloud server!</source>
<translation>تحتاج إلى إعداد خادم ownCloud خاصتك!</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1038"/>
<location filename="../services/owncloudservice.cpp" line="1037"/>
<source>Open &amp;settings</source>
<translation>افتح الإ&amp;عدادات</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1038"/>
<location filename="../services/owncloudservice.cpp" line="1037"/>
<source>&amp;Cancel</source>
<translation>ألغ</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1083"/>
<location filename="../services/owncloudservice.cpp" line="1082"/>
<source>Done with loading note versions</source>
<translation>انتهى تحميل إصدارات الملاحظة</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1122"/>
<location filename="../services/owncloudservice.cpp" line="1121"/>
<source>No versions found</source>
<translation>لم يتم العثور على إصدارات</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1123"/>
<location filename="../services/owncloudservice.cpp" line="1122"/>
<source>There are no versions for this note or the note wasn&apos;t found on the server.</source>
<translation>لا يوجد إصدارات لهذه المذكرة، أو لم يتم العثور عليها على السيرفر.</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1144"/>
<location filename="../services/owncloudservice.cpp" line="1143"/>
<source>Done with loading trashed notes</source>
<translation>انتهى تحميل الملاحظات الموجودة في سلة المهملات</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1185"/>
<location filename="../services/owncloudservice.cpp" line="1184"/>
<source>No trashed notes</source>
<translation>لا يوجد ملفات محذوفة</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1186"/>
<location filename="../services/owncloudservice.cpp" line="1185"/>
<source>No trashed notes were found on the server.</source>
<translation>لا يوجد ملفات محذوفة على السيرفر.</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1209"/>
<location filename="../services/owncloudservice.cpp" line="1235"/>
<location filename="../services/owncloudservice.cpp" line="1208"/>
<location filename="../services/owncloudservice.cpp" line="1234"/>
<source>Error while loading todo lists!</source>
<translation>خطأ خلال تحميل قوائم للإنجاز!</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1210"/>
<location filename="../services/owncloudservice.cpp" line="1209"/>
<source>Your CalDAV server didn&apos;t reply anything!</source>
<translation>لم يرد خادمك لـ CalDAV بأي شيء!</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1236"/>
<location filename="../services/owncloudservice.cpp" line="1235"/>
<source>Error message from your CalDAV server: &lt;strong&gt;%1&lt;/strong&gt;</source>
<translation>رسالة خطأ من خادمك لـ CalDAV: &lt;strong&gt;%1&lt;/strong&gt;</translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1882"/>
<location filename="../services/owncloudservice.cpp" line="1881"/>
<source>No bookmarks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../services/owncloudservice.cpp" line="1883"/>
<location filename="../services/owncloudservice.cpp" line="1882"/>
<source>No bookmarks were found on the server.</source>
<translation type="unfinished"></translation>
</message>
@@ -3833,9 +3833,15 @@ Do you want to install it anyway?</translation>
<name>ServerBookmarksImportDialog</name>
<message>
<location filename="../dialogs/serverbookmarksimportdialog.ui" line="14"/>
<location filename="../dialogs/serverbookmarksimportdialog.ui" line="46"/>
<source>Import bookmarks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/serverbookmarksimportdialog.ui" line="60"/>
<source>%v of %m bookmark(s) imported</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
@@ -6675,7 +6681,7 @@ This cannot be undone!</source>
<translation type="unfinished">%1 connected to QOwnNotes server!</translation>
</message>
<message numerus="yes">
<location filename="../services/websocketserverservice.cpp" line="201"/>
<location filename="../services/websocketserverservice.cpp" line="164"/>
<source>%n bookmark(s) created</source>
<translation type="unfinished">
<numerusform>%n bookmark(s) created</numerusform>
@@ -6687,7 +6693,7 @@ This cannot be undone!</source>
</translation>
</message>
<message>
<location filename="../services/websocketserverservice.cpp" line="261"/>
<location filename="../services/websocketserverservice.cpp" line="269"/>
<source>%1 was disconnected from QOwnNotes server</source>
<translation type="unfinished">%1 was disconnected from QOwnNotes server</translation>
</message>

0 comments on commit 7c260d6

Please sign in to comment.
You can’t perform that action at this time.