[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [labplot/sql] src/kdefrontend: First version of the SQL Database Manager.
From:       Alexander Semke <alexander.semke () web ! de>
Date:       2016-12-04 19:54:54
Message-ID: E1cDcsA-0005X9-Kd () code ! kde ! org
[Download RAW message or body]

Git commit 90ca193b001bfaba4f653f55a33506d498b6c3c2 by Alexander Semke.
Committed on 04/12/2016 at 19:54.
Pushed by asemke into branch 'sql'.

First version of the SQL Database Manager.

A  +60   -0    src/kdefrontend/datasources/DatabaseManagerDialog.cpp     [License: \
GPL (v2+)] A  +42   -0    src/kdefrontend/datasources/DatabaseManagerDialog.h     \
[License: GPL (v2+)] A  +65   -0    \
src/kdefrontend/datasources/DatabaseManagerWidget.cpp     [License: GPL (v2+)] A  +47 \
-0    src/kdefrontend/datasources/DatabaseManagerWidget.h     [License: GPL (v2+)] A  \
+187  -0    src/kdefrontend/ui/datasources/databasemanagerwidget.ui

https://commits.kde.org/labplot/90ca193b001bfaba4f653f55a33506d498b6c3c2

diff --git a/src/kdefrontend/datasources/DatabaseManagerDialog.cpp \
b/src/kdefrontend/datasources/DatabaseManagerDialog.cpp new file mode 100644
index 0000000..9c636cc
--- /dev/null
+++ b/src/kdefrontend/datasources/DatabaseManagerDialog.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+    File                 : DatabaseManagerDialog.cc
+    Project              : LabPlot
+    Description          : dialog for managing database connections
+    --------------------------------------------------------------------
+    Copyright            : (C) 2016 Alexander Semke (alexander.semke@web.de)
+
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *  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                                           *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "DatabaseManagerDialog.h"
+#include "DatabaseManagerWidget.h"
+
+#include <QTimer>
+
+/*!
+	\class DatabaseManagerDialog
+	\brief dialog for managing database connections
+
+	\ingroup kdefrontend
+ */
+
+DatabaseManagerDialog::DatabaseManagerDialog(QWidget* parent) : KDialog(parent) {
+
+	DatabaseManagerWidget* mainWidget = new DatabaseManagerWidget(this);
+	setMainWidget(mainWidget);
+
+	setWindowIcon(KIcon("network-server-database"));
+	setWindowTitle(i18n("SQL Database Connections"));
+
+	setButtons( KDialog::Ok | KDialog::Cancel );
+	
+	//restore saved settings
+	KConfigGroup conf(KSharedConfig::openConfig(), "DatabaseManagerDialog");
+	restoreDialogSize(conf);
+}
+
+DatabaseManagerDialog::~DatabaseManagerDialog() {
+	//save current settings
+	KConfigGroup conf(KSharedConfig::openConfig(), "DatabaseManagerDialog");
+	saveDialogSize(conf);
+}
diff --git a/src/kdefrontend/datasources/DatabaseManagerDialog.h \
b/src/kdefrontend/datasources/DatabaseManagerDialog.h new file mode 100644
index 0000000..e03f910
--- /dev/null
+++ b/src/kdefrontend/datasources/DatabaseManagerDialog.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+    File                 : DatabaseManagerDialog.h
+    Project              : LabPlot
+    Description          : dialog for managing database connections
+    --------------------------------------------------------------------
+    Copyright            : (C) 2016 Alexander Semke (alexander.semke@web.de)
+
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *  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 DATABASEMANAGERDIALOG_H
+#define DATABASEMANAGERDIALOG_H
+
+#include <KDialog>
+
+class DatabaseManagerDialog : public KDialog {
+	Q_OBJECT
+
+public:
+	explicit DatabaseManagerDialog(QWidget*);
+	~DatabaseManagerDialog();
+};
+
+#endif
diff --git a/src/kdefrontend/datasources/DatabaseManagerWidget.cpp \
b/src/kdefrontend/datasources/DatabaseManagerWidget.cpp new file mode 100644
index 0000000..41b0962
--- /dev/null
+++ b/src/kdefrontend/datasources/DatabaseManagerWidget.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+File                 : DatabaseManagerWidget.cpp
+Project              : LabPlot
+Description          : widget for managing database connections
+--------------------------------------------------------------------
+Copyright            : (C) 2016 Alexander Semke (alexander.semke@web.de)
+
+***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *  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                                           *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "DatabaseManagerWidget.h"
+
+#include <QTimer>
+
+/*!
+   \class DatabaseManagerWidget
+   \brief widget for managing database connections, embedded in \c \
DatabaseManagerDialog. +
+   \ingroup kdefrontend
+*/
+
+DatabaseManagerWidget::DatabaseManagerWidget(QWidget* parent) : QWidget(parent) {
+	ui.setupUi(this);
+
+	ui.tbAdd->setIcon(KIcon("list-add"));
+	ui.tbDelete->setIcon(KIcon("list-remove"));
+
+	ui.tbAdd->setToolTip(i18n("Add new database connection"));
+	ui.tbDelete->setToolTip(i18n("Delete selected database connection"));
+	ui.pbTestConnection->setToolTip(i18n("Test selected database connection"));
+
+	QTimer::singleShot( 100, this, SLOT(loadSettings()) );
+}
+
+/*!
+	read and show all available database connections
+ */
+void DatabaseManagerWidget::loadSettings() {
+	KConfigGroup conf(KSharedConfig::openConfig(),"DatabaseManager");
+	//TODO
+}
+
+DatabaseManagerWidget::~DatabaseManagerWidget() {
+	// save current settings
+	KConfigGroup conf(KSharedConfig::openConfig(), "DatabaseManager");
+	//TODO
+}
diff --git a/src/kdefrontend/datasources/DatabaseManagerWidget.h \
b/src/kdefrontend/datasources/DatabaseManagerWidget.h new file mode 100644
index 0000000..4ceb918
--- /dev/null
+++ b/src/kdefrontend/datasources/DatabaseManagerWidget.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+    File                 : DatabaseManagerWidget.h
+    Project              : LabPlot
+    Description          : widget for managing database connections
+    --------------------------------------------------------------------
+    Copyright            : (C) 2016 Alexander Semke (alexander.semke@web.de)
+
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *  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 DATABASEMANAGERWIDGET_H
+#define DATABASEMANAGERWIDGET_H
+
+#include "ui_databasemanagerwidget.h"
+
+class DatabaseManagerWidget : public QWidget {
+	Q_OBJECT
+
+public:
+	explicit DatabaseManagerWidget(QWidget*);
+	~DatabaseManagerWidget();
+
+private:
+	Ui::DatabaseManagerWidget ui;
+
+private slots:
+	void loadSettings();
+};
+
+#endif
diff --git a/src/kdefrontend/ui/datasources/databasemanagerwidget.ui \
b/src/kdefrontend/ui/datasources/databasemanagerwidget.ui new file mode 100644
index 0000000..29eea9b
--- /dev/null
+++ b/src/kdefrontend/ui/datasources/databasemanagerwidget.ui
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DatabaseManagerWidget</class>
+ <widget class="QWidget" name="DatabaseManagerWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>446</width>
+    <height>374</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_3">
+   <item row="0" column="0" rowspan="2">
+    <widget class="QListWidget" name="listWidget">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QGroupBox" name="groupBox">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title">
+      <string>Database</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="lVendor">
+        <property name="text">
+         <string>Vendor</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="cbVendor"/>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="lHostName">
+        <property name="text">
+         <string>Host</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="leHostName"/>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="lPort">
+        <property name="text">
+         <string>Port</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QSpinBox" name="sbPort">
+        <property name="buttonSymbols">
+         <enum>QAbstractSpinBox::NoButtons</enum>
+        </property>
+        <property name="suffix">
+         <string/>
+        </property>
+        <property name="maximum">
+         <number>60000</number>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="lDatabase">
+        <property name="text">
+         <string>Database</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QLineEdit" name="leDatabaseName"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="title">
+      <string>Authentication</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_2">
+      <item row="0" column="0">
+       <widget class="QLabel" name="lUserName">
+        <property name="text">
+         <string>User</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="leUserName"/>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="lPassword">
+        <property name="text">
+         <string>Password</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="lePassword">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QFrame" name="frame">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Raised</enum>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QToolButton" name="tbAdd">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QToolButton" name="tbDelete">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>69</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pbTestConnection">
+        <property name="text">
+         <string>Test</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic