Esempio n. 1
0
MsgGen::MsgGen(MsgEdit *parent, Message *msg)
        : QObject(parent)
{
    m_client = msg->client();
    m_edit   = parent;
    if (m_edit->m_edit->isReadOnly()){
        m_edit->m_edit->setText("");
        m_edit->m_edit->setReadOnly(false);
    }
    m_edit->m_edit->setTextFormat(RichText);
    if (msg->getFlags() & MESSAGE_INSERT){
        QString text = msg->getPlainText();
        m_edit->m_edit->insert(text, false, true, true);
    }else{
        QString text = msg->getRichText();
        if (!text.isEmpty()){
            m_edit->m_edit->setText(text);
            m_edit->m_edit->moveCursor(QTextEdit::MoveEnd, false);
            if ((msg->getBackground() != msg->getForeground()) && !CorePlugin::m_plugin->getOwnColors()){
                m_edit->m_edit->setBackground(msg->getBackground());
                m_edit->m_edit->setForeground(msg->getForeground(), true);
            }
        }
    }
    connect(m_edit->m_edit, SIGNAL(emptyChanged(bool)), this, SLOT(emptyChanged(bool)));
    emptyChanged(m_edit->m_edit->isEmpty());
}
Esempio n. 2
0
void ApplicationManager::add(ApplicationInfo *application) {
    if (!application || m_runningApplications.contains(application)) {
        return;
    }

    beginInsertRows(QModelIndex(), m_runningApplications.size(), m_runningApplications.size());
    m_runningApplications.append(application);
    endInsertRows();
    Q_EMIT applicationAdded(application->appId());
    Q_EMIT countChanged();
    if (count() == 1) Q_EMIT emptyChanged(isEmpty()); // was empty but not anymore

    connect(application, &ApplicationInfo::sessionChanged, this, [application, this]() {
        QModelIndex appIndex = findIndex(application);
        if (!appIndex.isValid()) return;
        Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << ApplicationManager::RoleSession);
    });
    connect(application, &ApplicationInfo::focusedChanged, this, [application, this]() {
        QModelIndex appIndex = findIndex(application);
        if (!appIndex.isValid()) return;
        Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << ApplicationManager::RoleFocused);
    });
    connect(application, &ApplicationInfo::stateChanged, this, [application, this]() {
        QModelIndex appIndex = findIndex(application);
        if (!appIndex.isValid()) return;
        Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << ApplicationManager::RoleState);
    });
}
Esempio n. 3
0
void TextEdit::slotTextChanged()
{
    bool bEmpty = isEmpty();
    if (m_bEmpty == bEmpty)
        return;
    m_bEmpty = bEmpty;
    emit emptyChanged(m_bEmpty);
}
Esempio n. 4
0
MsgJournal::MsgJournal(MsgEdit *parent, Message *msg)
        : QObject(parent)
{
    m_client = msg->client();
    m_edit  = parent;
    m_wnd   = new MsgJournalWnd(m_edit->m_frame);
    connect(m_wnd, SIGNAL(finished()), this, SLOT(frameDestroyed()));
    m_edit->m_layout->insertWidget(0, m_wnd);
    m_wnd->show();
    JournalMessage	*m = static_cast<JournalMessage*>(msg);
    m_ID	= m->getID();
    m_oldID = m->id();
    m_time  = m->getTime();
    m_wnd->edtSubj->setText(m->getSubject());
    m_wnd->cmbSecurity->setCurrentItem(m->getPrivate());
    Contact *contact = getContacts()->contact(msg->contact());
    if (contact){
        clientData *data;
        ClientDataIterator it(contact->clientData);
        while ((data = ++it) != NULL){
            if ((m_client.empty() && (data->Sign.value == LIVEJOURNAL_SIGN)) || (m_client == it.client()->dataName(data))){
                LiveJournalClient *client = static_cast<LiveJournalClient*>(it.client());
                for (unsigned i = 1; i < client->getMoods(); i++){
                    const char *mood = client->getMood(i);
                    if ((mood == NULL) || (*mood == 0))
                        continue;
                    QString s = mood;
                    QString ts = i18n(mood);
                    if (s != ts){
                        s += " (";
                        s += ts;
                        s += ")";
                    }
                    m_wnd->cmbMood->insertItem(s);
                }
                m_wnd->cmbMood->setCurrentItem(static_cast<JournalMessage*>(msg)->getMood());
                m_wnd->cmbMood->setMinimumSize(m_wnd->cmbMood->sizeHint());
                break;
            }
        }
    }
    m_wnd->cmbComment->setCurrentItem(m->getComments());
    m_edit->m_edit->setTextFormat(RichText);
    QString text = msg->getRichText();
    if (!text.isEmpty()){
        m_edit->m_edit->setText(text);
#ifndef USE_IE
        m_edit->m_edit->moveCursor(QTextEdit::MoveEnd, false);
#endif
        if ((msg->getBackground() != msg->getForeground()) && !LiveJournalPlugin::core->getOwnColors()){
            m_edit->m_edit->setBackground(msg->getBackground());
            m_edit->m_edit->setForeground(msg->getForeground(), true);
        }
    }
    connect(m_edit->m_edit, SIGNAL(emptyChanged(bool)), this, SLOT(emptyChanged(bool)));
    emptyChanged(m_edit->m_edit->isEmpty());
    m_edit->m_edit->setParam(m_edit);
}
Esempio n. 5
0
void QOrmObject::setAsLoaded()
{
    if (d->deleted) return;
    d->dirt = false;
    d->saved = true;
    d->empty = false;

    savedChanged(d->saved);
    dirtChanged(d->dirt);
    emptyChanged(d->empty);
}
Esempio n. 6
0
void ApplicationManager::remove(ApplicationInfo *application) {
    int i = m_runningApplications.indexOf(application);
    if (i != -1) {
        beginRemoveRows(QModelIndex(), i, i);
        m_runningApplications.removeAt(i);
        endRemoveRows();
        Q_EMIT applicationRemoved(application->appId());
        Q_EMIT countChanged();
        if (isEmpty()) Q_EMIT emptyChanged(isEmpty());
    }
    application->disconnect(this);
}
Esempio n. 7
0
void QOrmObject::modified()
{
    if (d->deleted)
        return;

    if (d->empty)
        d->empty = false;

    d->dirt = true;

    emit dirtChanged(d->dirt);
    emit emptyChanged(d->empty);
}
Esempio n. 8
0
/*!
    Clears the model.
 */
void IrcUserModel::clear()
{
    Q_D(IrcUserModel);
    if (!d->userList.isEmpty()) {
        beginResetModel();
        d->userList.clear();
        endResetModel();
        emit namesChanged(QStringList());
        emit titlesChanged(QStringList());
        emit usersChanged(QList<IrcUser*>());
        emit countChanged(0);
        emit emptyChanged(true);
    }
}
Esempio n. 9
0
void QOrmObject::clear()
{
    if (d->meta)
        d->indexes = QVector<QVariant>(d->meta->indexCount());

    d->deleted = false;
    d->saved = false;
    d->dirt = false;
    d->empty = true;

    emit deletedChanged(d->deleted);
    emit savedChanged(d->saved);
    emit dirtChanged(d->dirt);
    emit emptyChanged(d->empty);
}
void QmlProfilerTimelineModel::dataChanged()
{

    switch (m_modelManager->state()) {
    case QmlProfilerModelManager::Done:
        emit emptyChanged();
        break;
    case QmlProfilerModelManager::ClearingData:
        clear();
        break;
    default:
        break;
    }

    emit labelsChanged();
}
void ResultsDataModel::clear() {
    _internalDB.clear();
    emit itemsChanged(bb::cascades::DataModelChangeType::AddRemove);
    emit emptyChanged(empty());
}
void ResultsDataModel::addResult(QVariantMap result) {
    _internalDB.append(result);
    emit itemsChanged(bb::cascades::DataModelChangeType::AddRemove);
    emit emptyChanged(empty());
}