コード例 #1
0
ファイル: msgcfg.cpp プロジェクト: BackupTheBerlios/sim-im
void MessageConfig::apply(SIM::PropertyHubPtr _data)
{
    if (m_file)
        m_file->apply(_data);

	SIM::PropertyHubPtr data = _data;
    data->setValue("OpenOnOnline", chkOnline->isChecked());
    data->setValue("LogStatus", chkStatus->isChecked());
    data->setValue("OpenNewMessage", NEW_MSG_NOOPEN);
    if (btnMinimize->isChecked())
        data->setValue("OpenNewMessage", NEW_MSG_MINIMIZE);
    if (btnRaise->isChecked())
        data->setValue("OpenNewMessage", NEW_MSG_RAISE);
}
コード例 #2
0
	void Test::userDataManipulation()
	{
		SIM::UserDataPtr data = SIM::UserData::create();
		SIM::PropertyHubPtr hub = data->getUserData("nonexistant");
		QVERIFY(hub.isNull());
		
		hub = data->createUserData("alpha");
		QVERIFY(!hub.isNull());
		hub->setValue("foo", 12);
		QCOMPARE(hub->value("foo").toInt(), 12);

		SIM::PropertyHubPtr anotherhub = data->getUserData("alpha");
		QCOMPARE(anotherhub->value("foo").toInt(), 12);

		hub.clear();
		anotherhub.clear();
		data->destroyUserData("alpha");
		hub = data->getUserData("alpha");
		QVERIFY(hub.isNull());
	}
コード例 #3
0
ファイル: filecfg.cpp プロジェクト: BackupTheBerlios/sim-im
void FileConfig::apply(SIM::PropertyHubPtr data)
{
    QString def = edtPath->text().isEmpty() ? "Incoming Files" : edtPath->text();
    data->setValue("IncomingPath", def);
    edtPath->setText(user_file(data->value("IncomingPath").toString()));
    data->setValue("AcceptMode", 0);
    if (btnAccept->isChecked())
    {
        data->setValue("AcceptMode", 1);
        data->setValue("OverwriteFiles", chkOverwrite->isChecked());
    }
    if (btnDecline->isChecked())
    {
        data->setValue("AcceptMode", 2);
        data->setValue("DeclineMessage", edtDecline->toPlainText());
    }
}
コード例 #4
0
ファイル: osdconfig.cpp プロジェクト: BackupTheBerlios/sim-im
void OSDConfig::apply(SIM::PropertyHubPtr data)
{
    data->setValue("EnableMessage", chkMessage->isChecked());
    data->setValue("EnableMessageShowContent", chkMessageContent->isChecked());
    data->setValue("EnableCapsLockFlash", chkCapsLockFlash->isChecked());
    data->setValue("EnableAlert", chkStatus->isChecked());
    data->setValue("EnableAlertOnline", chkStatusOnline->isChecked());
    data->setValue("EnableAlertAway", chkStatusAway->isChecked());
    data->setValue("EnableAlertNA", chkStatusNA->isChecked());
    data->setValue("EnableAlertDND", chkStatusDND->isChecked());
    data->setValue("EnableAlertOccupied", chkStatusOccupied->isChecked());
    data->setValue("EnableAlertFFC", chkStatusFFC->isChecked());
    data->setValue("EnableAlertOffline", chkStatusOffline->isChecked());
    data->setValue("EnableTyping", chkTyping->isChecked());
    data->setValue("ContentLines", (uint)edtLines->text().toULong());
    m_iface->apply(data);
}
コード例 #5
0
bool MsgEdit::processEvent(Event *e)
{
    switch (e->type()) {
    case eEventContact: {
        EventContact *ec = static_cast<EventContact*>(e);
        if (ec->contact()->id() != m_userWnd->m_id)
            break;
        adjustType();
        break;
    }
    case eEventClientChanged: {
        adjustType();
        break;
    }
    case eEventMessageReceived: {
        EventMessage *em = static_cast<EventMessage*>(e);
        Message *msg = em->msg();
        if (msg->getFlags() & MESSAGE_NOVIEW)
            return false;
        if ((msg->contact() == m_userWnd->id()) && (msg->type() != MessageStatus)){
            if (CorePlugin::instance()->getContainerMode()){
                bool bSetFocus = false;
                if (topLevelWidget() && topLevelWidget()->inherits("Container")){
                    Container *container = static_cast<Container*>(topLevelWidget());
                    if (container->wnd() == m_userWnd)
                        bSetFocus = true;
                }
                setMessage(msg, bSetFocus);
            }else{
                if (m_edit->isReadOnly())
                    QTimer::singleShot(0, this, SLOT(setupNext()));
            }
        }
        break;
    }
    case eEventRealSendMessage: {
        EventRealSendMessage *ersm = static_cast<EventRealSendMessage*>(e);
        if (ersm->edit() == this){
            sendMessage(ersm->msg());
            return true;
        }
        break;
    }
    case eEventCheckCommandState: {
        EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
        CommandDef *cmd = ecs->cmd();
        if ((cmd->param == (TextEdit*)m_edit) && (cmd->id == CmdTranslit)){
            Contact *contact = getContacts()->contact(m_userWnd->id());
            if (contact){
				SIM::PropertyHubPtr data = contact->getUserData("translit");
                if(!data.isNull()) {
                    cmd->flags &= ~COMMAND_CHECKED;
                    if (data->value("Translit").toBool())
                        cmd->flags |= COMMAND_CHECKED;
                    // FIXME: return true; missing here?
                }
            }
            return false;
        }
        if ((cmd->menu_id != MenuTextEdit) || (cmd->param != (TextEdit*)m_edit))
            return false;
        cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
        switch (cmd->id){
        case CmdUndo:
            if (m_edit->isReadOnly())
                return false;
            if (!m_edit->document()->isUndoAvailable())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdRedo:
            if (m_edit->isReadOnly())
                return false;
            if (!m_edit->document()->isRedoAvailable())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdCut:
            if (m_edit->isReadOnly())
                return false;
        case CmdCopy:
            if (m_edit->textCursor().selectedText().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdPaste:
            if (m_edit->isReadOnly())
                return false;
            if (QApplication::clipboard()->text().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        case CmdClear:
            if (m_edit->isReadOnly())
                return false;
        case CmdSelectAll:
            if (m_edit->toPlainText().isEmpty())
                cmd->flags |= COMMAND_DISABLED;
            return true;
        }
        break;
    }
    case eEventCommandExec: {
        EventCommandExec *ece = static_cast<EventCommandExec*>(e);
        CommandDef *cmd = ece->cmd();
#if defined(USE_KDE)
#if KDE_IS_VERSION(3,2,0)
        if (cmd->id == CmdEnableSpell){
            m_edit->setCheckSpellingEnabled(cmd->flags & COMMAND_CHECKED);
            return false;
        }
        else if ((cmd->id == CmdSpell) && (cmd->param == this)){
            m_edit->checkSpelling();
            return true;
        }
        else
#endif
#endif
        if ((cmd->id == CmdSmile) && (cmd->param == this)){
            EventCommandWidget eWidget(cmd);
            eWidget.process();
            QToolButton *btnSmile = qobject_cast<QToolButton*>(eWidget.widget());
            if (btnSmile){
                SmilePopup *popup = new SmilePopup(this);
                connect(popup, SIGNAL(insert(const QString &)), this, SLOT(insertSmile(const QString &)));
                QPoint p = CToolButton::popupPos(btnSmile, popup);
                popup->move(p);
                popup->show();
            }
            return true;
        }
        else if ((cmd->id == CmdTranslit) && (cmd->param == this)){
            Contact *contact = getContacts()->contact(m_userWnd->id());
            if (contact){
				SIM::PropertyHubPtr data = contact->getUserData("translit", true);
                data->setValue("Translit", ((cmd->flags & COMMAND_CHECKED) != 0));
            }
            return true;
        }
        else if ((cmd->id == CmdMultiply) && (cmd->param == this)){
            m_userWnd->showListView((cmd->flags & COMMAND_CHECKED) != 0);
            return true;
        }
        else if ((cmd->bar_id == ToolBarMsgEdit) && m_edit->isReadOnly() && (cmd->param == this)){
            switch (cmd->id){
            case CmdMsgAnswer:{
                    Message *msg = new Message(MessageGeneric);
                    msg->setContact(m_userWnd->id());
                    msg->setClient(m_client);
                    EventOpenMessage(msg).process();
                    delete msg;
                }
            case CmdNextMessage:
                QTimer::singleShot(0, this, SLOT(goNext()));
                break;
            }
        }
        else if ((cmd->menu_id != MenuTextEdit) || (cmd->param != this))
            return false;
        switch (cmd->id){
        case CmdUndo:
            m_edit->undo();
            return true;
        case CmdRedo:
            m_edit->redo();
            return true;
        case CmdCut:
            m_edit->cut();
            return true;
        case CmdCopy:
            m_edit->copy();
            return true;
        case CmdPaste:
            m_edit->paste();
            return true;
        case CmdClear:
            m_edit->clear();
            return true;
        case CmdSelectAll:
            m_edit->selectAll();
            return true;
        }
        break;
    }
コード例 #6
0
void SMSConfig::apply(SIM::PropertyHubPtr data)
{
    data->setValue("SMSSignatureBefore", edtBefore->toPlainText());
    data->setValue("SMSSignatureAfter", edtAfter->toPlainText());
}