Esempio n. 1
0
    ExplorerDatabaseItem *ExplorerTreeModel::findDatabaseItem(ExplorerServerItem* server, DataBaseInfoSPtr db) const
    {
        if(server){
            for(int i = 0; i < server->childrenCount() ; ++i){
                ExplorerDatabaseItem *item = dynamic_cast<ExplorerDatabaseItem*>(server->child(i));
                DCHECK(item);
                if(!item){
                    continue;
                }

                IDatabaseSPtr inf = item->db();
                if(inf && inf->name() == db->name()){
                    return item;
                }
            }
        }
        return NULL;
    }
    void ExplorerTreeView::viewKeys()
    {
        QModelIndex sel = selectedIndex();
        if(!sel.isValid()){
            return;
        }

        ExplorerDatabaseItem* node = common::utils_qt::item<ExplorerDatabaseItem*>(sel);
        if(node){
            ViewKeysDialog diag(QString("View key in %1 database").arg(node->name()), node->db(), this);
            diag.exec();
        }
    }