diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/tests/startup | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/tests/startup')
-rw-r--r-- | kexi/tests/startup/Makefile.am | 19 | ||||
-rw-r--r-- | kexi/tests/startup/main.cpp | 119 | ||||
-rw-r--r-- | kexi/tests/startup/testdb.kexis | 63 |
3 files changed, 201 insertions, 0 deletions
diff --git a/kexi/tests/startup/Makefile.am b/kexi/tests/startup/Makefile.am new file mode 100644 index 00000000..ab6cc9c5 --- /dev/null +++ b/kexi/tests/startup/Makefile.am @@ -0,0 +1,19 @@ +include $(top_srcdir)/kexi/Makefile.global + +bin_PROGRAMS = kexistartuptest + +noinst_PROGRAMS = kexistartuptest + +INCLUDES = -I$(top_srcdir)/kexi $(all_includes) + +SUBDIRS = . + +METASOURCES = AUTO + +kexistartuptest_SOURCES = main.cpp +kexistartuptest_LDADD = $(LIB_QT) $(LIB_KDECORE) $(top_builddir)/kexi/kexidb/libkexidb.la \ + $(top_builddir)/kexi/core/libkexicore.la \ + $(all_libraries) + +kexistartuptest_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(VER_INFO) --no-undefined + diff --git a/kexi/tests/startup/main.cpp b/kexi/tests/startup/main.cpp new file mode 100644 index 00000000..dd2e86ce --- /dev/null +++ b/kexi/tests/startup/main.cpp @@ -0,0 +1,119 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Jaroslaw Staniek <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include <kdebug.h> +#include <kapplication.h> + +//#include <tableview/kexitableview.h> +/*#include <kexidb/drivermanager.h> +#include <kexidb/driver.h> +#include <kexidb/connection.h> +#include <kexidb/cursor.h>*/ + +#include "main/startup/KexiStartupDialog.h" +#include "main/startup/KexiConnSelector.h" +#include "core/kexiprojectset.h" +#include "core/kexiprojectdata.h" + +int main(int argc, char* argv[]) +{ + KApplication app(argc, argv, "startup"); + +// Widget w; +// app.setMainWidget(&w); + +/* KexiTableView tv; + app.setMainWidget(&tv); + + KexiTableViewData data; + KexiTableViewColumn col; + col.type = QVariant::Int; col.caption = "Id"; data.addColumn( col ); + col.type = QVariant::String; col.caption = "Name"; data.addColumn( col ); + col.type = QVariant::Int; col.caption = "Age"; data.addColumn( col ); + tv.setData(&data, false); + tv.show();*/ + + //some connection data + KexiDBConnectionSet connset; + KexiDB::ConnectionData *conndata; + conndata = new KexiDB::ConnectionData(); + conndata->name = "My connection 1"; + conndata->driverName = "mysql"; + conndata->hostName = "host.net"; + conndata->userName = "user"; + connset.addConnectionData(conndata); + conndata = new KexiDB::ConnectionData(); + conndata->name = "My connection 2"; + conndata->driverName = "mysql"; + conndata->hostName = "myhost.org"; + conndata->userName = "otheruser"; + conndata->port = 53121; + connset.addConnectionData(conndata); + + //some recent projects data + KexiProjectData *prjdata; + prjdata = new KexiProjectData( *conndata, "bigdb", "Big DB" ); + prjdata->setCaption("My Big Project"); + prjdata->setDescription("This is my first biger project started yesterday. Have fun!"); + KexiProjectSet prj_set; + prj_set.addProjectData(prjdata); + + KexiStartupDialog startup(KexiStartupDialog::Everything, 0, connset, prj_set, 0, "dlg"); + int e=startup.exec(); + kdDebug() << (e==QDialog::Accepted ? "Accepted" : "Rejected") << endl; + + if (e==QDialog::Accepted) { + int r = startup.result(); + if (r==KexiStartupDialog::TemplateResult) { + kdDebug() << "Template key == " << startup.selectedTemplateKey() << endl; + if (startup.selectedTemplateKey()=="blank") { +#if 0 + KexiConnSelectorDialog sel(connset, 0,"sel"); + e = sel.exec(); + kdDebug() << (e==QDialog::Accepted ? "Accepted" : "Rejected") << endl; + if (e==QDialog::Accepted) { + kdDebug() << "Selected conn. type: " << (sel.selectedConnectionType()==KexiConnSelectorWidget::FileBased ? "File based" : "Server based") << endl; + if (sel.selectedConnectionType()==KexiConnSelectorWidget::ServerBased) { + kdDebug() << "SERVER: " << sel.selectedConnectionData()->serverInfoString() << endl; + } + } +#endif + } + } + else if (r==KexiStartupDialog::OpenExistingResult) { + kdDebug() << "Existing project --------" << endl; + QString selFile = startup.selectedExistingFile(); + if (!selFile.isEmpty()) + kdDebug() << "Project File: " << selFile << endl; + else if (startup.selectedExistingConnection()) { + kdDebug() << "Existing connection: " << startup.selectedExistingConnection()->serverInfoString() << endl; + //ok, now we are trying to show daabases for this conenction to this user + //todo + } + } + else if (r==KexiStartupDialog::OpenRecentResult) { + kdDebug() << "Recent project --------" << endl; + const KexiProjectData *data = startup.selectedProjectData(); + if (data) { + kdDebug() << "Selected project: database=" << data->databaseName() + << " connection=" << data->constConnectionData()->serverInfoString() << endl; + } + } + } +} diff --git a/kexi/tests/startup/testdb.kexis b/kexi/tests/startup/testdb.kexis new file mode 100644 index 00000000..06a558aa --- /dev/null +++ b/kexi/tests/startup/testdb.kexis @@ -0,0 +1,63 @@ +# +# This file contains information for accessing Kexi project(s) +# stored on a database server +# +# Description: The file can contain one special "File Information" +# section and one or more sections for defining database connections. +# + +[File Information] +# Version information for this file format, "1" is by default. +# You can forget about adding this. +version=1 + +# begin of section for a shortcut to a single database +[Test Database] + +# The type of this section. Can be: +# - database: a single database project together with +# it's connection parameters +# - connection: connection arameters only, without database name +# user will be able to see a list of databases provided +# for the connection and open one of them. (not yet implemented) +type=database + +# Database driver (engine) name like: mysql, postgresql. +engine=mysql + +# Additional human-readable caption for informational purposes. +caption=Test Project + +# Database name, or connection name, depending on type of this section. +name=testdb + +# Server name, for local connection. Can be empty or equal to "localhost". +server=localhost + +# TCP/IP port, leave it empty if default port for a given +# engine should be used. +port=3333 + +# Username, leave empty if you want to reuse your login name. +user=testuser + +# User password (DANGEROUS: currently plain text!). +# Leave it empty, and you will be asked for password everytime +# you're opening your database. +# KDE Wallet will be supported in the future. +password=testy + +# Additional (probably multiline) human-readable caption +# for informational purposes. Line endings should be netered as \n. +comment=My favourite test project + +# Set this to 1, if you want to use socket file (named pipe) +# instead of TCP/IP for your local connection here. +# Ignored for remote connections. +useLocalSocketFile=0 + +# Enter local socket file name (named pipe) for your local connection here. +# Leave it empty if you want to use default socket file. +# Ignored for remote connections. +localSocketFile= + |