void ConfigurationDialogWidget::keyPressEvent(QKeyEvent* e) { bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("qt", e, actions); for (int i = 0; i < actions.size() && !handled; i++) { const QString &action = actions[i]; handled = true; if (action == "SELECT") accept(); else if (action == "ESCAPE") reject(); else if (action == "EDIT") emit editButtonPressed(); else if (action == "DELETE") emit deleteButtonPressed(); else handled = false; } if (!handled) MythDialog::keyPressEvent(e); }
MythDialog* ChannelEditor::dialogWidget(MythMainWindow* parent, const char* widgetName) { dialog = ConfigurationDialog::dialogWidget(parent, widgetName); connect(dialog, SIGNAL(editButtonPressed()), this, SLOT(edit())); connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(del())); return dialog; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); InterfaceController c; MainWindow w; c.window=&w; QObject::connect(&w,SIGNAL(addButtonPressed()),&c,SLOT(callAddFilmDialog())); QObject::connect(&w,SIGNAL(getInfo(QString)),&c,SLOT(callInfoDialog(QString))); QObject::connect(&c,SIGNAL(addFilm(Film)),&w,SLOT(addFilm(Film))); QObject::connect(&w,SIGNAL(editButtonPressed(QString)),&c,SLOT(callEditFilmDialog(QString))); QObject::connect(&c,SIGNAL(editFilm(Film)),&w,SLOT(editFilm(Film))); QObject::connect(&w,SIGNAL(deleteButtonPressed(QString)),&c,SLOT(callDeleteFilmDialog(QString))); c.initTable(); w.show(); return a.exec(); }
DesktopBehavior::DesktopBehavior(KConfig *config, QWidget *parent, const char * ) : DesktopBehaviorBase( parent, "kcmkonq" ), g_pConfig(config) { QString strMouseButton1, strMouseButton3, strButtonTxt1, strButtonTxt3; /* * The text on this form depends on the mouse setting, which can be right * or left handed. The outer button functionality is actually swapped * */ bool leftHandedMouse = ( KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded); m_bHasMedia = KProtocolInfo::isKnownProtocol(QString::fromLatin1("media")); connect(desktopMenuGroup, SIGNAL(clicked(int)), this, SIGNAL(changed())); connect(iconsEnabledBox, SIGNAL(clicked()), this, SLOT(enableChanged())); connect(showHiddenBox, SIGNAL(clicked()), this, SIGNAL(changed())); connect(vrootBox, SIGNAL(clicked()), this, SIGNAL(changed())); connect(autoLineupIconsBox, SIGNAL(clicked()), this, SIGNAL(changed())); connect(toolTipBox, SIGNAL(clicked()), this, SIGNAL(changed())); strMouseButton1 = i18n("&Left button:"); strButtonTxt1 = i18n( "You can choose what happens when" " you click the left button of your pointing device on the desktop:"); strMouseButton3 = i18n("Right b&utton:"); strButtonTxt3 = i18n( "You can choose what happens when" " you click the right button of your pointing device on the desktop:"); if ( leftHandedMouse ) { qSwap(strMouseButton1, strMouseButton3); qSwap(strButtonTxt1, strButtonTxt3); } leftLabel->setText( strMouseButton1 ); leftLabel->setBuddy( leftComboBox ); fillMenuCombo( leftComboBox ); connect(leftEditButton, SIGNAL(clicked()), this, SLOT(editButtonPressed())); connect(leftComboBox, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(leftComboBox, SIGNAL(activated(int)), this, SLOT(comboBoxChanged())); QString wtstr = strButtonTxt1 + i18n(" <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" " <li><em>Window list menu:</em> a menu showing all windows on all" " virtual desktops pops up. You can click on the desktop name to switch" " to that desktop, or on a window name to shift focus to that window," " switching desktops if necessary, and restoring the window if it is" " hidden. Hidden or minimized windows are represented with their names" " in parentheses.</li>" " <li><em>Desktop menu:</em> a context menu for the desktop pops up." " Among other things, this menu has options for configuring the display," " locking the screen, and logging out of KDE.</li>" " <li><em>Application menu:</em> the \"K\" menu pops up. This might be" " useful for quickly accessing applications if you like to keep the" " panel (also known as \"Kicker\") hidden from view.</li></ul>"); QWhatsThis::add( leftLabel, wtstr ); QWhatsThis::add( leftComboBox, wtstr ); middleLabel->setBuddy( middleComboBox ); fillMenuCombo( middleComboBox ); connect(middleEditButton, SIGNAL(clicked()), this, SLOT(editButtonPressed())); connect(middleComboBox, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(middleComboBox, SIGNAL(activated(int)), this, SLOT(comboBoxChanged())); wtstr = i18n("You can choose what happens when" " you click the middle button of your pointing device on the desktop:" " <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" " <li><em>Window list menu:</em> a menu showing all windows on all" " virtual desktops pops up. You can click on the desktop name to switch" " to that desktop, or on a window name to shift focus to that window," " switching desktops if necessary, and restoring the window if it is" " hidden. Hidden or minimized windows are represented with their names" " in parentheses.</li>" " <li><em>Desktop menu:</em> a context menu for the desktop pops up." " Among other things, this menu has options for configuring the display," " locking the screen, and logging out of KDE.</li>" " <li><em>Application menu:</em> the \"K\" menu pops up. This might be" " useful for quickly accessing applications if you like to keep the" " panel (also known as \"Kicker\") hidden from view.</li></ul>"); QWhatsThis::add( middleLabel, wtstr ); QWhatsThis::add( middleComboBox, wtstr ); rightLabel->setText( strMouseButton3 ); rightLabel->setBuddy( rightComboBox ); fillMenuCombo( rightComboBox ); connect(rightEditButton, SIGNAL(clicked()), this, SLOT(editButtonPressed())); connect(rightComboBox, SIGNAL(activated(int)), this, SIGNAL(changed())); connect(rightComboBox, SIGNAL(activated(int)), this, SLOT(comboBoxChanged())); wtstr = strButtonTxt3 + i18n(" <ul><li><em>No action:</em> as you might guess, nothing happens!</li>" " <li><em>Window list menu:</em> a menu showing all windows on all" " virtual desktops pops up. You can click on the desktop name to switch" " to that desktop, or on a window name to shift focus to that window," " switching desktops if necessary, and restoring the window if it is" " hidden. Hidden or minimized windows are represented with their names" " in parentheses.</li>" " <li><em>Desktop menu:</em> a context menu for the desktop pops up." " Among other things, this menu has options for configuring the display," " locking the screen, and logging out of KDE.</li>" " <li><em>Application menu:</em> the \"K\" menu pops up. This might be" " useful for quickly accessing applications if you like to keep the" " panel (also known as \"Kicker\") hidden from view.</li></ul>"); QWhatsThis::add( rightLabel, wtstr ); QWhatsThis::add( rightComboBox, wtstr ); if (m_bHasMedia) { connect(enableMediaBox, SIGNAL(clicked()), this, SLOT(enableChanged())); } else { delete behaviorTab->page(2); } load(); }