コード例 #1
0
ファイル: editorpage.cpp プロジェクト: choueric/kscope-4
/*
 * show all the commands supported by KTextEditor
 * It's a debug function
 */
void EditorPage::aboutCommand()
{
    KTextEditor::Editor *editor = m_pDoc->editor();
    KTextEditor::CommandInterface *iface = qobject_cast<KTextEditor::CommandInterface *>(editor);

    if (iface == NULL) {
        qDebug("CommandInterface cast failed");
        return;
    }

    QString msg;
    const QString cmd("set-tab-width");
    KTextEditor::Command *pcmd = iface->queryCommand(cmd);
    QStringList list = pcmd->cmds();

#if 0
    for (int i = 0; i < list.size(); i++)
        qDebug("cmd: %s", list[i].toAscii().data());
#endif

    if (pcmd) {
        pcmd->help(m_pView, cmd, msg);
        qDebug("%s", msg.toAscii().data());
    } else {
        qDebug("no this cmd");
    }
}
コード例 #2
0
ファイル: editorpage.cpp プロジェクト: AlexanderStein/kscope4
void EditorPage::setTabWidth(uint nTabWidth)
{
	KTextEditor::CommandInterface *pCmdIf;
	KTextEditor::Command *pKateCmd;
	QString sCmd, sResult;

	pCmdIf = qobject_cast<KTextEditor::CommandInterface *>(KTextEditor::EditorChooser::editor());
	if ( pCmdIf && (pKateCmd = pCmdIf->queryCommand("set-tab-width"))) {
		sCmd.sprintf("set-tab-width %u", nTabWidth);
		pKateCmd->exec(m_pView, sCmd, sResult);
	}
}
コード例 #3
0
ファイル: editorpage.cpp プロジェクト: choueric/kscope-4
// set Tab charactor's width (4 / 8 or else)
void EditorPage::setTabWidth(uint nTabWidth)
{
    KTextEditor::Editor *editor = m_pDoc->editor();
    KTextEditor::CommandInterface *iface = 
        qobject_cast<KTextEditor::CommandInterface *>(editor);

	QString sCmd, sResult;
    const QString cmd("set-tab-width");
    KTextEditor::Command *pCmd = iface->queryCommand(cmd);

    if (pCmd) {
		sCmd.sprintf("set-tab-width %u", nTabWidth);
		if (pCmd->exec(m_pView, sCmd, sResult) == false) {
            qDebug("set tab width failed: %s", sResult.toAscii().data());
        }
    } else {
        qDebug("no this cmd");
    }
}