diff --git a/src/browsermanager.h b/src/browsermanager.h index 83cc7eb..70c9748 100644 --- a/src/browsermanager.h +++ b/src/browsermanager.h @@ -1,78 +1,78 @@ /*************************************************************************** * * * Copyright 2014 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ #ifndef BOOKMARKSMANAGER_H #define BOOKMARKSMANAGER_H #include #include #include "urlmodel.h" namespace AngelFish { /** * @class BookmarksManager * @short Access to Bookmarks and History. This is a singleton for * administration and access to the various models and browser-internal * data. */ class BrowserManager : public QObject { Q_OBJECT Q_PROPERTY(QAbstractListModel* bookmarks READ bookmarks NOTIFY bookmarksChanged) Q_PROPERTY(QAbstractListModel* history READ history NOTIFY historyChanged) public: - BrowserManager(QObject *parent = 0); + BrowserManager(QObject *parent = nullptr); ~BrowserManager(); UrlModel* bookmarks(); UrlModel* history(); Q_INVOKABLE static QString urlFromUserInput(const QString &input); Q_SIGNALS: void updated(); void bookmarksChanged(); void historyChanged(); public Q_SLOTS: void reload(); void addBookmark(const QVariantMap &bookmarkdata); void removeBookmark(const QString &url); void addToHistory(const QVariantMap &pagedata); void removeFromHistory(const QString &url); private: UrlModel* m_bookmarks; UrlModel* m_history; }; } // namespace #endif //BOOKMARKSMANAGER_H diff --git a/src/main.cpp b/src/main.cpp index 6f6550e..ef7a5ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,35 +1,35 @@ #include #include #include #include #include #include #include "browsermanager.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QCoreApplication::setOrganizationName("KDE"); QCoreApplication::setOrganizationDomain("kde.org"); QCoreApplication::setApplicationName("angelfish"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///webbrowser.qml"))); - AngelFish::BrowserManager *browserManager = new AngelFish::BrowserManager(engine.rootContext()); + auto *browserManager = new AngelFish::BrowserManager(engine.rootContext()); engine.rootContext()->setContextProperty("browserManager", browserManager); qmlRegisterUncreatableType("org.kde.mobile.angelfish", 1, 0, "BrowserManager", ""); qmlRegisterType(); if (engine.rootObjects().isEmpty()) { return -1; } int ret = app.exec(); return ret; } diff --git a/src/urlmodel.h b/src/urlmodel.h index 8f1b3ae..17102d1 100644 --- a/src/urlmodel.h +++ b/src/urlmodel.h @@ -1,77 +1,77 @@ /*************************************************************************** * * * Copyright 2014-2015 Sebastian Kügler * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ #ifndef URLMODEL_H #define URLMODEL_H #include #include #include namespace AngelFish { class UrlModel : public QAbstractListModel { Q_OBJECT public: enum Roles { url = Qt::UserRole + 1, title, icon, preview, lastVisited, bookmarked }; - explicit UrlModel(const QString &filename, QObject *parent = 0); + explicit UrlModel(QString filename, QObject *parent = nullptr); void setSourceData(QJsonArray &data); QJsonArray sourceData() const; QString key(int role) const; bool load(); bool save(); void add(const QJsonObject &data); void remove(const QString &url); virtual QHash roleNames() const; virtual int rowCount(const QModelIndex &parent) const; virtual QVariant data(const QModelIndex &index, int role) const; void update(); QJsonArray fakeData(); QString filePath() const; private: QJsonArray m_data; QHash m_roleNames; QString m_fileName; }; } // namespace #endif // URLMODEL_H