Exemple #1
0
void Kleo::UserIDKeyListViewItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int alignment ) {
  const KeyListView::DisplayStrategy * ds = listView() ? listView()->displayStrategy() : 0 ;
  if ( !ds ) {
    QListViewItem::paintCell( p, cg, column, width, alignment );
    return;
  }
  const QColor fg = ds->useridForeground( userID(), cg.text() );
  const QColor bg = ds->useridBackground( userID(), cg.base() );
  const QFont f = ds->useridFont( userID(), p->font() );

  QColorGroup _cg = cg;
  p->setFont( f );
  _cg.setColor( QColorGroup::Text, fg );
  _cg.setColor( QColorGroup::Base, bg );

  QListViewItem::paintCell( p, _cg, column, width, alignment );
}
Exemple #2
0
void MetadataDialog::accept()
{
	UserDirectory userDir(metadataPath(), userID());
	if(!userDir.updateSignatures()) {
		QMessageBox::warning(this, tr("Erreur"), tr("Impossible de mettre à jour les signatures.\n") +
													userDir.errorString());
	} else {
		QDialog::accept();
	}
}
Exemple #3
0
//----------------------------------------------------------------------------------------------
void QLoginDialog::accept()
  {
  auto app = QBarApplication::instance();
  QString user_name = ui->lineEditUser->text();
  int user_id = app->userID(user_name);
  QPoint pos = QCursor::pos();
  QString pass = app->userPassword(user_id);

  if(ui->lineEditPassword->text() == pass && !pass.isEmpty())
    {
    app->setCurrentUser(user_id);

    auto app = QBarApplication::instance();
    bool is_checked = ui->checkBoxSave->isChecked();
    app->settings().setValue("login/save_password", is_checked);

    if(!is_checked)
      {
      pass = "";
      user_name = "";
      }

    app->settings().setValue("login/last_password", pass);
    app->settings().setValue("login/last_user", user_name);


    QString new_pwd = ui->lineEditNewPassword->text();
    QString new_pwd_copy = ui->lineEditNewPasswordCopy->text();

    if(!new_pwd.isEmpty())
      {
      if(new_pwd != new_pwd_copy)
        {
        std::wstring str = L"Новый пароль не верный";
        QToolTip::showText(pos, QString::fromUtf16(str.c_str()), 0, QRect(), 500);
        return;
        }
      else
        {
        if(false == app->changePassword(pass, new_pwd))
          {
          std::wstring str = L"Пароль должен быть длиной от 4-х до 15-ти символов и содержать латинские буквы и цифри";
          QToolTip::showText(pos, QString::fromUtf16(str.c_str()), 0, QRect(), 500);
          return;
          }
        }
      }
    QDialog::accept();
    }
  else
    {
    std::wstring str = L"Неправильный логин/пароль";
    QToolTip::showText(pos, QString::fromUtf16(str.c_str()), 0, QRect(), 500);
    }
  }
/**
 * This slot is connected to user stream object.
 * Called when new tweet arrives in the user stream
 */
void MentionsQmlListModel::onStatusesStream(const QTweetStatus &status)
{
    QList<QTweetEntityUserMentions> entityUserMentions = status.userMentionsEntities();

    for (int i = 0; i < entityUserMentions.count(); ++i) {
        if (entityUserMentions.at(i).userid() == userID()) {    //check if is mention
            QSqlQuery query;
            QString text;

            query.prepare("INSERT OR REPLACE INTO status "
                          "(id, text, screenName, profileImageUrl, userId, mention, created, replyToStatusId) "
                          "VALUES "
                          "(:id, :text, :screenName, :profileImageUrl, :userId, :mention, :created, :replyToStatusId);");
            query.bindValue(":id", status.id());
            query.bindValue(":userId", status.user().id());
            query.bindValue(":screenName", status.user().screenName());
            query.bindValue(":profileImageUrl", status.user().profileImageUrl());
            query.bindValue(":mention", 1);
            query.bindValue(":created", status.createdAt());
            query.bindValue(":replyToStatusId", status.inReplyToStatusId());

            if (status.isRetweet()) {
                QString retweetedText = status.retweetedStatus().text();
                text = "RT @" + status.retweetedStatus().user().screenName() + ": " + retweetedText;
            } else {
                text = status.text();
            }

             query.bindValue(":text", text);

            query.exec();

            m_newStatuses.prepend(status);

            m_numNewTweets = m_newStatuses.count();
            emit numNewTweetsChanged();
            break;
        }
    }
}
Exemple #5
0
const QPixmap * Kleo::UserIDKeyListViewItem::pixmap( int col ) const {
  return listView() && listView()->columnStrategy()
    ? listView()->columnStrategy()->userIDPixmap( userID(), col ) : 0 ;
}
Exemple #6
0
QString Kleo::UserIDKeyListViewItem::toolTip( int col ) const {
  return listView() && listView()->columnStrategy()
    ? listView()->columnStrategy()->userIDToolTip( userID(), col )
    : QString::null ;
}