Example #1
0
void PersonView::slotLinkClicked( const QUrl &url )
{
  qDebug() << "CLICKED" << url;

  if ( url.scheme() == "polka" ) {
    QStringList path = url.path().split("/");
    QString action = path.first();
    qDebug() << "ACTION" << action;

    if ( action == "editName" ) editName();

    else if ( action == "addEmail" ) addEmail();
    else if ( action == "editEmail" ) editEmail( path.value( 1 ) );
    else if ( action == "removeEmail" ) removeEmail( path.value( 1 ) );
    else if ( action == "commentEmail" ) commentEmail( path.value( 1 ) );

    else if ( action == "addPhone" ) addPhone();
    else if ( action == "editPhone" ) editPhone( path.value( 1 ) );
    else if ( action == "removePhone" ) removePhone( path.value( 1 ) );
    else if ( action == "commentPhone" ) commentPhone( path.value( 1 ) );

    else if ( action == "addLink" ) addLink();
    else if ( action == "editLink" ) editLink( path.value( 1 ) );
    else if ( action == "removeLink" ) removeLink( path.value( 1 ) );
    else if ( action == "commentLink" ) commentLink( path.value( 1 ) );

    else if ( action == "addAddress" ) addAddress();
    else if ( action == "editAddress" ) editAddress( path.value( 1 ) );
    else if ( action == "removeAddress" ) removeAddress( path.value( 1 ) );
    else if ( action == "commentAddress" ) commentAddress( path.value( 1 ) );

    else if ( action == "addComment" ) addComment();
    else if ( action == "editComment" ) editComment( path.value( 1 ) );
    else if ( action == "removeComment" ) removeComment( path.value( 1 ) );

    else if ( action == "close" ) requestClose();
    else if ( action == "magic" ) debugHtml();

    else qDebug() << "unknown action" << action;
  } else {
    new KRun( QUrl( url ), this );
  }
}
Example #2
0
void TikzEditorView::createActions()
{
	m_undoAction = StandardAction::undo(m_tikzEditor, SLOT(undo()), this);
	m_redoAction = StandardAction::redo(m_tikzEditor, SLOT(redo()), this);
	m_cutAction = StandardAction::cut(m_tikzEditor, SLOT(cut()), this);
	m_copyAction = StandardAction::copy(m_tikzEditor, SLOT(copy()), this);
	m_pasteAction = StandardAction::paste(m_tikzEditor, SLOT(paste()), this);
	m_selectAllAction = StandardAction::selectAll(m_tikzEditor, SLOT(selectAll()), this);
	m_undoAction->setStatusTip(tr("Undo the previous action"));
	m_redoAction->setStatusTip(tr("Redo the previous undone action"));
	m_cutAction->setStatusTip(tr("Cut the current selection's contents to the clipboard"));
	m_copyAction->setStatusTip(tr("Copy the current selection's contents to the clipboard"));
	m_pasteAction->setStatusTip(tr("Paste the clipboard's contents into the current selection"));
	m_selectAllAction->setStatusTip(tr("Select all the content"));
	m_undoAction->setWhatsThis(tr("<p>Undo the previous action.</p>"));
	m_redoAction->setWhatsThis(tr("<p>Redo the previous undone action.</p>"));
	m_cutAction->setWhatsThis(tr("<p>Cut the current selection's contents to the clipboard.</p>"));
	m_copyAction->setWhatsThis(tr("<p>Copy the current selection's contents to the clipboard.</p>"));
	m_pasteAction->setWhatsThis(tr("<p>Paste the clipboard's contents into the current selection.</p>"));
	m_selectAllAction->setWhatsThis(tr("<p>Select all the content.</p>"));

	Action *action;
	action = new Action(Icon("format-indent-more"), tr("&Indent..."), this, "edit_indent");
	action->setShortcut(tr("Ctrl+I", "Edit|Indent"));
	action->setStatusTip(tr("Indent the current line or selection"));
	action->setWhatsThis(tr("<p>Indent the current line or selection.</p>"));
	connect(action, SIGNAL(triggered()), this, SLOT(editIndent()));
	m_editActions.append(action);

	action = new Action(tr("C&omment"), this, "edit_comment");
	action->setShortcut(tr("Ctrl+D", "Edit|Comment"));
	action->setStatusTip(tr("Comment the current line or selection"));
	action->setWhatsThis(tr("<p>Comment the current line or selection.</p>"));
	connect(action, SIGNAL(triggered()), this, SLOT(editComment()));
	m_editActions.append(action);

	action = new Action(tr("Unco&mment"), this, "edit_uncomment");
	action->setShortcut(tr("Ctrl+Shift+D", "Edit|Uncomment"));
	action->setStatusTip(tr("Uncomment the current line or selection"));
	action->setWhatsThis(tr("<p>Uncomment the current line or selection.</p>"));
	connect(action, SIGNAL(triggered()), this, SLOT(editUncomment()));
	m_editActions.append(action);

	action = new Action(this);
	action->setSeparator(true);
	m_editActions.append(action);

	m_editActions.append(StandardAction::find(this, SLOT(editFind()), this));
	m_editActions.append(StandardAction::findNext(this, SLOT(editFindNext()), this));
	m_editActions.append(StandardAction::findPrev(this, SLOT(editFindPrevious()), this));
	m_editActions.append(StandardAction::replace(this, SLOT(editReplace()), this));
	m_editActions.append(StandardAction::gotoLine(this, SLOT(editGoToLine()), this));
	m_editActions.at(4)->setStatusTip(tr("Look up a piece of text in the document"));
	m_editActions.at(5)->setStatusTip(tr("Search the next occurrence of a text"));
	m_editActions.at(6)->setStatusTip(tr("Search the previous occurrence of a text"));
	m_editActions.at(7)->setStatusTip(tr("Search and replace a piece of text in the document"));
	m_editActions.at(8)->setStatusTip(tr("Go to a certain line in the document"));
	m_editActions.at(4)->setWhatsThis(tr("<p>Look up a piece of text in the document.</p>"));
	m_editActions.at(5)->setWhatsThis(tr("<p>Search the next occurrence of a text.</p>"));
	m_editActions.at(6)->setWhatsThis(tr("<p>Search the previous occurrence of a text.</p>"));
	m_editActions.at(7)->setWhatsThis(tr("<p>Search and replace a piece of text in the document.</p>"));
	m_editActions.at(8)->setWhatsThis(tr("<p>Go to a certain line in the document.</p>"));

	m_undoAction->setEnabled(false);
	m_redoAction->setEnabled(false);
	m_cutAction->setEnabled(false);
	m_copyAction->setEnabled(false);
	m_pasteAction->setEnabled(m_tikzEditor->canPaste());

	connect(m_tikzEditor, SIGNAL(undoAvailable(bool)),
	        m_undoAction, SLOT(setEnabled(bool)));
	connect(m_tikzEditor, SIGNAL(redoAvailable(bool)),
	        m_redoAction, SLOT(setEnabled(bool)));
	connect(m_tikzEditor, SIGNAL(copyAvailable(bool)),
	        m_cutAction, SLOT(setEnabled(bool)));
	connect(m_tikzEditor, SIGNAL(copyAvailable(bool)),
	        m_copyAction, SLOT(setEnabled(bool)));
	connect(QApplication::clipboard(), SIGNAL(dataChanged()),
	        this, SLOT(setPasteEnabled()));
}