Example #1
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();
        }        
    }
}
Example #2
1
bool Configs::isConfigInList(const QString &path)
{
    //
    // Ist die Konfiguration bereits in der Liste
    //

    if (path.isEmpty()) {
        return false;
    }

    QListIterator<QPair<int, OpenVpn*> > i(this->myList);

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

        // Den Pfad kontrollieren
        if (path == obj->getConfigFullPath()) {
            return true;
        }
    }

    return false;
}