void propertySetter::setPredefinedColorListEditor() { QComboBox *editor = new QComboBox(this); editor->insertStringList(CSSEditorGlobals::HTMLColors); connect(editor, SIGNAL(activated(const QString&)), this, SIGNAL(valueChanged(const QString&))); m_list.append(editor); }
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent, const char *) : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) { QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3; QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); QGrid *grid; QGroupBox *box; QLabel *label; QString strMouseButton1, strMouseButton3, strMouseWheel; QString txtButton1, txtButton3, txtButton4; QStringList items; bool leftHandedMouse = (KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded); /** Titlebar doubleclick ************/ QHBoxLayout *hlayout = new QHBoxLayout(layout); label = new QLabel(i18n("&Titlebar double-click:"), this); hlayout->addWidget(label); QWhatsThis::add(label, i18n("Here you can customize mouse click behavior when double clicking on the" " titlebar of a window.")); QComboBox *combo = new QComboBox(this); combo->insertItem(i18n("Maximize")); combo->insertItem(i18n("Maximize (vertical only)")); combo->insertItem(i18n("Maximize (horizontal only)")); combo->insertItem(i18n("Minimize")); combo->insertItem(i18n("Shade")); combo->insertItem(i18n("Lower")); combo->insertItem(i18n("On All Desktops")); combo->insertItem(i18n("Nothing")); combo->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); connect(combo, SIGNAL(activated(int)), SLOT(changed())); hlayout->addWidget(combo); coTiDbl = combo; QWhatsThis::add(combo, i18n("Behavior on <em>double</em> click into the titlebar.")); label->setBuddy(combo); /** Mouse Wheel Events **************/ QHBoxLayout *hlayoutW = new QHBoxLayout(layout); strMouseWheel = i18n("Titlebar wheel event:"); label = new QLabel(strMouseWheel, this); hlayoutW->addWidget(label); txtButton4 = i18n("Handle mouse wheel events"); QWhatsThis::add(label, txtButton4); // Titlebar and frame mouse Wheel QComboBox *comboW = new QComboBox(this); comboW->insertItem(i18n("Raise/Lower")); comboW->insertItem(i18n("Shade/Unshade")); comboW->insertItem(i18n("Maximize/Restore")); comboW->insertItem(i18n("Keep Above/Below")); comboW->insertItem(i18n("Move to Previous/Next Desktop")); comboW->insertItem(i18n("Change Opacity")); comboW->insertItem(i18n("Nothing")); comboW->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); connect(comboW, SIGNAL(activated(int)), SLOT(changed())); hlayoutW->addWidget(comboW); coTiAct4 = comboW; QWhatsThis::add(comboW, txtButton4); label->setBuddy(comboW); /** Titlebar and frame **************/ box = new QVGroupBox(i18n("Titlebar && Frame"), this, "Titlebar and Frame"); box->layout()->setMargin(KDialog::marginHint()); box->layout()->setSpacing(KDialog::spacingHint()); layout->addWidget(box); QWhatsThis::add(box, i18n("Here you can customize mouse click behavior when clicking on the" " titlebar or the frame of a window.")); grid = new QGrid(4, Qt::Vertical, box); new QLabel(grid); // dummy strMouseButton1 = i18n("Left button:"); txtButton1 = i18n( "In this row you can customize left click behavior when clicking into" " the titlebar or the frame."); strMouseButton3 = i18n("Right button:"); txtButton3 = i18n( "In this row you can customize right click behavior when clicking into" " the titlebar or the frame."); if(leftHandedMouse) { qSwap(strMouseButton1, strMouseButton3); qSwap(txtButton1, txtButton3); } label = new QLabel(strMouseButton1, grid); QWhatsThis::add(label, txtButton1); label = new QLabel(i18n("Middle button:"), grid); QWhatsThis::add(label, i18n("In this row you can customize middle click behavior when clicking into" " the titlebar or the frame.")); label = new QLabel(strMouseButton3, grid); QWhatsThis::add(label, txtButton3); label = new QLabel(i18n("Active"), grid); label->setAlignment(AlignCenter); QWhatsThis::add(label, i18n("In this column you can customize mouse clicks into the titlebar" " or the frame of an active window.")); // Titlebar and frame, active, mouse button 1 combo = new QComboBox(grid); combo->insertItem(i18n("Raise")); combo->insertItem(i18n("Lower")); combo->insertItem(i18n("Operations Menu")); combo->insertItem(i18n("Toggle Raise & Lower")); combo->insertItem(i18n("Nothing")); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiAct1 = combo; txtButton1 = i18n( "Behavior on <em>left</em> click into the titlebar or frame of an " "<em>active</em> window."); txtButton3 = i18n( "Behavior on <em>right</em> click into the titlebar or frame of an " "<em>active</em> window."); // Be nice to left handed users if(leftHandedMouse) qSwap(txtButton1, txtButton3); QWhatsThis::add(combo, txtButton1); // Titlebar and frame, active, mouse button 2 items << i18n("Raise") << i18n("Lower") << i18n("Operations Menu") << i18n("Toggle Raise & Lower") << i18n("Nothing") << i18n("Shade"); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiAct2 = combo; QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window.")); // Titlebar and frame, active, mouse button 3 combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiAct3 = combo; QWhatsThis::add(combo, txtButton3); txtButton1 = i18n( "Behavior on <em>left</em> click into the titlebar or frame of an " "<em>inactive</em> window."); txtButton3 = i18n( "Behavior on <em>right</em> click into the titlebar or frame of an " "<em>inactive</em> window."); // Be nice to left handed users if(leftHandedMouse) qSwap(txtButton1, txtButton3); label = new QLabel(i18n("Inactive"), grid); label->setAlignment(AlignCenter); QWhatsThis::add(label, i18n("In this column you can customize mouse clicks into the titlebar" " or the frame of an inactive window.")); items.clear(); items << i18n("Activate & Raise") << i18n("Activate & Lower") << i18n("Activate") << i18n("Shade") << i18n("Operations Menu") << i18n("Raise") << i18n("Lower") << i18n("Nothing"); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiInAct1 = combo; QWhatsThis::add(combo, txtButton1); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiInAct2 = combo; QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window.")); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coTiInAct3 = combo; QWhatsThis::add(combo, txtButton3); /** Maximize Button ******************/ box = new QHGroupBox(i18n("Maximize Button"), this, "Maximize Button"); box->layout()->setMargin(KDialog::marginHint()); box->layout()->setSpacing(KDialog::spacingHint()); layout->addWidget(box); QWhatsThis::add(box, i18n("Here you can customize behavior when clicking on the maximize button.")); QString strMouseButton[] = {i18n("Left button:"), i18n("Middle button:"), i18n("Right button:")}; QString txtButton[] = {i18n("Behavior on <em>left</em> click onto the maximize button."), i18n("Behavior on <em>middle</em> click onto the maximize button."), i18n("Behavior on <em>right</em> click onto the maximize button.")}; if(leftHandedMouse) // Be nice to lefties { qSwap(strMouseButton[0], strMouseButton[2]); qSwap(txtButton[0], txtButton[2]); } createMaxButtonPixmaps(); for(int b = 0; b < 3; ++b) { if(b != 0) new QWidget(box); // Spacer QLabel *label = new QLabel(strMouseButton[b], box); QWhatsThis::add(label, txtButton[b]); label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum)); coMax[b] = new ToolTipComboBox(box, tbl_Max); for(int t = 0; t < 3; ++t) coMax[b]->insertItem(maxButtonPixmaps[t]); connect(coMax[b], SIGNAL(activated(int)), SLOT(changed())); connect(coMax[b], SIGNAL(activated(int)), coMax[b], SLOT(changed())); QWhatsThis::add(coMax[b], txtButton[b]); coMax[b]->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum)); } connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged())); layout->addStretch(); load(); }
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent, const char *) : KCModule(parent, "kcmkwm"), config(_config), standAlone(_standAlone) { QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW; QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); QGrid *grid; QGroupBox *box; QLabel *label; QString strMouseButton1, strMouseButton3; QString txtButton1, txtButton3; QStringList items; bool leftHandedMouse = (KGlobalSettings::mouseSettings().handed == KGlobalSettings::KMouseSettings::LeftHanded); /** Inactive inner window ******************/ box = new QVGroupBox(i18n("Inactive Inner Window"), this, "Inactive Inner Window"); box->layout()->setMargin(KDialog::marginHint()); box->layout()->setSpacing(KDialog::spacingHint()); layout->addWidget(box); QWhatsThis::add(box, i18n("Here you can customize mouse click behavior when clicking on an inactive" " inner window ('inner' means: not titlebar, not frame).")); grid = new QGrid(3, Qt::Vertical, box); strMouseButton1 = i18n("Left button:"); txtButton1 = i18n( "In this row you can customize left click behavior when clicking into" " the titlebar or the frame."); strMouseButton3 = i18n("Right button:"); txtButton3 = i18n( "In this row you can customize right click behavior when clicking into" " the titlebar or the frame."); if(leftHandedMouse) { qSwap(strMouseButton1, strMouseButton3); qSwap(txtButton1, txtButton3); } strWin1 = i18n( "In this row you can customize left click behavior when clicking into" " an inactive inner window ('inner' means: not titlebar, not frame)."); strWin3 = i18n( "In this row you can customize right click behavior when clicking into" " an inactive inner window ('inner' means: not titlebar, not frame)."); // Be nice to lefties if(leftHandedMouse) qSwap(strWin1, strWin3); label = new QLabel(strMouseButton1, grid); QWhatsThis::add(label, strWin1); label = new QLabel(i18n("Middle button:"), grid); strWin2 = i18n( "In this row you can customize middle click behavior when clicking into" " an inactive inner window ('inner' means: not titlebar, not frame)."); QWhatsThis::add(label, strWin2); label = new QLabel(strMouseButton3, grid); QWhatsThis::add(label, strWin3); items.clear(); items << i18n("Activate, Raise & Pass Click") << i18n("Activate & Pass Click") << i18n("Activate") << i18n("Activate & Raise"); QComboBox *combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coWin1 = combo; QWhatsThis::add(combo, strWin1); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coWin2 = combo; QWhatsThis::add(combo, strWin2); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coWin3 = combo; QWhatsThis::add(combo, strWin3); /** Inner window, titlebar and frame **************/ box = new QVGroupBox(i18n("Inner Window, Titlebar && Frame"), this, "Inner Window, Titlebar and Frame"); box->layout()->setMargin(KDialog::marginHint()); box->layout()->setSpacing(KDialog::spacingHint()); layout->addWidget(box); QWhatsThis::add(box, i18n("Here you can customize KDE's behavior when clicking somewhere into" " a window while pressing a modifier key.")); grid = new QGrid(5, Qt::Vertical, box); // Labels label = new QLabel(i18n("Modifier key:"), grid); strAllKey = i18n( "Here you select whether holding the Meta key or Alt key " "will allow you to perform the following actions."); QWhatsThis::add(label, strAllKey); strMouseButton1 = i18n("Modifier key + left button:"); strAll1 = i18n( "In this row you can customize left click behavior when clicking into" " the titlebar or the frame."); strMouseButton3 = i18n("Modifier key + right button:"); strAll3 = i18n( "In this row you can customize right click behavior when clicking into" " the titlebar or the frame."); if(leftHandedMouse) { qSwap(strMouseButton1, strMouseButton3); qSwap(strAll1, strAll3); } label = new QLabel(strMouseButton1, grid); QWhatsThis::add(label, strAll1); label = new QLabel(i18n("Modifier key + middle button:"), grid); strAll2 = i18n( "Here you can customize KDE's behavior when middle clicking into a window" " while pressing the modifier key."); QWhatsThis::add(label, strAll2); label = new QLabel(strMouseButton3, grid); QWhatsThis::add(label, strAll3); label = new QLabel(i18n("Modifier key + mouse wheel:"), grid); strAllW = i18n( "Here you can customize KDE's behavior when scrolling with the mouse wheel" " in a window while pressing the modifier key."); QWhatsThis::add(label, strAllW); // Combo's combo = new QComboBox(grid); combo->insertItem(i18n("Meta")); combo->insertItem(i18n("Alt")); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coAllKey = combo; QWhatsThis::add(combo, strAllKey); items.clear(); items << i18n("Move") << i18n("Activate, Raise and Move") << i18n("Toggle Raise & Lower") << i18n("Resize") << i18n("Raise") << i18n("Lower") << i18n("Minimize") << i18n("Nothing"); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coAll1 = combo; QWhatsThis::add(combo, strAll1); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coAll2 = combo; QWhatsThis::add(combo, strAll2); combo = new QComboBox(grid); combo->insertStringList(items); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coAll3 = combo; QWhatsThis::add(combo, strAll3); combo = new QComboBox(grid); combo->insertItem(i18n("Raise/Lower")); combo->insertItem(i18n("Shade/Unshade")); combo->insertItem(i18n("Maximize/Restore")); combo->insertItem(i18n("Keep Above/Below")); combo->insertItem(i18n("Move to Previous/Next Desktop")); combo->insertItem(i18n("Change Opacity")); combo->insertItem(i18n("Nothing")); connect(combo, SIGNAL(activated(int)), SLOT(changed())); coAllW = combo; QWhatsThis::add(combo, strAllW); layout->addStretch(); load(); }
Kleo::KeyApprovalDialog::KeyApprovalDialog( const std::vector<Item> & recipients, const std::vector<GpgME::Key> & sender, QWidget * parent, const char * name, bool modal ) : KDialogBase( parent, name, modal, i18n("Encryption Key Approval"), Ok|Cancel, Ok ), d( 0 ) { assert( !recipients.empty() ); d = new Private(); QFrame *page = makeMainWidget(); QVBoxLayout * vlay = new QVBoxLayout( page, 0, spacingHint() ); vlay->addWidget( new QLabel( i18n("The following keys will be used for encryption:"), page ) ); QScrollView * sv = new QScrollView( page ); sv->setResizePolicy( QScrollView::AutoOneFit ); vlay->addWidget( sv ); QWidget * view = new QWidget( sv->viewport() ); QGridLayout * glay = new QGridLayout( view, 3, 2, marginHint(), spacingHint() ); glay->setColStretch( 1, 1 ); sv->addChild( view ); int row = -1; if ( !sender.empty() ) { ++row; glay->addWidget( new QLabel( i18n("Your keys:"), view ), row, 0 ); d->selfRequester = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view ); d->selfRequester->setKeys( sender ); glay->addWidget( d->selfRequester, row, 1 ); ++row; glay->addMultiCellWidget( new KSeparator( Horizontal, view ), row, row, 0, 1 ); } const QStringList prefs = preferencesStrings(); for ( std::vector<Item>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) { ++row; glay->addWidget( new QLabel( i18n("Recipient:"), view ), row, 0 ); glay->addWidget( new QLabel( it->address, view ), row, 1 ); d->addresses.push_back( it->address ); ++row; glay->addWidget( new QLabel( i18n("Encryption keys:"), view ), row, 0 ); KeyRequester * req = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view ); req->setKeys( it->keys ); glay->addWidget( req, row, 1 ); d->requesters.push_back( req ); ++row; glay->addWidget( new QLabel( i18n("Encryption preference:"), view ), row, 0 ); QComboBox * cb = new QComboBox( false, view ); cb->insertStringList( prefs ); glay->addWidget( cb, row, 1 ); cb->setCurrentItem( pref2cb( it->pref ) ); connect( cb, SIGNAL(activated(int)), SLOT(slotPrefsChanged()) ); d->preferences.push_back( cb ); } // calculate the optimal width for the dialog const int dialogWidth = marginHint() + sv->frameWidth() + view->sizeHint().width() + sv->verticalScrollBar()->sizeHint().width() + sv->frameWidth() + marginHint() + 2; // calculate the optimal height for the dialog const int dialogHeight = marginHint() + fontMetrics().height() + spacingHint() + sv->frameWidth() + view->sizeHint().height() + sv->horizontalScrollBar()->sizeHint().height() + sv->frameWidth() + spacingHint() + actionButton( KDialogBase::Cancel )->sizeHint().height() + marginHint() + 2; // don't make the dialog too large const QRect desk = KGlobalSettings::desktopGeometry( this ); setInitialSize( QSize( kMin( dialogWidth, 3 * desk.width() / 4 ), kMin( dialogHeight, 7 * desk.height() / 8 ) ) ); }
GroupEditor::GroupEditor(ConfigEstateGroupList *newList, QWidget *parent) : KDialogBase(KDialogBase::Plain, i18n("Group Editor"), Ok|Apply|Cancel, Ok, parent, "Group Editor", false, true), mylist(*newList) { setWFlags(WDestructiveClose); list = newList; QFrame *page = plainPage(); QHBoxLayout *hlayout = new QHBoxLayout(page, marginHint(), spacingHint()); groups = new KListBox(page); hlayout->addWidget(groups); connect(groups, SIGNAL(highlighted(QListBoxItem *)), this, SLOT(updateSettings(QListBoxItem *))); QStringList newgroups; for (ConfigEstateGroupList::Iterator it = list->begin(); it != list->end(); ++it) newgroups.append((*it).name()); groups->insertStringList(newgroups); connect(groups, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); QVBoxLayout *vlayout = new QVBoxLayout(hlayout, spacingHint()); colorGroupBox = new QVGroupBox(i18n("&Colors"), page); vlayout->addWidget(colorGroupBox); (void) new QLabel(i18n("Foreground:"), colorGroupBox); fgButton = new KColorButton(colorGroupBox, "Foreground Button"); connect(fgButton, SIGNAL(changed(const QColor &)), this, SLOT(fgChanged(const QColor &))); connect(fgButton, SIGNAL(changed(const QColor &)), this, SIGNAL(changed())); (void) new QLabel(i18n("Background:"), colorGroupBox); bgButton = new KColorButton(colorGroupBox, "Background Button"); connect(bgButton, SIGNAL(changed(const QColor &)), this, SLOT(bgChanged(const QColor &))); connect(bgButton, SIGNAL(changed(const QColor &)), this, SIGNAL(changed())); pricesGroupBox = new QVGroupBox(i18n("&Prices"), page); vlayout->addWidget(pricesGroupBox); pricesWidget = new QWidget(pricesGroupBox); QGridLayout *pricesLayout = new QGridLayout(pricesWidget, 2, 2, 0, spacingHint()); pricesLayout->addWidget(new QLabel(i18n("House price:"), pricesWidget), 0, 0); pricesLayout->addWidget(housePrice = new QSpinBox(0, 3000, 25, pricesWidget), 0, 1); housePrice->setSpecialValueText(i18n("None")); housePrice->setSuffix(i18n("$")); connect(housePrice, SIGNAL(valueChanged(int)), this, SLOT(housePriceChanged(int))); pricesLayout->addWidget(new QLabel(i18n("Global price:"), pricesWidget), 1, 0); pricesLayout->addWidget(globalPrice = new QSpinBox(0, 3000, 25, pricesWidget), 1, 1); globalPrice->setSpecialValueText(i18n("None")); globalPrice->setSuffix(i18n("$")); connect(globalPrice, SIGNAL(valueChanged(int)), this, SLOT(globalPriceChanged(int))); dynamicGroupBox = new QVGroupBox(i18n("&Dynamic Rent"), page); vlayout->addWidget(dynamicGroupBox); mathWidget = new QWidget(dynamicGroupBox); QGridLayout *mathLayout = new QGridLayout(mathWidget, 2, 2, 0, spacingHint()); mathLayout->addWidget(new QLabel(i18n("Add rent variable:"), mathWidget), 0, 0); mathLayout->addWidget(new QLabel(i18n("Expression:"), mathWidget), 1, 0); QComboBox *rentVarCombo = new QComboBox(mathWidget); QStringList vars; vars << "DICE"; vars << "HOUSES"; vars << "GROUPOWNED"; rentVarCombo->insertStringList(vars); mathLayout->addWidget(rentVarCombo, 0, 1); rentMathEdit = new KLineEdit(mathWidget); connect(rentMathEdit, SIGNAL(textChanged(const QString &)), this, SLOT(rentMathChanged(const QString &))); connect(rentVarCombo, SIGNAL(activated(const QString &)), rentMathEdit, SLOT(insert(const QString &))); mathLayout->addWidget(rentMathEdit, 1, 1); QHBoxLayout *buttonlayout = new QHBoxLayout(vlayout, spacingHint()); KPushButton *addB = new KPushButton(i18n("&Add..."), page); buttonlayout->addWidget(addB); connect(addB, SIGNAL(clicked()), this, SLOT(add())); removeB = new KPushButton(i18n("&Remove"), page); buttonlayout->addWidget(removeB); connect(removeB, SIGNAL(clicked()), this, SLOT(remove())); selectionChanged(); }