예제 #1
1
void TreeButton::setReadyToConnect()
{
    this->setEnabled(true);
    this->setText(QObject::tr("Connect"));
    this->getParentItem()->setText(4, QLatin1String ("0"));
    this->state = 0;
    this->getParentItem()->setText(2, QObject::tr("Ready to connect."));
    this->getParentItem()->setToolTip(2,  QLatin1String(""));
    this->getParentItemCast()->getOpenVPN()->setIsError(false);
    this->getParentItemCast()->getOpenVPN()->setErrorString(QLatin1String(""));
    QColor bg ("#FFFFFF"); // weiss
    this->getParentItem()->setBackgroundColor(1, bg);
    this->getParentItem()->setBackgroundColor(2, bg);
    this->getParentItem()->setBackgroundColor(3, bg);
    OpenVpn *obj = this->getParentItemCast()->getOpenVPN();
    this->getParentItem()->setText(1, obj->getConfigName() + obj->getAdvName());

    this->timer.stop();
}
예제 #2
1
void Configs::clearConfigs()
{    
    this->refreshConnectionPath.clear();

    // OD: Mutable List statt foreach
    QMutableListIterator<QPair<int, OpenVpn*> > i(this->myList);

    while (i.hasNext()) {
        QPair <int, OpenVpn*> entry = i.next();
        OpenVpn *obj = entry.second;

        if (!obj->isConnectionStable() && !obj->isConnecting() && !obj->isError() && obj->getAdvName().isEmpty() && !obj->isDelayed()) {
            // Objekt löschen
            delete obj;
            obj = 0;
            // Nun aus der Liste entfernen
            i.remove();
        } else {
            // Pfad merken
            this->refreshConnectionPath = obj->getConfigFullPath();
        }        
    }
}