コード例 #1
0
void KPanelExtension::action( Action a )
{
  if ( (a & About) )
    about();
  if ( (a & Help) )
    help();
  if ( (a & Preferences) )
    preferences();
  if ( (a & ReportBug) )
    reportBug();
}
コード例 #2
0
void BoxContainerItem::fillKPopupMenu(KPopupMenu *popupMenu, KActionCollection *actions) const
{
    /*popupMenu->insertItem( i18n( "&Configure" ), this, SLOT( slotConfigure() ) );
    popupMenu->insertItem( i18n( "&Recheck" ), this, SLOT( slotRecheck() ) );
    popupMenu->insertItem( i18n( "R&eset Counter" ), this, SLOT( slotReset() ) );
    popupMenu->insertItem( i18n( "&View Emails" ), this, SLOT( slotView() ) );
    popupMenu->insertItem( i18n( "R&un Command" ), this, SLOT( slotRunCommand() ) );*/

    (new KAction(i18n("&Configure"),     KShortcut(), this, SLOT(slotConfigure()), actions))->plug(popupMenu);
    (new KAction(i18n("&Recheck"),       KShortcut(), this, SLOT(slotRecheck()), actions))->plug(popupMenu);
    (new KAction(i18n("R&eset Counter"), KShortcut(), this, SLOT(slotReset()), actions))->plug(popupMenu);
    (new KAction(i18n("&View Emails"),   KShortcut(), this, SLOT(slotView()), actions))->plug(popupMenu);
    (new KAction(i18n("R&un Command"),   KShortcut(), this, SLOT(slotRunCommand()), actions))->plug(popupMenu);
    popupMenu->insertSeparator();
    KStdAction::help(this, SLOT(help()), actions)->plug(popupMenu);
    KStdAction::reportBug(this, SLOT(reportBug()), actions)->plug(popupMenu);
    KStdAction::aboutApp(this, SLOT(about()), actions)->plug(popupMenu);
}
コード例 #3
0
ファイル: EntryWin32.cpp プロジェクト: neilsh/ShortHike
LONG
handleStructuredException(EXCEPTION_POINTERS* exceptionPointers)
{
    logEngineError("--------------------------------------------------------------------------------");
    logStructuredException(exceptionPointers);
    // Print stack trace
    MyStackWalker stackWalk;
    stackWalk.ShowCallstack(GetCurrentThread(), exceptionPointers->ContextRecord);
    string identifier = "UNKNOWN FAILURE";
    if(stackWalk.mIdentifier != "")
        identifier = stackWalk.mIdentifier;

    reportBug(identifier, stackWalk.mTraceStream, exceptionPointers);
    logEngineError(stackWalk.mTraceStream);
    logEngineError("Error reporting completed. HALTING.");

    return EXCEPTION_EXECUTE_HANDLER;
}
コード例 #4
0
ファイル: rkerrordialog.cpp プロジェクト: KDE/rkward
void RKErrorDialog::reportableErrorMessage (QWidget* parent_widget, const QString& user_message, const QString &details, const QString& caption, const QString& message_code) {
	RK_TRACE (APP);

	if (!parent_widget) parent_widget = RKWardMainWindow::getMain ();
	// adjusted from KMessageBox::detailedError
	KDialog *dialog = new KDialog (parent_widget, Qt::Dialog);
	dialog->setCaption (caption);
	if (details.isEmpty ()) dialog->setButtons (KDialog::Ok | KDialog::No);
	else dialog->setButtons (KDialog::Ok | KDialog::No | KDialog::Details);
	dialog->setButtonText (KDialog::No, i18n ("Report As Bug"));
	dialog->setObjectName ("error");
	dialog->setDefaultButton (KDialog::Ok);
	dialog->setEscapeButton (KDialog::Ok);
	KMessageBox::Options options = KMessageBox::Notify | KMessageBox::AllowLink;
	dialog->setModal (true);

	int ret = KMessageBox::createKMessageBox (dialog, QMessageBox::Critical, user_message, QStringList(), QString(), 0, options, details);

	if (ret == KDialog::No) {
		reportBug (parent_widget, (message_code.isEmpty () ? QString () : i18n ("Message code: %1\n", message_code)) + user_message);
	}
}
コード例 #5
0
KHelpMenu::KHelpMenu( QWidget *parent, const KAboutData *aboutData,
		      bool showWhatsThis, KActionCollection *actions )
  : QObject(parent), mMenu(0), mAboutApp(0), mAboutKDE(0), mBugReport(0),
    d(new KHelpMenuPrivate)
{
  mParent = parent;
  mShowWhatsThis = showWhatsThis;

  d->mAboutData = aboutData;

  if (!aboutData)
    mAboutAppText = QString::null;

  if (actions)
  {
    KStdAction::helpContents(this, SLOT(appHelpActivated()), actions);
    if (showWhatsThis)
      KStdAction::whatsThis(this, SLOT(contextHelpActivated()), actions);
    KStdAction::reportBug(this, SLOT(reportBug()), actions);
    KStdAction::aboutApp(this, SLOT(aboutApplication()), actions);
    KStdAction::aboutKDE(this, SLOT(aboutKDE()), actions);
    KStdAction::switchApplicationLanguage(this, SLOT(switchApplicationLanguage()), actions);
  }
}
コード例 #6
0
KPopupMenu* KHelpMenu::menu()
{
  if( !mMenu )
  {
    //
    // 1999-12-02 Espen Sand:
    // I use hardcoded menu id's here. Reason is to stay backward
    // compatible.
    //
    const KAboutData *aboutData = d->mAboutData ? d->mAboutData : KGlobal::instance()->aboutData();
    QString appName = (aboutData)? aboutData->programName() : QString::fromLatin1(qApp->name());

    mMenu = new KPopupMenu();
    connect( mMenu, SIGNAL(destroyed()), this, SLOT(menuDestroyed()));

    bool need_separator = false;
    if (kapp->authorizeKAction("help_contents"))
    {
      mMenu->insertItem( BarIcon( "contents", KIcon::SizeSmall),
                     i18n( "%1 &Handbook" ).arg( appName) ,menuHelpContents );
      mMenu->connectItem( menuHelpContents, this, SLOT(appHelpActivated()) );
      mMenu->setAccel( KStdAccel::shortcut(KStdAccel::Help), menuHelpContents );
      need_separator = true;
    }

    if( mShowWhatsThis && kapp->authorizeKAction("help_whats_this") )
    {
      QToolButton* wtb = QWhatsThis::whatsThisButton(0);
      mMenu->insertItem( wtb->iconSet(),i18n( "What's &This" ), menuWhatsThis);
      mMenu->connectItem( menuWhatsThis, this, SLOT(contextHelpActivated()) );
      delete wtb;
      mMenu->setAccel( SHIFT + Key_F1, menuWhatsThis );
      need_separator = true;
    }

    if (kapp->authorizeKAction("help_report_bug") && aboutData && !aboutData->bugAddress().isEmpty() )
    {
      if (need_separator)
        mMenu->insertSeparator();
      mMenu->insertItem( i18n( "&Report Bug..." ), menuReportBug );
      mMenu->connectItem( menuReportBug, this, SLOT(reportBug()) );
      need_separator = true;
    }

    if (kapp->authorizeKAction("switch_application_language"))
    {
      if (need_separator)
        mMenu->insertSeparator();
      mMenu->insertItem( i18n( "Switch application &language..." ), menuSwitchLanguage );
      mMenu->connectItem( menuSwitchLanguage, this, SLOT(switchApplicationLanguage()) );
      need_separator = true;
    }
    
    if (need_separator)
      mMenu->insertSeparator();

    if (kapp->authorizeKAction("help_about_app"))
    {
      mMenu->insertItem( kapp->miniIcon(),
        i18n( "&About %1" ).arg(appName), menuAboutApp );
      mMenu->connectItem( menuAboutApp, this, SLOT( aboutApplication() ) );
    }
    
    if (kapp->authorizeKAction("help_about_kde"))
    {
      mMenu->insertItem( SmallIcon("about_kde"), i18n( "About &KDE" ), menuAboutKDE );
      mMenu->connectItem( menuAboutKDE, this, SLOT( aboutKDE() ) );
    }
  }

  return mMenu;
}
コード例 #7
0
ファイル: mainwindow.cpp プロジェクト: mlang/bmc
BrailleMusicEditor::BrailleMusicEditor(QWidget *parent)
: QMainWindow(parent), ok(this), fail(this), lilypond(this) {
#ifdef Q_OS_OSX
  setUnifiedTitleAndToolBarOnMac(true);
#endif

  setToolButtonStyle(Qt::ToolButtonFollowStyle);
  setupFileActions();
  setupEditActions();
  setupOptionsActions();
  setupSoundEffects();

  {
    auto helpMenu = new QMenu(tr("Help"), this);
    menuBar()->addMenu(helpMenu);
    helpMenu->addAction(tr("About"), this, SLOT(about()));
    helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
    helpMenu->addAction(tr("&Report a problem..."), this, SLOT(reportBug()));
  }

  textEdit = new QTextEdit(this);
  textEdit->setWordWrapMode(QTextOption::NoWrap);
  connect(textEdit, &QTextEdit::cursorPositionChanged,
          this, &BrailleMusicEditor::cursorPositionChanged);
  connect(textEdit, &QTextEdit::textChanged,
          this, &BrailleMusicEditor::textChanged);

  svgScrollArea = new QScrollArea(this);
  svgScrollArea->setFocusPolicy(Qt::NoFocus);

  auto splitter = new QSplitter(Qt::Vertical);
  splitter->addWidget(textEdit);
  splitter->addWidget(svgScrollArea);

  QSettings settings;
  if (settings.value("ui/persist_layout",1).toInt() &&
      settings.contains("ui/layout_data")) {
	  splitter->restoreState(settings.value("ui/layout_data").toByteArray());
    } else {
      splitter->setStretchFactor(0, 1);
      splitter->setStretchFactor(1, 1);
    }
  setCentralWidget(splitter);
 
  textEdit->setFocus();
  setCurrentFileName(QString());

  QFont textFont("Helvetica");
  textFont.setStyleHint(QFont::SansSerif);
  textEdit->setFont(textFont);
  fontChanged(textEdit->font());
  colorChanged(textEdit->textColor());

  connect(textEdit->document(), &QTextDocument::modificationChanged,
          actionSave, &QAction::setEnabled);
  connect(textEdit->document(), &QTextDocument::modificationChanged,
          this, &BrailleMusicEditor::setWindowModified);
  connect(textEdit->document(), &QTextDocument::undoAvailable,
          actionUndo, &QAction::setEnabled);
  connect(textEdit->document(), &QTextDocument::redoAvailable,
          actionRedo, &QAction::setEnabled);

  setWindowModified(textEdit->document()->isModified());
  actionSave->setEnabled(textEdit->document()->isModified());
  actionUndo->setEnabled(textEdit->document()->isUndoAvailable());
  actionRedo->setEnabled(textEdit->document()->isRedoAvailable());

  connect(actionUndo, &QAction::triggered, textEdit, &QTextEdit::undo);
  connect(actionRedo, &QAction::triggered, textEdit, &QTextEdit::redo);

  actionCut->setEnabled(false);
  actionCopy->setEnabled(false);

  connect(actionCut, &QAction::triggered, textEdit, &QTextEdit::cut);
  connect(actionCopy, &QAction::triggered, textEdit, &QTextEdit::copy);
  connect(actionPaste, &QAction::triggered, textEdit, &QTextEdit::paste);

  connect(textEdit, &QTextEdit::copyAvailable, actionCut, &QAction::setEnabled);
  connect(textEdit, &QTextEdit::copyAvailable, actionCopy, &QAction::setEnabled);

#ifndef QT_NO_CLIPBOARD
  connect(QApplication::clipboard(), SIGNAL(dataChanged()),
          this, SLOT(clipboardDataChanged()));
#endif

  connect(&lilypond, &QProcess::started,
          this, &BrailleMusicEditor::lilyPondStarted);
  connect(&lilypond, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>
                     (&QProcess::finished),
          this, &BrailleMusicEditor::lilyPondFinished);
  connect(&lilypond, static_cast<void (QProcess::*)(QProcess::ProcessError)>
                     (&QProcess::error),
          this, &BrailleMusicEditor::lilyPondError);

  QString initialFile = ":/examples/bwv988-v01.bmc";
  const QStringList args = QCoreApplication::arguments();
  if (args.count() == 2) initialFile = args.at(1);

  if (!load(initialFile)) fileNew();
}
コード例 #8
0
ファイル: tabwidget.cpp プロジェクト: bochi/kueue
QMenu* TabWidget::kueueMainMenu()
{
    QMenu* menu = new QMenu( this );

    QMenu* kueue = new QMenu( menu );
    kueue->setIcon( QIcon( ":/icons/kueue.png" ) );
    kueue->setTitle( "Kueue" );

    mActionConfig = new QAction( kueue );
    mActionConfig->setText( "Configure kueue" );
    mActionConfig->setIcon( QIcon( ":/icons/menus/configure.png" ) );

    mActionNSA = new QAction( kueue );
    mActionNSA->setText( "Generate NSA Report" );
    mActionNSA->setIcon( QIcon( ":/icons/menus/nsa.png" ) );

    if ( Settings::unityEnabled() )
    {
        mActionAddUnityTab = new QAction( kueue );
        mActionAddUnityTab->setText( "Add Unity tab" );
        mActionAddUnityTab->setIcon( QIcon( ":/icons/menus/web.png" ) );
    }

    mActionQuit = new QAction( kueue );
    mActionQuit->setText( "Quit" );
    mActionQuit->setIcon( QIcon( ":/icons/menus/quit.png" ) );
    mActionQuit->setShortcut ( QKeySequence( Qt::CTRL + Qt::Key_Q ) );

    kueue->addAction( mActionConfig );

    if ( Settings::unityEnabled() )
    {
        kueue->addAction( mActionAddUnityTab );
    }

    kueue->addAction( mActionNSA );

    kueue->addAction( mActionQuit );

    QMenu* view = new QMenu( menu );
    view->setIcon( QIcon( ":/icons/conf/targets.png" ) );
    view->setTitle( "Personal queue" );

    QMenu* filter = new QMenu( menu );
    filter->setIcon( QIcon( ":/icons/menus/filter.png" ) );
    filter->setTitle( "Filter" );

    mActionAwaitingCustomer = new QAction( filter );
    mActionAwaitingCustomer->setText( "Awaiting Customer" );
    mActionAwaitingCustomer->setCheckable( true );

    mActionAwaitingSupport = new QAction( filter );
    mActionAwaitingSupport->setText( "Awaiting Support" );
    mActionAwaitingSupport->setCheckable( true );

    mActionOthers = new QAction( filter );
    mActionOthers->setText( "Other" );
    mActionOthers->setCheckable( true );

    mActionShowCR = new QAction( filter );
    mActionShowCR->setText( "Show CRs" );
    mActionShowCR->setCheckable( true );

    mActionShowSR = new QAction( filter );
    mActionShowSR->setText( "Show SRs" );
    mActionShowSR->setCheckable( true );

    filter->addAction( mActionAwaitingCustomer );
    filter->addAction( mActionAwaitingSupport );
    filter->addAction( mActionOthers );
    filter->addSeparator();
    filter->addAction( mActionShowCR );
    filter->addAction( mActionShowSR );

    view->addMenu( filter );

    QMenu* sortby = new QMenu( menu );
    sortby->setIcon( QIcon( ":/icons/menus/sort.png" ) );
    sortby->setTitle( "Sort by" );

    mActionSortUpdate = new QAction( sortby );
    mActionSortUpdate->setText( "Last activity" );
    mActionSortUpdate->setCheckable( true );

    mActionSortAge = new QAction( sortby );
    mActionSortAge->setText( "Age" );
    mActionSortAge->setCheckable( true );

    sortby->addAction( mActionSortUpdate );
    sortby->addAction( mActionSortAge );

    view->addMenu( sortby );

    QMenu* other = new QMenu( menu );
    other->setIcon( QIcon( ":/icons/menus/misc.png" ) );
    other->setTitle( "Other" );

    mActionCloseSrTables = new QAction( other );
    mActionCloseSrTables->setText( "Close all SR tables" );

    mActionExpandSrTables = new QAction( other );
    mActionExpandSrTables->setText( "Expand all SR tables" );

    other->addAction( mActionCloseSrTables );
    other->addAction( mActionExpandSrTables );

    view->addMenu( other );

    QMenu* sub = new QMenu( menu );
    sub->setIcon( QIcon( ":/icons/conf/targets.png" ) );
    sub->setTitle( "Subowned SRs" );

    QMenu* subfilter = new QMenu( menu );
    subfilter->setIcon( QIcon( ":/icons/menus/filter.png" ) );
    subfilter->setTitle( "Filter" );

    mActionSubAwaitingCustomer = new QAction( subfilter );
    mActionSubAwaitingCustomer->setText( "Awaiting Customer" );
    mActionSubAwaitingCustomer->setCheckable( true );

    mActionSubAwaitingSupport = new QAction( subfilter );
    mActionSubAwaitingSupport->setText( "Awaiting Support" );
    mActionSubAwaitingSupport->setCheckable( true );

    mActionSubOthers = new QAction( subfilter );
    mActionSubOthers->setText( "Other" );
    mActionSubOthers->setCheckable( true );

    mActionSubShowCR = new QAction( subfilter );
    mActionSubShowCR->setText( "Show CRs" );
    mActionSubShowCR->setCheckable( true );

    mActionSubShowSR = new QAction( subfilter );
    mActionSubShowSR->setText( "Show SRs" );
    mActionSubShowSR->setCheckable( true );

    subfilter->addAction( mActionSubAwaitingCustomer );
    subfilter->addAction( mActionSubAwaitingSupport );
    subfilter->addAction( mActionSubOthers );
    subfilter->addSeparator();
    subfilter->addAction( mActionSubShowCR );
    subfilter->addAction( mActionSubShowSR );

    sub->addMenu( subfilter );

    QMenu* subsortby = new QMenu( menu );
    subsortby->setIcon( QIcon( ":/icons/menus/sort.png" ) );
    subsortby->setTitle( "Sort by" );

    mActionSubSortUpdate = new QAction( subsortby );
    mActionSubSortUpdate->setText( "Last activity" );
    mActionSubSortUpdate->setCheckable( true );

    mActionSubSortAge = new QAction( subsortby );
    mActionSubSortAge->setText( "Age" );
    mActionSubSortAge->setCheckable( true );

    sortby->addAction( mActionSubSortUpdate );
    sortby->addAction( mActionSubSortAge );

    sub->addMenu( subsortby );

    QMenu* subother = new QMenu( menu );
    subother->setIcon( QIcon( ":/icons/menus/misc.png" ) );
    subother->setTitle( "Other" );

    mActionSubCloseSrTables = new QAction( other );
    mActionSubCloseSrTables->setText( "Close all SR tables" );

    mActionSubExpandSrTables = new QAction( other );
    mActionSubExpandSrTables->setText( "Expand all SR tables" );

    subother->addAction( mActionSubCloseSrTables );
    subother->addAction( mActionSubExpandSrTables );

    sub->addMenu( subother );

    QMenu* qmon = new QMenu( menu );
    qmon->setIcon( QIcon( ":/icons/conf/monitor.png" ) );
    qmon->setTitle( "Queue monitor" );

    QMenu* qmonfilter = new QMenu( qmon );
    filter->setIcon( QIcon( ":/icons/menus/filter.png" ) );
    filter->setTitle( "Filter" );

    /*mActionQmonAwaitingCustomer = new QAction( qmonfilter );
    mActionQmonAwaitingCustomer->setText( "Awaiting Customer" );
    mActionQmonAwaitingCustomer->setCheckable( true );

    mActionQmonAwaitingSupport = new QAction( qmonfilter );
    mActionQmonAwaitingSupport->setText( "Awaiting Support" );
    mActionQmonAwaitingSupport->setCheckable( true );

    mActionQmonOthers = new QAction( qmonfilter );
    mActionQmonOthers->setText( "Other" );
    mActionQmonOthers->setCheckable( true );

    qmonfilter->addAction( mActionAwaitingCustomer );
    qmonfilter->addAction( mActionAwaitingSupport );
    qmonfilter->addAction( mActionOthers );*/

    qmon->addMenu( qmonfilter );

    QMenu* help = new QMenu( menu );
    help->setIcon( QIcon( ":/icons/menus/help.png" ) );
    help->setTitle( "Help" );

    mActionHelp = new QAction( help );
    mActionHelp->setText( "Help" );
    mActionHelp->setIcon( QIcon( ":/icons/menus/help.png" ) );

    mActionBug = new QAction( help );
    mActionBug->setText( "Report Bug" );
    mActionBug->setIcon( QIcon( ":/icons/menus/reportbug.png" ) );

    mActionFeature = new QAction( help );
    mActionFeature->setText( "Suggest feature" );
    mActionFeature->setIcon( QIcon( ":/icons/menus/feature.png" ) );

    mActionAbout = new QAction( help );
    mActionAbout->setText( "About kueue" );
    mActionAbout->setIcon( QIcon( ":/icons/menus/about.png" ) );

    help->addAction( mActionHelp );
    help->addAction( mActionBug );
    help->addAction( mActionFeature );
    help->addAction( mActionAbout );

    menu->addMenu( kueue );
    menu->addMenu( view );
    menu->addMenu( sub );
    menu->addMenu( qmon );
    menu->addMenu( help );

    setMenus();

    connect( mActionQuit, SIGNAL( activated() ),
             qApp, SLOT( quit() ) );
    connect( mActionConfig, SIGNAL( activated() ),
             this, SIGNAL( openConfig() ) );
    connect( mActionShowSR, SIGNAL( toggled( bool ) ),
             this, SLOT( setShowSR( bool ) ) );
    connect( mActionShowCR, SIGNAL( toggled( bool ) ),
             this, SLOT( setShowCR( bool ) ) );
    connect( mActionSortUpdate, SIGNAL( toggled( bool ) ),
             this, SLOT( setSortUpdate( bool ) ) );
    connect( mActionSortAge, SIGNAL( toggled( bool ) ),
             this, SLOT( setSortAge( bool ) ) );
    connect( mActionAwaitingCustomer, SIGNAL( toggled( bool ) ),
             this, SLOT( setShowAwaitingCustomer( bool ) ) );
    connect( mActionAwaitingSupport, SIGNAL( toggled( bool ) ),
             this, SLOT( setShowAwaitingSupport( bool ) ) );
    connect( mActionOthers, SIGNAL( toggled( bool ) ),
             this, SLOT( setShowStatusOthers( bool ) ) );
    connect( mActionExpandSrTables, SIGNAL( activated() ),
             this, SLOT( expandAllTables() ) );
    connect( mActionCloseSrTables, SIGNAL( activated() ),
             this, SLOT( closeAllTables() ) );

    connect( mActionSubShowSR, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetShowSR( bool ) ) );
    connect( mActionSubShowCR, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetShowCR( bool ) ) );
    connect( mActionSubSortUpdate, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetSortUpdate( bool ) ) );
    connect( mActionSubSortAge, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetSortAge( bool ) ) );
    connect( mActionSubAwaitingCustomer, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetShowAwaitingCustomer( bool ) ) );
    connect( mActionSubAwaitingSupport, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetShowAwaitingSupport( bool ) ) );
    connect( mActionSubOthers, SIGNAL( toggled( bool ) ),
             this, SLOT( subSetShowStatusOthers( bool ) ) );
    connect( mActionSubExpandSrTables, SIGNAL( activated() ),
             this, SLOT( subExpandAllTables() ) );
    connect( mActionSubCloseSrTables, SIGNAL( activated() ),
             this, SLOT( subCloseAllTables() ) );

    connect( mActionAbout, SIGNAL( activated() ),
             this, SLOT( aboutDialog() ) );
    connect( mActionBug, SIGNAL( activated() ),
             this, SLOT( reportBug() ) );
    connect( mActionFeature, SIGNAL( activated() ),
             this, SLOT( suggestFeature() ) );
    connect( mActionHelp, SIGNAL( activated() ),
             this, SLOT( openHelp() ) );

    if ( Settings::unityEnabled() )
    {
        connect( mActionAddUnityTab, SIGNAL( activated() ),
                 this, SLOT( addUnityBrowser() ) );
    }

    connect( mActionNSA, SIGNAL( activated() ),
             this, SLOT( makeNsaReport() ) );

    return menu;
}