disabling away on detach in mono mode. some minor improvement to the away settings
authorMarcus Eggenberger <egs@quassel-irc.org>
Tue, 17 Feb 2009 17:22:50 +0000 (18:22 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Tue, 17 Feb 2009 17:39:28 +0000 (18:39 +0100)
src/core/coresession.cpp
src/qtui/settingspages/identityeditwidget.cpp
src/qtui/settingspages/identityeditwidget.ui

index 926fc97..b5ae06c 100644 (file)
@@ -418,7 +418,7 @@ void CoreSession::clientsDisconnected() {
       continue;
 
     if(identity->detachAwayEnabled() && !me->isAway()) {
-      if(identity->detachAwayReasonEnabled())
+      if(!identity->detachAwayReason().isEmpty())
        awayReason = identity->detachAwayReason();
       net->setAutoAwayActive(true);
       net->userInputHandler()->handleAway(BufferInfo(), awayReason);
index d959001..4734525 100644 (file)
@@ -26,6 +26,7 @@
 #include <QFileDialog>
 #include <QUrl>
 
+#include "client.h"
 #include "iconloader.h"
 
 IdentityEditWidget::IdentityEditWidget(QWidget *parent)
@@ -43,16 +44,13 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent)
   connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
   connect(ui.nicknameList, SIGNAL(itemChanged(QListWidgetItem *)), this, SIGNAL(widgetHasChanged()));
   connect(ui.awayNick, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
-  connect(ui.awayNickEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.awayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
-  connect(ui.awayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.autoAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.autoAwayTime, SIGNAL(valueChanged(int)), this, SIGNAL(widgetHasChanged()));
   connect(ui.autoAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
   connect(ui.autoAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.detachAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.detachAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
-  connect(ui.detachAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged()));
   connect(ui.ident, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
   connect(ui.kickReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
   connect(ui.partReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
@@ -67,6 +65,13 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent)
   //connect(ui.nicknameList, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(setWidgetStates()));
   //connect(ui.nicknameList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(nicklistHasChanged()));
 
+  // disabling unused stuff
+  ui.autoAwayEnabled->hide();
+  ui.awayNick->hide();
+  ui.awayNickLabel->hide();
+
+  ui.detachAwayEnabled->setVisible(!Client::internalCore());
+
 #ifdef HAVE_SSL
   ui.sslKeyGroupBox->setAcceptDrops(true);
   ui.sslKeyGroupBox->installEventFilter(this);
@@ -104,16 +109,13 @@ void IdentityEditWidget::displayIdentity(CertIdentity *id, CertIdentity *saveId)
   //}
   if(ui.nicknameList->count()) ui.nicknameList->setCurrentRow(0);
   ui.awayNick->setText(id->awayNick());
-  ui.awayNickEnabled->setChecked(id->awayNickEnabled());
   ui.awayReason->setText(id->awayReason());
-  ui.awayReasonEnabled->setChecked(id->awayReasonEnabled());
   ui.autoAwayEnabled->setChecked(id->autoAwayEnabled());
   ui.autoAwayTime->setValue(id->autoAwayTime());
   ui.autoAwayReason->setText(id->autoAwayReason());
   ui.autoAwayReasonEnabled->setChecked(id->autoAwayReasonEnabled());
   ui.detachAwayEnabled->setChecked(id->detachAwayEnabled());
   ui.detachAwayReason->setText(id->detachAwayReason());
-  ui.detachAwayReasonEnabled->setChecked(id->detachAwayReasonEnabled());
   ui.ident->setText(id->ident());
   ui.kickReason->setText(id->kickReason());
   ui.partReason->setText(id->partReason());
@@ -133,16 +135,16 @@ void IdentityEditWidget::saveToIdentity(CertIdentity *id) {
   }
   id->setNicks(nicks);
   id->setAwayNick(ui.awayNick->text());
-  id->setAwayNickEnabled(ui.awayNickEnabled->isChecked());
+  id->setAwayNickEnabled(true);
   id->setAwayReason(ui.awayReason->text());
-  id->setAwayReasonEnabled(ui.awayReasonEnabled->isChecked());
+  id->setAwayReasonEnabled(true);
   id->setAutoAwayEnabled(ui.autoAwayEnabled->isChecked());
   id->setAutoAwayTime(ui.autoAwayTime->value());
   id->setAutoAwayReason(ui.autoAwayReason->text());
   id->setAutoAwayReasonEnabled(ui.autoAwayReasonEnabled->isChecked());
   id->setDetachAwayEnabled(ui.detachAwayEnabled->isChecked());
   id->setDetachAwayReason(ui.detachAwayReason->text());
-  id->setDetachAwayReasonEnabled(ui.detachAwayReasonEnabled->isChecked());
+  id->setDetachAwayReasonEnabled(true);
   id->setIdent(ui.ident->text());
   id->setKickReason(ui.kickReason->text());
   id->setPartReason(ui.partReason->text());
index ba6563c..52489a4 100644 (file)
               </property>
              </widget>
             </item>
-            <item row="1" column="0" >
-             <widget class="QCheckBox" name="awayReasonEnabled" >
-              <property name="toolTip" >
-               <string>Default away reason</string>
-              </property>
-              <property name="text" >
-               <string>Away Reason:</string>
-              </property>
-             </widget>
-            </item>
             <item row="1" column="1" >
              <widget class="QLineEdit" name="awayReason" >
               <property name="enabled" >
-               <bool>false</bool>
+               <bool>true</bool>
               </property>
               <property name="toolTip" >
                <string>Default away reason</string>
              </widget>
             </item>
             <item row="0" column="0" >
-             <widget class="QCheckBox" name="awayNickEnabled" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Nick to be used when being away</string>
-              </property>
+             <widget class="QLabel" name="awayNickLabel" >
               <property name="text" >
                <string>Away Nick:</string>
               </property>
              </widget>
             </item>
+            <item row="1" column="0" >
+             <widget class="QLabel" name="awayReasonLabel" >
+              <property name="text" >
+               <string>Away Reason:</string>
+              </property>
+             </widget>
+            </item>
            </layout>
           </item>
          </layout>
           <item>
            <layout class="QHBoxLayout" name="horizontalLayout" >
             <item>
-             <widget class="QCheckBox" name="detachAwayReasonEnabled" >
-              <property name="toolTip" >
-               <string>Override default away reason for auto-away on detach</string>
-              </property>
+             <widget class="QLabel" name="label_13" >
               <property name="text" >
                <string>Away Reason:</string>
               </property>
              </widget>
             </item>
             <item>
-             <widget class="QLineEdit" name="detachAwayReason" >
-              <property name="enabled" >
-               <bool>false</bool>
-              </property>
-              <property name="toolTip" >
-               <string>Override default away reason for auto-away on detach</string>
-              </property>
-             </widget>
+             <widget class="QLineEdit" name="detachAwayReason" />
             </item>
            </layout>
           </item>
@@ -784,38 +765,5 @@ Proceeding will cause an unencrypted transfer of your SSL Key and SSL Certificat
   </layout>
  </widget>
  <resources/>
- <connections>
-  <connection>
-   <sender>detachAwayReasonEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>detachAwayReason</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>103</x>
-     <y>195</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>215</x>
-     <y>196</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>awayReasonEnabled</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>awayReason</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>97</x>
-     <y>107</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>195</x>
-     <y>104</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>