当前位置: 首页>>代码示例>>C++>>正文


C++ ConnectionSettings类代码示例

本文整理汇总了C++中ConnectionSettings的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionSettings类的具体用法?C++ ConnectionSettings怎么用?C++ ConnectionSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConnectionSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clonedConnection

    /**
     * @brief Initiate 'edit' action, usually when user clicked on Edit button
     */
    void ConnectionsDialog::edit()
    {
        ConnectionListWidgetItem *currentItem =
            (ConnectionListWidgetItem *) _listWidget->currentItem();

        // Do nothing if no item selected
        if (currentItem == 0)
            return;

        ConnectionSettings *connection = currentItem->connection();
        boost::scoped_ptr<ConnectionSettings> clonedConnection(connection->clone());
        ConnectionDialog editDialog(clonedConnection.get());

        // Do nothing if not accepted
        if (editDialog.exec() != QDialog::Accepted) {
            // on linux focus is lost - we need to activate connections dialog
            activateWindow();
            return;
        }

        connection->apply(editDialog.connection());
        _settingsManager->updateConnection(connection);

        // on linux focus is lost - we need to activate connections dialog
        activateWindow();
    }
开发者ID:melinite,项目名称:robomongo,代码行数:29,代码来源:ConnectionsDialog.cpp

示例2: updateConnectionsMenu

    void MainWindow::updateConnectionsMenu()
    {
        _connectionsMenu->clear();
        int number = 1;
        // Populate list with connections
        SettingsManager::ConnectionSettingsContainerType connections = AppRegistry::instance().settingsManager()->connections();
        for(SettingsManager::ConnectionSettingsContainerType::const_iterator it = connections.begin(); it!= connections.end(); ++it) {
            ConnectionSettings *connection = *it;
            QAction *action = new QAction(QtUtils::toQString(connection->getReadableName()), this);
            action->setData(QVariant::fromValue(connection));

            if (number <= 9 && !AppRegistry::instance().settingsManager()->disableConnectionShortcuts()) {
                action->setShortcut(QKeySequence(QString("Alt+").append(QString::number(number))));
            }

            _connectionsMenu->addAction(action);
            ++number;
        }

        if (AppRegistry::instance().settingsManager()->connections().size() > 0)
            _connectionsMenu->addSeparator();

        // Connect action
        QAction *connectAction = new QAction("&Manage Connections...", this);
        connectAction->setIcon(GuiRegistry::instance().connectIcon());
        connectAction->setToolTip("Connect to MongoDB");
        VERIFY(connect(connectAction, SIGNAL(triggered()), this, SLOT(manageConnections())));

        _connectionsMenu->addAction(connectAction);
    }
开发者ID:Dinesh-Ramakrishnan,项目名称:robomongo,代码行数:30,代码来源:MainWindow.cpp

示例3: clonedConnection

    /**
     * @brief Initiate 'edit' action, usually when user clicked on Edit button
     */
    void ConnectionsDialog::edit()
    {
        ConnectionListWidgetItem *currentItem =
            (ConnectionListWidgetItem *) _listWidget->currentItem();

        // Do nothing if no item selected
        if (currentItem == 0)
            return;

        ConnectionSettings *connection = currentItem->connection();
        boost::scoped_ptr<ConnectionSettings> clonedConnection(connection->clone());
        ConnectionDialog editDialog(clonedConnection.get());

        // Do nothing if not accepted
        if (editDialog.exec() != QDialog::Accepted) {
            // on linux focus is lost - we need to activate connections dialog
            activateWindow();
            return;
        }

        connection->apply(editDialog.connection());       

        // on linux focus is lost - we need to activate connections dialog
        activateWindow();

        int size = _connectionItems.size();
        for (int i=0; i<size; ++i)
        {
            ConnectionListWidgetItem *item = _connectionItems[i];
            if (_connectionItems[i]->connection() == connection) {
                item->setConnection(connection);
                break;
            }
        }        
    }
开发者ID:2812140729,项目名称:robomongo,代码行数:38,代码来源:ConnectionsDialog.cpp

示例4: openShell

 MongoShell *App::openShell(MongoCollection *collection,const QString &filePathToSave)
 {
     ConnectionSettings *connection = collection->database()->server()->connectionRecord();
     connection->setDefaultDatabase(collection->database()->name());
     QString script = detail::buildCollectionQuery(collection->name(), "find({})");
     return openShell(connection, ScriptInfo(script, true, CursorPosition(0, -2), QtUtils::toQString(collection->database()->name()),filePathToSave));
 }
开发者ID:MinHuZ,项目名称:robomongo,代码行数:7,代码来源:App.cpp

示例5: dictionary

void PppDownScriptWriter::fill()
{
   dictionary()->SetValue(OBJECTNAME, QCoreApplication::instance()->objectName().toAscii().constData());
   dictionary()->SetValue(GETIPSECINFOLIB, ConfWriter::fileName(ConfWriter::GETIPSECINFO).toAscii().constData());

   const ConnectionSettings settings;
   const int iConnections = settings.connections();

   for (int i = 0; i < iConnections; i++)
   {
      const QString strName(settings.connection(i));

      if (!strName.isEmpty())
      {
         const PppIpSettings ipSetting(settings.pppSettings(strName).ipSettings());
         ctemplate::TemplateDictionary* const pConnection = dictionary()->AddSectionDictionary(CONN_SECTION);

         pConnection->SetValue(IPPARAM, (QCoreApplication::instance()->objectName() + "-" + strName).toAscii().constData());
         pConnection->SetValue(GATEWAY, settings.ipsecSettings(strName).gateway().toAscii().constData());

         if (ipSetting.useDefaultGateway())
            pConnection->AddSectionDictionary(DEFAULT_GATEWAY_SECTION);
      }
      else
         addErrorMsg(QObject::tr("No such connection: '%1'.").arg(strName));
   }
}
开发者ID:MichaelIT,项目名称:l2tp-ipsec-vpn,代码行数:27,代码来源:PppDownScriptWriter.cpp

示例6: selectedCollectionItem

void ExplorerTreeWidget::ui_renameCollection()
{
    ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
    if (!collectionItem)
        return;

    MongoCollection *collection = collectionItem->collection();
    MongoDatabase *database = collection->database();
    MongoServer *server = database->server();
    ConnectionSettings *settings = server->connectionRecord();

    CreateDatabaseDialog dlg(settings->getFullAddress(),
                             database->name(),
                             collection->name());
    dlg.setWindowTitle("Rename Collection");
    dlg.setOkButtonText("&Rename");
    dlg.setInputLabelText("New Collection Name:");
    dlg.setInputText(collection->name());
    int result = dlg.exec();

    if (result == QDialog::Accepted) {
        database->renameCollection(collection->name(), dlg.databaseName());

        // refresh list of collections
        database->loadCollections();
    }
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:27,代码来源:ExplorerTreeWidget.cpp

示例7: clone

    void ConnectionsDialog::clone()
    {
        ConnectionListWidgetItem *currentItem =
            (ConnectionListWidgetItem *) _listWidget->currentItem();

        // Do nothing if no item selected
        if (currentItem == 0)
            return;

        // Clone connection
        ConnectionSettings *connection = currentItem->connection()->clone();
        std::string newConnectionName="Copy of "+connection->connectionName();

        connection->setConnectionName(newConnectionName);

        ConnectionDialog editDialog(connection);

        // Cleanup newly created connection and return, if not accepted.
        if (editDialog.exec() != QDialog::Accepted) {
            delete connection;
            return;
        }

        // Now connection will be owned by SettingsManager
        _settingsManager->addConnection(connection);
        add(connection);
    }
开发者ID:2812140729,项目名称:robomongo,代码行数:27,代码来源:ConnectionsDialog.cpp

示例8: setupGenericUi

void PasswordDialog::setupGenericUi(const ConnectionSettings &connectionSettings)
{
    Setting::Ptr setting = connectionSettings.setting(m_settingName);

    ui = new Ui::PasswordDialog;
    ui->setupUi(this);
    // TODO fix this for high DPI
    ui->labelIcon->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-password")).pixmap(KIconLoader::SizeMedium));

    m_neededSecrets = setting->needSecrets(m_flags & SecretAgent::RequestNew);
    if (m_neededSecrets.isEmpty()) {
        qCWarning(PLASMA_NM) << "list of secrets is empty!!!";
        m_hasError = true;
        m_error = SecretAgent::InternalError;
        m_errorMessage = QLatin1String("No secrets were requested");
        return;
    }

    WirelessSetting::Ptr wifi = connectionSettings.setting(Setting::Wireless).dynamicCast<WirelessSetting>();

    Setting::SettingType connectionType = setting->type();
    if (wifi && (connectionType == Setting::WirelessSecurity || connectionType == Setting::Security8021x)) {
        const QString ssid = QString::fromUtf8(wifi->ssid());
        ui->labelText->setText(i18n("For accessing the wireless network '%1' you need to provide a password below", ssid));
    } else {
        ui->labelText->setText(i18n("Please provide the password for activating connection '%1'", connectionSettings.id()));
    }

    ui->password->setFocus();
    connect(ui->showPassword, &QCheckBox::toggled, this, &PasswordDialog::showPassword);
    connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &PasswordDialog::accept);
    connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &PasswordDialog::reject);
}
开发者ID:KDE,项目名称:plasma-nm,代码行数:33,代码来源:passworddialog.cpp

示例9: if

/**
 *
 * Gets a setting identified by key. If it doesn't exist, we'll recursively try
 * each parent until we hit the top level. If this happens we'll return null.
 *
 * @param key The (std::string) key to lookup
 * @param bubble true to bubble up to parents if we don't have the given setting
 * @return The result, or nullptr if there was none
 */
Variant ConnectionSettings::get(std::string key, bool bubble)
{
    ConnectionSettings *parent;

    // We've got this key, send it back!
    if (contains(key)) {
        return settings[key];
    }

    // uuid and name are handled specially. UUID needs to be generated if it
    // is missing and name mustn't bubble.
    if (key == "uuid") {

        // Generate UUID
        settings["uuid"] = UUID::makeUUID();

        return settings["uuid"];
    } else if (key == "name" or key == "parent") {

        // Name and parent should not climb the tree
        bubble = false;
    }

    // If bubble is true, we need to look for the first parent that has this
    // setting set.
    if (bubble && (parent = (ConnectionSettings*) this->getParent()) != nullptr) {
        return parent->get(key, true);
    }

    // Couldn't find it :(
    return Variant();
}
开发者ID:RabidSQL,项目名称:backend,代码行数:41,代码来源:ConnectionSettings.cpp

示例10: ui_copyToCollectionToDiffrentServer

    void ExplorerCollectionTreeItem::ui_copyToCollectionToDiffrentServer()
    {
        MongoDatabase *databaseFrom = _collection->database();
        MongoServer *server = databaseFrom->server();
        ConnectionSettings *settings = server->connectionRecord();

        CopyCollection dlg(QtUtils::toQString(settings->getFullAddress()), QtUtils::toQString(databaseFrom->name()), QtUtils::toQString(_collection->name()) );
        int result = dlg.exec();

        if (result == QDialog::Accepted) {
            MongoDatabase *databaseTo = dlg.selectedDatabase();
            databaseTo->copyCollection(server, databaseFrom->name(), _collection->name());
            databaseTo->loadCollections();
        }
    }
开发者ID:2812140729,项目名称:robomongo,代码行数:15,代码来源:ExplorerCollectionTreeItem.cpp

示例11: ui_addDocument

    void ExplorerCollectionTreeItem::ui_addDocument()
    {
        MongoDatabase *database = _collection->database();
        MongoServer *server = database->server();
        ConnectionSettings *settings = server->connectionRecord();

        DocumentTextEditor editor(CollectionInfo(settings->getFullAddress(), database->name(), _collection->name()), "{\n    \n}");

        editor.setCursorPosition(1, 4);
        editor.setWindowTitle("Insert Document");
        int result = editor.exec();

        treeWidget()->activateWindow();

        if (result == QDialog::Accepted) {
            server->insertDocuments(editor.bsonObj(), MongoNamespace(database->name(), _collection->name()) );
        }
    }
开发者ID:2812140729,项目名称:robomongo,代码行数:18,代码来源:ExplorerCollectionTreeItem.cpp

示例12: connectTo

void ConnectionManager::connectTo(Konversation::ConnectionFlag flag, int serverGroupId)
{
    ConnectionSettings settings;

    Konversation::ServerGroupSettingsPtr serverGroup;

    serverGroup = Preferences::serverGroupById(serverGroupId);

    if (serverGroup)
    {
        settings.setServerGroup(serverGroup);

        if (serverGroup->serverList().size() > 0)
            settings.setServer(serverGroup->serverList()[0]);
    }

    connectTo(flag, settings);
}
开发者ID:wordlet,项目名称:mykonvi,代码行数:18,代码来源:connectionmanager.cpp

示例13: continueOpenServer

    MongoServer* App::continueOpenServer(ConnectionSettings *connection, bool visible, int localport) {
        ConnectionSettings* settings = connection->clone();

        // Modify connection settings when SSH tunnel is used
        if (visible && settings->sshSettings()->enabled()) {
            settings->setServerHost("127.0.0.1");
            settings->setServerPort(localport);
        }

        MongoServer *server = new MongoServer(settings, visible);
        _servers.push_back(server);

        server->runWorkerThread();

        LOG_MSG(QString("Connecting to %1...").arg(QtUtils::toQString(server->connectionRecord()->getFullAddress())), mongo::logger::LogSeverity::Info());
        server->tryConnect();
        return server;
    }
开发者ID:MinHuZ,项目名称:robomongo,代码行数:18,代码来源:App.cpp

示例14: saveSettings

void ConnectDbDialogWidget::saveSettings()
{
    ConnectionSettings settings;
    settings.setEventName(ui->edEventName->text());
    settings.setConnectionType(static_cast<Event::EventPlugin::ConnectionType>(ui->tabWidget->currentIndex()));
    settings.setServerHost(ui->edServerHost->text());
    settings.setServerPort(ui->edServerPort->value());
    settings.setServerUser(ui->edServerUser->text());
    settings.setServerPassword(ui->edServerPassword->text());
    settings.setSingleWorkingDir(ui->edSingleWorkingDir->text());
}
开发者ID:viktorm2015,项目名称:quickbox,代码行数:11,代码来源:connectdbdialogwidget.cpp

示例15: loadSettings

void ConnectDbDialogWidget::loadSettings()
{
    ConnectionSettings settings;
    ui->edEventName->setText(settings.eventName());
    ui->tabWidget->setCurrentIndex(static_cast<int>(settings.connectionType()));
    ui->edServerHost->setText(settings.serverHost());
    int port = settings.serverPort();
    if(port > 0)
        ui->edServerPort->setValue(port);
    ui->edServerUser->setText(settings.serverUser());
    ui->edServerPassword->setText(settings.serverPassword());
    ui->edSingleWorkingDir->setText(settings.singleWorkingDir());
}
开发者ID:viktorm2015,项目名称:quickbox,代码行数:13,代码来源:connectdbdialogwidget.cpp


注:本文中的ConnectionSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。