aboutsummaryrefslogtreecommitdiff
path: root/src/forms
diff options
context:
space:
mode:
Diffstat (limited to 'src/forms')
-rw-r--r--src/forms/bookmarkswidget.cpp2
-rw-r--r--src/forms/profilesdialog.cpp54
-rw-r--r--src/forms/profilesdialog.h50
-rw-r--r--src/forms/profilesdialog.ui74
4 files changed, 179 insertions, 1 deletions
diff --git a/src/forms/bookmarkswidget.cpp b/src/forms/bookmarkswidget.cpp
index ffb5d6c..9a43224 100644
--- a/src/forms/bookmarkswidget.cpp
+++ b/src/forms/bookmarkswidget.cpp
@@ -89,7 +89,7 @@ void BookmarksWidget::openItem(QTreeWidgetItem *item, int column)
Q_UNUSED(column)
if(window) {
- window->addNewTab(QUrl::fromUserInput(item->text(1)));
+ window->newTab(QUrl::fromUserInput(item->text(1)));
} else {
qWarning("Trying to open a link without a MainWindow set");
}
diff --git a/src/forms/profilesdialog.cpp b/src/forms/profilesdialog.cpp
new file mode 100644
index 0000000..c77208d
--- /dev/null
+++ b/src/forms/profilesdialog.cpp
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ **
+ ** smolbote: yet another qute browser
+ ** Copyright (C) 2017 Xian Nox
+ **
+ ** 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 3 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, see <http://www.gnu.org/licenses/>.
+ **
+ ******************************************************************************/
+
+#include "profilesdialog.h"
+#include "ui_profilesdialog.h"
+
+#include "browser.h"
+#include <QListWidget>
+
+ProfilesDialog::ProfilesDialog(MainWindow *window, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ProfilesDialog)
+{
+ ui->setupUi(this);
+ m_window = window;
+
+ connect(this, SIGNAL(accepted()), this, SLOT(loadSelectedProfile()));
+}
+
+ProfilesDialog::~ProfilesDialog()
+{
+ delete ui;
+}
+
+int ProfilesDialog::exec()
+{
+ qDebug("Showing...");
+ for(QString name : qApp->profiles()) {
+ ui->listWidget->addItem(name);
+ }
+ return QDialog::exec();
+}
+
+void ProfilesDialog::loadSelectedProfile()
+{
+ m_window->setProfile(qApp->profile(ui->listWidget->currentItem()->text()));
+}
diff --git a/src/forms/profilesdialog.h b/src/forms/profilesdialog.h
new file mode 100644
index 0000000..bb6655b
--- /dev/null
+++ b/src/forms/profilesdialog.h
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ **
+ ** smolbote: yet another qute browser
+ ** Copyright (C) 2017 Xian Nox
+ **
+ ** 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 3 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, see <http://www.gnu.org/licenses/>.
+ **
+ ******************************************************************************/
+
+#ifndef PROFILESDIALOG_H
+#define PROFILESDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class ProfilesDialog;
+}
+
+class MainWindow;
+class ProfilesDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit ProfilesDialog(MainWindow *window, QWidget *parent = 0);
+ ~ProfilesDialog();
+
+public slots:
+ int exec();
+
+private slots:
+ void loadSelectedProfile();
+
+private:
+ Ui::ProfilesDialog *ui;
+ MainWindow *m_window;
+};
+
+#endif // PROFILESDIALOG_H
diff --git a/src/forms/profilesdialog.ui b/src/forms/profilesdialog.ui
new file mode 100644
index 0000000..880e441
--- /dev/null
+++ b/src/forms/profilesdialog.ui
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProfilesDialog</class>
+ <widget class="QDialog" name="ProfilesDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>564</width>
+ <height>458</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ <item>
+ <widget class="QWidget" name="widget" native="true"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ProfilesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ProfilesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>