Changeset 2974

Show
Ignore:
Timestamp:
08/16/08 12:57:32 (3 months ago)
Author:
borkdomenik
Message:

more bugfixes and improvements, e.g. replacing of the checkboxes for stealth|basic by some radio buttons.

Location:
vidalia/branches/hidden-services/src/vidalia/config
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • vidalia/branches/hidden-services/src/vidalia/config/servicepage.cpp

    r2972 r2974  
    4646  /** A QRegExpValidator to validate the identification of client auth(Id) 
    4747   * and service auth(Id)*/ 
    48   QRegExp rx("[a-zA-Z0-9\\+\\-\\_]{0,18}([a-zA-Z0-9\\+\\-\\_])"); 
     48  QRegExp rx("[a-zA-Z0-9\\+\\-\\_]{0,15}([a-zA-Z0-9\\+\\-\\_])"); 
    4949  _identificationValidator = new QRegExpValidator(rx, this); 
    5050  /** A QRegExpValidator to validate a onion address (base32, 
     
    5353  _onionAdressValidator = new QRegExpValidator(base32, this); 
    5454  /** A QRegExpValidator to validate a cookie(base64, 22 chars)*/ 
    55   QRegExp base64("[a-zA-Z0-9\\+\\-\\/]{21}([a-zA-Z0-9\\+\\-\\/])"); 
     55  QRegExp base64("[a-zA-Z0-9\\+\\-\\/]{20}([a-zA-Z0-9\\+\\-\\/])"); 
    5656  _cookieValidator = new QRegExpValidator(base64, this); 
    5757 
     
    111111  connect(ui.serviceAccessWidget, SIGNAL(itemClicked(QTableWidgetItem*)), this, 
    112112   SLOT(serviceAccessSelectionChanged())); 
    113   connect(ui.checkBox_basic, SIGNAL(toggled(bool)), this, 
    114    SLOT(checkBoxBasicToggled())); 
    115   connect(ui.checkBox_stealth, SIGNAL(toggled(bool)), this, 
    116    SLOT(checkBoxStealthToggled())); 
     113  connect(ui.basic_radioButton, SIGNAL(toggled(bool)), this, 
     114   SLOT(checkBoxBasicToggled(bool))); 
    117115} 
    118116 
     
    399397/** this method returns a Service by parseing the configuration string 
    400398 *  of Tor and storing its values into the object */ 
    401  //XTODO hier den parser auch anpassen um basic/stealth abzufange!! 
    402399Service 
    403400ServicePage::generateService(QString s) 
     
    923920  QList<UserAuthorizationData> assoziatedUsers = selService.users(); 
    924921  if(selService.stealth()) { 
    925         ui.checkBox_stealth->setCheckState(Qt::Checked); 
    926         ui.checkBox_basic->setCheckState(Qt::Unchecked); 
    927   } else { 
    928     ui.checkBox_basic->setCheckState(Qt::Checked); 
    929     ui.checkBox_stealth->setCheckState(Qt::Unchecked); 
     922        ui.stealth_radioButton->setChecked(true); 
     923        ui.basic_radioButton->setChecked(false); 
     924  } else { 
     925    ui.stealth_radioButton->setChecked(false); 
     926    ui.basic_radioButton->setChecked(true); 
    930927  } 
    931928  if(assoziatedUsers.size() == 0) { 
    932929    ui.authClientsGroupBox->setVisible(false); 
    933930    ui.restrictAccessCheckBox->setCheckState(Qt::Unchecked); 
     931    ui.restrictAccessCheckBox->setEnabled(true); 
    934932  } else { 
    935933      ui.authClientsGroupBox->setVisible(true); 
    936934      ui.restrictAccessCheckBox->setCheckState(Qt::Checked); 
     935      ui.restrictAccessCheckBox->setEnabled(false); 
    937936      int rowcount = 0; 
    938937      QListIterator<UserAuthorizationData> it(assoziatedUsers); 
     
    11751174ServicePage::validateServiceAuth(QString authString) 
    11761175{ 
     1176  QStringList authMode; 
     1177  authMode << "A" <<"B" <<"Q" <<"R" <<"g" <<"h" <<"w" <<"x"; 
    11771178  if(authString.length() != 45 || authString.contains(" ") == false) { 
    11781179    return QValidator::Invalid; 
     
    11801181  QStringList strList = authString.split(" "); 
    11811182  int pos = 0; 
    1182   if(_onionAdressValidator->validate(strList.first(), pos) == 
     1183  QString onion = strList.first(); 
     1184  if(_onionAdressValidator->validate(onion, pos) == 
    11831185   QValidator::Acceptable) { 
    11841186    strList.removeFirst(); 
    1185     if(_cookieValidator->validate(strList.first(), pos) == 
    1186      QValidator::Acceptable) { 
     1187    QString cookieValid = strList.first().left(21); 
     1188    QString cookie = strList.first(); 
     1189    for(int i = 0; i < ui.serviceAccessWidget->rowCount(); i++) { 
     1190      QTableWidgetItem *item = ui.serviceAccessWidget->item(i,0); 
     1191      QStringList onionStrList = item->text().split(" "); 
     1192      QString on, cook; 
     1193      on = onionStrList.first(); 
     1194      onionStrList.removeFirst(); 
     1195      cook = onionStrList.first(); 
     1196      if(onion.compare(on) == 0 && cookie.compare(cook) == 0) { 
     1197        return QValidator::Invalid; 
     1198      } 
     1199    } 
     1200    if(_cookieValidator->validate(cookieValid, pos) == 
     1201     QValidator::Acceptable && authMode.contains(strList.first().right(1))) { 
    11871202      return QValidator::Acceptable; 
    11881203    } else { 
    1189       VMessageBox::warning(this, tr("Error"), tr("Your cookie is not valid,\ 
    1190        please correct it."), VMessageBox::Ok); 
    11911204      return QValidator::Invalid; 
    11921205    } 
    11931206  } else { 
    1194     VMessageBox::warning(this, tr("Error"), tr("Your onion adress is\ 
    1195      not valid, please correct it."), VMessageBox::Ok); 
    11961207    return QValidator::Invalid; 
    11971208  } 
     
    12151226    id++; 
    12161227  } 
     1228  serviceAccessSelectionChanged(); 
    12171229} 
    12181230 
     
    13911403    bool b = address.contains(".onion"); 
    13921404    ui.copyClientAuthBtn->setEnabled(b); 
     1405    ui.removeClientAuthBtn->setEnabled(true); 
     1406  } 
     1407  if(ui.serviceAuthWidget->rowCount() < 1) { 
     1408    ui.copyClientAuthBtn->setEnabled(false); 
     1409    ui.removeClientAuthBtn->setEnabled(false); 
     1410    ui.restrictAccessCheckBox->setEnabled(true); 
     1411  } else { 
     1412    ui.restrictAccessCheckBox->setEnabled(false); 
    13931413  } 
    13941414} 
     
    14111431/** Called whenever the user clicks on the basic authorization checkbox*/ 
    14121432void 
    1413 ServicePage::checkBoxBasicToggled() 
    1414 { 
    1415   bool state = ui.checkBox_basic->checkState() == Qt::Checked; 
    1416   if(state) { 
    1417     ui.checkBox_stealth->setCheckState(Qt::Unchecked); 
    1418   } else { 
    1419     ui.checkBox_stealth->setCheckState(Qt::Checked); 
    1420   } 
     1433ServicePage::checkBoxBasicToggled(bool checked) 
     1434{ 
    14211435  Service s = _services->take(ui.serviceWidget->currentRow()); 
    1422   s.setStealth(!state); 
     1436  s.setStealth(!checked); 
    14231437  _services->insert(ui.serviceWidget->currentRow(), s); 
    14241438} 
    14251439 
    1426 /** Called whenever the user clicks on the stealth authorization checkbox*/ 
    1427 void 
    1428 ServicePage::checkBoxStealthToggled() 
    1429 { 
    1430   bool state = ui.checkBox_stealth->checkState() == Qt::Checked; 
    1431   if(state) { 
    1432     ui.checkBox_basic->setCheckState(Qt::Unchecked); 
    1433   } else { 
    1434     ui.checkBox_basic->setCheckState(Qt::Checked); 
    1435   } 
    1436   Service s = _services->take(ui.serviceWidget->currentRow()); 
    1437   s.setStealth(state); 
    1438   _services->insert(ui.serviceWidget->currentRow(), s); 
    1439 } 
    1440  
  • vidalia/branches/hidden-services/src/vidalia/config/servicepage.h

    r2960 r2974  
    111111  void serviceAuthSelectionChanged(); 
    112112  /** Called whenever the user clicks on the basic authorization checkbox*/ 
    113   void checkBoxBasicToggled(); 
    114   /** Called whenever the user clicks on the stealth authorization checkbox*/ 
    115   void checkBoxStealthToggled(); 
     113  void checkBoxBasicToggled(bool checked); 
    116114 
    117115private: 
  • vidalia/branches/hidden-services/src/vidalia/config/servicepage.ui

    r2973 r2974  
    77    <y>0</y> 
    88    <width>653</width> 
    9     <height>496</height> 
     9    <height>492</height> 
    1010   </rect> 
    1111  </property> 
     
    296296        <string>Authorized Clients</string> 
    297297       </property> 
    298        <layout class="QGridLayout" > 
    299         <item row="0" column="0" > 
    300          <layout class="QGridLayout" > 
    301           <item row="0" column="0" > 
    302            <widget class="QCheckBox" name="checkBox_basic" > 
    303             <property name="toolTip" > 
    304              <string>the basic authorization mode is more scalable but less secure</string> 
    305             </property> 
    306             <property name="text" > 
    307              <string>basic configuration</string> 
    308             </property> 
    309            </widget> 
    310           </item> 
    311           <item row="0" column="1" > 
    312            <widget class="QCheckBox" name="checkBox_stealth" > 
    313             <property name="toolTip" > 
    314              <string>the stealth authorization mode is more secure but less scalable</string> 
    315             </property> 
    316             <property name="text" > 
    317              <string>stealth configuration</string> 
    318             </property> 
    319            </widget> 
    320           </item> 
    321           <item row="1" column="0" colspan="2" > 
    322            <layout class="QGridLayout" > 
    323             <item rowspan="4" row="0" column="0" > 
    324              <widget class="QTableWidget" name="serviceAuthWidget" > 
    325               <property name="sizePolicy" > 
    326                <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > 
    327                 <horstretch>0</horstretch> 
    328                 <verstretch>0</verstretch> 
    329                </sizepolicy> 
     298       <widget class="QWidget" name="" > 
     299        <property name="geometry" > 
     300         <rect> 
     301          <x>12</x> 
     302          <y>20</y> 
     303          <width>591</width> 
     304          <height>141</height> 
     305         </rect> 
     306        </property> 
     307        <layout class="QGridLayout" > 
     308         <item row="0" column="0" > 
     309          <widget class="QRadioButton" name="basic_radioButton" > 
     310           <property name="text" > 
     311            <string>basic configuration</string> 
     312           </property> 
     313          </widget> 
     314         </item> 
     315         <item row="0" column="1" > 
     316          <widget class="QRadioButton" name="stealth_radioButton" > 
     317           <property name="text" > 
     318            <string>stealth configuration</string> 
     319           </property> 
     320          </widget> 
     321         </item> 
     322         <item row="1" column="0" colspan="2" > 
     323          <layout class="QGridLayout" > 
     324           <item rowspan="4" row="0" column="0" > 
     325            <widget class="QTableWidget" name="serviceAuthWidget" > 
     326             <property name="sizePolicy" > 
     327              <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > 
     328               <horstretch>0</horstretch> 
     329               <verstretch>0</verstretch> 
     330              </sizepolicy> 
     331             </property> 
     332             <property name="maximumSize" > 
     333              <size> 
     334               <width>16777215</width> 
     335               <height>16777215</height> 
     336              </size> 
     337             </property> 
     338             <property name="toolTip" > 
     339              <string>A listing of all ClientAuthorizationData configured with Vidalia</string> 
     340             </property> 
     341             <property name="selectionMode" > 
     342              <enum>QAbstractItemView::SingleSelection</enum> 
     343             </property> 
     344             <property name="selectionBehavior" > 
     345              <enum>QAbstractItemView::SelectRows</enum> 
     346             </property> 
     347             <property name="textElideMode" > 
     348              <enum>Qt::ElideLeft</enum> 
     349             </property> 
     350             <column> 
     351              <property name="text" > 
     352               <string>Authorization String</string> 
    330353              </property> 
    331               <property name="maximumSize" > 
    332                <size> 
    333                 <width>16777215</width> 
    334                 <height>16777215</height> 
    335                </size> 
     354             </column> 
     355             <column> 
     356              <property name="text" > 
     357               <string>Identification</string> 
    336358              </property> 
    337               <property name="toolTip" > 
    338                <string>A listing of all ClientAuthorizationData configured with Vidalia</string> 
    339               </property> 
    340               <property name="selectionMode" > 
    341                <enum>QAbstractItemView::SingleSelection</enum> 
    342               </property> 
    343               <property name="selectionBehavior" > 
    344                <enum>QAbstractItemView::SelectRows</enum> 
    345               </property> 
    346               <property name="textElideMode" > 
    347                <enum>Qt::ElideLeft</enum> 
    348               </property> 
    349               <column> 
    350                <property name="text" > 
    351                 <string>Authorization String</string> 
    352                </property> 
    353               </column> 
    354               <column> 
    355                <property name="text" > 
    356                 <string>Identification</string> 
    357                </property> 
    358               </column> 
    359              </widget> 
    360             </item> 
    361             <item row="0" column="1" > 
    362              <widget class="QToolButton" name="addClientAuthBtn" > 
    363               <property name="toolTip" > 
    364                <string>Add a new user with authorization to the selected service</string> 
    365               </property> 
    366               <property name="text" > 
    367                <string/> 
    368               </property> 
    369               <property name="icon" > 
    370                <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset> 
    371               </property> 
    372              </widget> 
    373             </item> 
    374             <item row="1" column="1" > 
    375              <widget class="QToolButton" name="removeClientAuthBtn" > 
    376               <property name="toolTip" > 
    377                <string>Remove the selected user and his authorization data from the selected service</string> 
    378               </property> 
    379               <property name="text" > 
    380                <string/> 
    381               </property> 
    382               <property name="icon" > 
    383                <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset> 
    384               </property> 
    385              </widget> 
    386             </item> 
    387             <item row="2" column="1" > 
    388              <widget class="QToolButton" name="copyClientAuthBtn" > 
    389               <property name="toolTip" > 
    390                <string>Copy authorization data to clipboard</string> 
    391               </property> 
    392               <property name="text" > 
    393                <string/> 
    394               </property> 
    395               <property name="icon" > 
    396                <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset> 
    397               </property> 
    398              </widget> 
    399             </item> 
    400             <item row="3" column="1" > 
    401              <spacer> 
    402               <property name="orientation" > 
    403                <enum>Qt::Vertical</enum> 
    404               </property> 
    405               <property name="sizeHint" > 
    406                <size> 
    407                 <width>26</width> 
    408                 <height>66</height> 
    409                </size> 
    410               </property> 
    411              </spacer> 
    412             </item> 
    413            </layout> 
    414           </item> 
    415          </layout> 
    416         </item> 
    417        </layout> 
     359             </column> 
     360            </widget> 
     361           </item> 
     362           <item row="0" column="1" > 
     363            <widget class="QToolButton" name="addClientAuthBtn" > 
     364             <property name="toolTip" > 
     365              <string>Add a new user with authorization to the selected service</string> 
     366             </property> 
     367             <property name="text" > 
     368              <string/> 
     369             </property> 
     370             <property name="icon" > 
     371              <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-add.png</iconset> 
     372             </property> 
     373            </widget> 
     374           </item> 
     375           <item row="1" column="1" > 
     376            <widget class="QToolButton" name="removeClientAuthBtn" > 
     377             <property name="toolTip" > 
     378              <string>Remove the selected user and his authorization data from the selected service</string> 
     379             </property> 
     380             <property name="text" > 
     381              <string/> 
     382             </property> 
     383             <property name="icon" > 
     384              <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/list-remove.png</iconset> 
     385             </property> 
     386            </widget> 
     387           </item> 
     388           <item row="2" column="1" > 
     389            <widget class="QToolButton" name="copyClientAuthBtn" > 
     390             <property name="toolTip" > 
     391              <string>Copy authorization data to clipboard</string> 
     392             </property> 
     393             <property name="text" > 
     394              <string/> 
     395             </property> 
     396             <property name="icon" > 
     397              <iconset resource="../res/vidalia_common.qrc" >:/images/22x22/edit-copy.png</iconset> 
     398             </property> 
     399            </widget> 
     400           </item> 
     401           <item row="3" column="1" > 
     402            <spacer> 
     403             <property name="orientation" > 
     404              <enum>Qt::Vertical</enum> 
     405             </property> 
     406             <property name="sizeHint" > 
     407              <size> 
     408               <width>26</width> 
     409               <height>66</height> 
     410              </size> 
     411             </property> 
     412            </spacer> 
     413           </item> 
     414          </layout> 
     415         </item> 
     416        </layout> 
     417       </widget> 
    418418      </widget> 
    419419     </widget> 
     
    562562         </property> 
    563563         <property name="text" > 
    564           <string>Afterwards you can access the hidden service using the first part of the Client Authorization String, the onion address.! (Don't forget to save before trying.)</string> 
     564          <string>Afterwards you can access the hidden service using the first part of the Client Authorization String, the onion address. (Don't forget to save before trying.)</string> 
    565565         </property> 
    566566         <property name="scaledContents" >