16
16
You should have received a copy of the GNU Library General Public License
17
17
along with this program; see the file COPYING. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
18
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
22
#include "kexirelationwidget.h"
286
287
void KexiRelationWidget::openSelectedTable()
288
if (!m_relationView->focusedTableView() || !m_relationView->focusedTableView()->table())
289
/*! @todo what about query? */
290
if (!m_relationView->focusedTableView() || !m_relationView->focusedTableView()->schema()->table())
290
m_win->openObject("kexi/table", m_relationView->focusedTableView()->table()->name(), Kexi::DataViewMode);
292
bool openingCancelled;
293
m_win->openObject("kexi/table", m_relationView->focusedTableView()->schema()->name(),
294
Kexi::DataViewMode, openingCancelled);
293
297
void KexiRelationWidget::designSelectedTable()
295
if (!m_relationView->focusedTableView() || !m_relationView->focusedTableView()->table())
299
/*! @todo what about query? */
300
if (!m_relationView->focusedTableView() || !m_relationView->focusedTableView()->schema()->table())
297
m_win->openObject("kexi/table", m_relationView->focusedTableView()->table()->name(), Kexi::DesignViewMode);
302
bool openingCancelled;
303
m_win->openObject("kexi/table", m_relationView->focusedTableView()->schema()->name(),
304
Kexi::DesignViewMode, openingCancelled);
300
307
QSize KexiRelationWidget::sizeHint() const
321
328
void KexiRelationWidget::aboutToShowPopupMenu()
323
if (m_relationView->focusedTableView() && m_relationView->focusedTableView()->table()) {
330
/*! @todo what about query? */
331
if (m_relationView->focusedTableView() && m_relationView->focusedTableView()->schema()->table()) {
324
332
m_tableQueryPopup->changeTitle(m_tableQueryPopupTitleID, SmallIcon("table"),
325
m_relationView->focusedTableView()->table()->name() + " : " + i18n("Table"));
333
QString(m_relationView->focusedTableView()->schema()->name()) + " : " + i18n("Table"));
327
335
else if (m_relationView->selectedConnection()) {
328
336
m_connectionPopup->changeTitle( m_connectionPopupTitleID,
336
344
if (!sender()->isA("KexiRelationViewTable"))
338
emit tableFieldDoubleClicked( static_cast<const KexiRelationViewTable*>(sender())->table(), i->text(1) );
346
emit tableFieldDoubleClicked(
347
static_cast<const KexiRelationViewTable*>(sender())->schema()->table(), i->text(0) );
358
KexiRelationWidget::tableCreated(const QString& tableName)
360
m_tableCombo->insertItem(tableName);
361
m_tableCombo->listBox()->sort();
373
KexiRelationWidget::objectCreated(const QCString &mime, const QCString& name)
375
if (mime=="kexi/table" || mime=="kexi/query") {
377
m_tableCombo->insertItem(QString(name));
378
m_tableCombo->listBox()->sort();
383
KexiRelationWidget::objectDeleted(const QCString &mime, const QCString& name)
385
if (mime=="kexi/table" || mime=="kexi/query") {
386
QString strName(name);
387
for (int i=0; i<m_tableCombo->count(); i++) {
389
if (m_tableCombo->text(i)==strName) {
390
m_tableCombo->removeItem(i);
391
if (m_tableCombo->currentItem()==i) {
392
if (i==(m_tableCombo->count()-1))
393
m_tableCombo->setCurrentItem(i-1);
395
m_tableCombo->setCurrentItem(i);
404
KexiRelationWidget::objectRenamed(const QCString &mime, const QCString& name, const QCString& newName)
406
if (mime=="kexi/table" || mime=="kexi/query") {
407
QString strName(name);
408
for (int i=0; i<m_tableCombo->count(); i++) {
410
if (m_tableCombo->text(i)==strName) {
411
m_tableCombo->changeItem(QString(newName), i);
412
m_tableCombo->listBox()->sort();
420
KexiRelationWidget::hideAllTablesExcept( KexiDB::TableSchema::List* tables )
422
m_relationView->hideAllTablesExcept(tables);
364
425
#include "kexirelationwidget.moc"