IServerSPtr ExplorerKeyItem::server() const { ExplorerDatabaseItem* db = dynamic_cast<ExplorerDatabaseItem*>(parent_); if(!db){ return IServerSPtr(); } return db->server(); }
void ExplorerTreeView::loadContentDb() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerDatabaseItem *node = common::utils_qt::item<ExplorerDatabaseItem*>(sel); if(node){ LoadContentDbDialog loadDb(QString("Load %1 content").arg(node->name()), node->server()->type(), this); int result = loadDb.exec(); if(result == QDialog::Accepted){ node->loadContent(common::convertToString(loadDb.pattern()), loadDb.count()); } } }
void ExplorerTreeView::createKey() { QModelIndex sel = selectedIndex(); if(!sel.isValid()){ return; } ExplorerDatabaseItem *node = common::utils_qt::item<ExplorerDatabaseItem*>(sel); if(node){ CreateDbKeyDialog loadDb(QString("Create key for %1 database").arg(node->name()), node->server()->type(), this); int result = loadDb.exec(); if(result == QDialog::Accepted){ FastoObjectIPtr val = loadDb.value(); NKey key = loadDb.key(); node->createKey(key, val); } } }