kexi
kexirelationmaindlg.cpp
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "kexirelationmaindlg.h" 00021 00022 #include <klocale.h> 00023 #include <kdebug.h> 00024 #include <kiconloader.h> 00025 00026 #include <qlayout.h> 00027 00028 #include <kexidb/connection.h> 00029 00030 #include "keximainwindow.h" 00031 #include "kexiproject.h" 00032 #include "kexirelationwidget.h" 00033 #include "kexirelationview.h" 00034 00035 KexiRelationMainDlg::KexiRelationMainDlg(KexiMainWindow *mainWin, QWidget *parent, const char *name) 00036 : KexiViewBase(mainWin, parent, name) 00037 { 00038 kdDebug() << "KexiRelationMainDlg()" << endl; 00039 // setIcon(SmallIcon("relation")); 00040 m_defaultIconName = "relation"; 00041 setCaption( i18n("Relationships") ); 00042 // setDocID( win->generatePrivateDocID() ); 00043 00044 m_rel = new KexiRelationWidget(mainWin, this); 00045 //the view can receive some our actions 00046 addActionProxyChild( m_rel ); 00047 // addActionProxyChild( m_view->relationView() ); 00048 00049 QVBoxLayout *g = new QVBoxLayout(this); 00050 g->addWidget(m_rel); 00051 00052 //show all tables 00053 KexiDB::Connection *conn = mainWin->project()->dbConnection(); 00054 QStringList tables = conn->tableNames(); 00055 for (QStringList::ConstIterator it = tables.constBegin(); it!=tables.constEnd(); ++it) { 00056 m_rel->addTable( *it ); 00057 } 00058 } 00059 00060 KexiRelationMainDlg::~KexiRelationMainDlg() 00061 { 00062 } 00063 00064 QSize KexiRelationMainDlg::sizeHint() const 00065 { 00066 return QSize(600,300); 00067 } 00068 00069 QWidget* 00070 KexiRelationMainDlg::mainWidget() 00071 { 00072 return m_rel; 00073 } 00074 00075 QString KexiRelationMainDlg::itemIcon() 00076 { 00077 return "relation"; 00078 } 00079 00080 #include "kexirelationmaindlg.moc" 00081