void FileManager::setupActions()
{
    KAction* action = new KAction(this);
    action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    action->setText(i18n("Current Document Directory"));
    action->setIcon(KIcon("dirsync"));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(syncCurrentDocumentDirectory()));
    tbActions << (dirop->actionCollection()->action("back"));
    tbActions << (dirop->actionCollection()->action("up"));
    tbActions << (dirop->actionCollection()->action("home"));
    tbActions << (dirop->actionCollection()->action("forward"));
    tbActions << (dirop->actionCollection()->action("reload"));
    tbActions << action;
    tbActions << (dirop->actionCollection()->action("sorting menu"));
    tbActions << (dirop->actionCollection()->action("show hidden"));

    newFileAction = new KAction(this);
    newFileAction->setText(i18n("New File..."));
    newFileAction->setIcon(KIcon("document-new"));
    connect(newFileAction, SIGNAL(triggered()), this, SLOT(createNewFile()));
}
Esempio n. 2
0
CCppcheckWidget::CCppcheckWidget(QWidget* inpParent,
                                 CCppcheckPlugin *inpCppcheckPlugin) :
    QTreeView(inpParent),
    m_pCppcheckPlugin(inpCppcheckPlugin)
{
    setObjectName("cppcheck plugin report");
    setWindowTitle("cppcheck");
    setWindowIcon(KIcon("cppcheck"));
    setRootIsDecorated(true);
    setWhatsThis("cppcheck plugin report");

    setModel(m_pCppcheckPlugin->getModel());

    KAction *pCheckCurrentFile = new KAction(this);
    pCheckCurrentFile->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    pCheckCurrentFile->setText(i18n("(Re-)launch cppcheck on the current file"));
    pCheckCurrentFile->setToolTip(i18n("(Re-)launch cppcheck on the current file"));
    pCheckCurrentFile->setIcon(KIcon("view-refresh"));
    connect(pCheckCurrentFile, SIGNAL(triggered(bool)), model(), SLOT(parseCurrentFile()));
    addAction(pCheckCurrentFile);

    KAction *pActionShowErrors = new KAction(this);
    addAction(pActionShowErrors);
    pActionShowErrors->setCheckable(true);
    pActionShowErrors->setChecked(false);
    pActionShowErrors->setText(i18n("Show errors"));
    pActionShowErrors->setToolTip(i18n("Show errors"));
    pActionShowErrors->setIcon(KIcon("user-busy"));
    model()->setShowErrors(true);
    connect(pActionShowErrors, SIGNAL(triggered(bool)), model(), SLOT(setShowErrors(bool)));

    KAction *pActionShowWarnings = new KAction(this);
    addAction(pActionShowWarnings);
    pActionShowWarnings->setCheckable(true);
    pActionShowWarnings->setChecked(false);
    pActionShowWarnings->setText(i18n("Show warnings"));
    pActionShowWarnings->setToolTip(i18n("Show warnings"));
    pActionShowWarnings->setIcon(KIcon("dialog-warning"));
    model()->setShowWarnings(true);
    connect(pActionShowWarnings, SIGNAL(triggered(bool)), model(), SLOT(setShowWarnings(bool)));

    KAction *pActionShowStyle = new KAction(this);
    addAction(pActionShowStyle);
    pActionShowStyle->setCheckable(true);
    pActionShowStyle->setChecked(false);
    pActionShowStyle->setText(i18n("Show style warnings"));
    pActionShowStyle->setToolTip(i18n("Show style warnings"));
    pActionShowStyle->setIcon(KIcon("help-hint"));
    model()->setShowStyle(true);
    connect(pActionShowStyle, SIGNAL(triggered(bool)), model(), SLOT(setShowStyle(bool)));

    KAction *pActionShowPortability = new KAction(this);
    addAction(pActionShowPortability);
    pActionShowPortability->setCheckable(true);
    pActionShowPortability->setChecked(false);
    pActionShowPortability->setText(i18n("Show portability warnings"));
    pActionShowPortability->setToolTip(i18n("Show portability warnings"));
    pActionShowPortability->setIcon(KIcon("office-chart-ring"));
    model()->setShowPortability(true);
    connect(pActionShowPortability, SIGNAL(triggered(bool)), model(), SLOT(setShowPortability(bool)));

    KAction *pActionShowPerformance = new KAction(this);
    addAction(pActionShowPerformance);
    pActionShowPerformance->setCheckable(true);
    pActionShowPerformance->setChecked(false);
    pActionShowPerformance->setText(i18n("Show performance warnings"));
    pActionShowPerformance->setToolTip(i18n("Show performance warnings"));
    pActionShowPerformance->setIcon(KIcon("fork"));
    model()->setShowPerformance(true);
    connect(pActionShowPerformance, SIGNAL(triggered(bool)), model(), SLOT(setShowPerformance(bool)));

    KAction *pActionShowInformation = new KAction(this);
    addAction(pActionShowInformation);
    pActionShowInformation->setCheckable(true);
    pActionShowInformation->setChecked(false);
    pActionShowInformation->setText(i18n("Show information messages"));
    pActionShowInformation->setToolTip(i18n("Show information messages"));
    pActionShowInformation->setIcon(KIcon("help-about"));
    model()->setShowInformation(true);
    connect(pActionShowInformation, SIGNAL(triggered(bool)), model(), SLOT(setShowInformation(bool)));
}