Applied,

Thanks a lot
Vadim
Michal Komadel wrote:
> # HG changeset patch
> # User koma...@a05-0904a
> # Date 1240670060 -7200
> # Node ID 08af09959202229824dd6f65d8f61fa47c005e9c
> # Parent  8bdfd092f73754480dd439c33bff799b8b3509de
> # Parent  d2fd2e1fcbb281bae0a5f29c82df676c90388e56
> this will add tooltip text "[email protected]" to login line in jabber 
> settings window
>
> diff -r 8bdfd092f737 -r 08af09959202 
> wengophone/src/presentation/qt/imaccount/QtJabberSettings.cpp
> --- a/wengophone/src/presentation/qt/imaccount/QtJabberSettings.cpp   Wed Apr 
> 22 13:49:14 2009 +0200
> +++ b/wengophone/src/presentation/qt/imaccount/QtJabberSettings.cpp   Sat Apr 
> 25 16:34:20 2009 +0200
> @@ -33,6 +33,12 @@
>  
>  #include <buildconfig.h>
>  
> +#include <QtCore/QObject>
> +#include <QtGui/QPalette>
> +#include <QtGui/QComboBox>
> +
> +#define toolTipText "[email protected]"
> +
>  QtJabberSettings::QtJabberSettings(UserProfile & userProfile, IMAccount & 
> imAccount, QDialog * parent)
>       : QtIMAccountPlugin(userProfile, imAccount, parent) {
>  
> @@ -48,7 +54,12 @@
>  
>       _ui = new Ui::JabberSettings();
>       _ui->setupUi(_IMSettingsWidget);
> -
> +     
> +     _ui->loginLineEdit->installEventFilter(this);
> +     _originalPalette = _ui->loginLineEdit->palette();
> +     _greyPalette.setColor(QPalette::Text, Qt::gray);
> +     _toolTip = tr(toolTipText);
> +     _toolTipShowed = false;
>       IMAccountParameters & params = _imAccount.getIMAccountParameters();
>  
>       QString fullLogin = QString::fromStdString(_imAccount.getLogin());
> @@ -59,7 +70,11 @@
>       if (resource.isEmpty()) {
>               resource = BINARY_NAME;
>       }
> -     _ui->loginLineEdit->setText(login);
> +     
> +     if (login.isEmpty())
> +             showToolTip();
> +     else
> +             _ui->loginLineEdit->setText(login);
>       
> _ui->passwordLineEdit->setText(QString::fromStdString(_imAccount.getPassword()));
>       _ui->useTLSCheckBox->setChecked(params.isJabberTLSUsed());
>       _ui->requireTLSCheckBox->setChecked(params.isJabberTLSRequired());
> @@ -71,6 +86,9 @@
>  }
>  
>  bool QtJabberSettings::isValid() const {
> +     
> +     if (_toolTipShowed)
> +             return false;
>       return !_ui->loginLineEdit->text().isEmpty();
>  }
>  
> @@ -93,3 +111,35 @@
>       params.set(IMAccountParameters::JABBER_CONNECTION_SERVER_KEY, 
> _ui->connectServerLineEdit->text().toStdString());
>       params.set(IMAccountParameters::JABBER_PORT_KEY, 
> _ui->portLineEdit->text().toInt());
>  }
> +
> +bool QtJabberSettings::eventFilter(QObject *obj, QEvent *ev)
> +{
> +     if (obj == _ui->loginLineEdit)
> +     {
> +             if (ev->type() == QEvent::FocusIn)
> +             {
> +                     if (_toolTipShowed)
> +                             hideToolTip();
> +             }
> +             if (ev->type() == QEvent::FocusOut)
> +             {
> +                     if (_ui->loginLineEdit->text().isEmpty())
> +                             showToolTip();
> +             }
> +     }
> +     return false;
> +}
> +
> +void QtJabberSettings::showToolTip()
> +{
> +     _ui->loginLineEdit->setPalette(_greyPalette);
> +     _ui->loginLineEdit->setText(_toolTip);
> +     _toolTipShowed = true;
> +}
> +
> +void QtJabberSettings::hideToolTip()
> +{
> +     _ui->loginLineEdit->setPalette(_originalPalette);
> +     _ui->loginLineEdit->clear();
> +     _toolTipShowed = false;
> +}
> \ No newline at end of file
> diff -r 8bdfd092f737 -r 08af09959202 
> wengophone/src/presentation/qt/imaccount/QtJabberSettings.h
> --- a/wengophone/src/presentation/qt/imaccount/QtJabberSettings.h     Wed Apr 
> 22 13:49:14 2009 +0200
> +++ b/wengophone/src/presentation/qt/imaccount/QtJabberSettings.h     Sat Apr 
> 25 16:34:20 2009 +0200
> @@ -23,7 +23,9 @@
>  #include "QtIMAccountPlugin.h"
>  
>  #include <string>
> -
> +#include <QtCore/QObject>
> +#include <QtGui/QPalette>
> +#include <QtGui/QComboBox>
>  class IMAccount;
>  class UserProfile;
>  
> @@ -55,9 +57,23 @@
>  
>       void init();
>  
> +     bool eventFilter(QObject *obj, QEvent *ev);
> +     
> +     void showToolTip();
> +     
> +     void hideToolTip();
> +
>       Ui::JabberSettings * _ui;
>  
>       QWidget * _IMSettingsWidget;
> +     
> +     QString _toolTip;
> +     
> +     QPalette _originalPalette;
> +
> +     QPalette _greyPalette;
> +     
> +     bool _toolTipShowed;
>  };
>  
>  #endif       //OWQTJABBERSETTINGS_H
> diff -r 8bdfd092f737 -r 08af09959202 
> wengophone/src/presentation/qt/lang/qtwengophone_cs.ts
> --- a/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts  Wed Apr 22 
> 13:49:14 2009 +0200
> +++ b/wengophone/src/presentation/qt/lang/qtwengophone_cs.ts  Sat Apr 25 
> 16:34:20 2009 +0200
> @@ -2211,6 +2211,14 @@
>      </message>
>  </context>
>  <context>
> +    <name>QtJabberSettings</name>
> +    <message>
> +        <location filename="../imaccount/QtJabberSettings.cpp" line="41"/>
> +        <source>[email protected]</source>
> +        <translation>už[email protected]</translation>
> +    </message>
> +</context>
> +<context>
>      <name>QtCallForwardSettings</name>
>      <message>
>          <location filename="../config/QtCallForwardSettings.cpp" line="160"/>
> _______________________________________________
> QuteCom-dev mailing list
> [email protected]
> http://lists.qutecom.org/mailman/listinfo/qutecom-dev
>   

_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev

Reply via email to