Ejemplo n.º 1
0
// BEGIN KMimeTypeChooser
KMimeTypeChooser::KMimeTypeChooser(const QString &text, const QStringList &selMimeTypes, const QString &defaultGroup, const QStringList &groupsToShow,
                                   int visuals, QWidget *parent, const char *name)
    : QVBox(parent, name)
{
    d = new KMimeTypeChooserPrivate();
    d->lvMimeTypes = 0;
    d->btnEditMimeType = 0;
    d->defaultgroup = defaultGroup;
    d->groups = groupsToShow;
    d->visuals = visuals;

    setSpacing(KDialogBase::spacingHint());

    if(!text.isEmpty())
    {
        new QLabel(text, this);
    }

    d->lvMimeTypes = new KListView(this);

    d->lvMimeTypes->addColumn(i18n("Mime Type"));
    //   d->lvMimeTypes->setColumnWidthMode( 0, QListView::Manual );

    if(visuals & Comments)
    {
        d->lvMimeTypes->addColumn(i18n("Comment"));
        d->lvMimeTypes->setColumnWidthMode(1, QListView::Manual);
    }
    if(visuals & Patterns)
        d->lvMimeTypes->addColumn(i18n("Patterns"));

    d->lvMimeTypes->setRootIsDecorated(true);

    loadMimeTypes(selMimeTypes);

    if(visuals & KMimeTypeChooser::EditButton)
    {
        QHBox *btns = new QHBox(this);
        ((QBoxLayout *)btns->layout())->addStretch(1);
        d->btnEditMimeType = new QPushButton(i18n("&Edit..."), btns);

        connect(d->btnEditMimeType, SIGNAL(clicked()), this, SLOT(editMimeType()));
        d->btnEditMimeType->setEnabled(false);
        connect(d->lvMimeTypes, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editMimeType()));
        connect(d->lvMimeTypes, SIGNAL(currentChanged(QListViewItem *)), this, SLOT(slotCurrentChanged(QListViewItem *)));

        QWhatsThis::add(d->btnEditMimeType, i18n("Click this button to display the familiar KDE mime type editor."));
    }
Ejemplo n.º 2
0
void QmvItem::createResetButton()
{
    if ( resetButton ) {
	resetButton->parentWidget()->lower();
	return;
    }
    QHBox *hbox = new QHBox( listview->viewport() );
    hbox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
    hbox->setLineWidth( 1 );
    resetButton = new QPushButton( hbox );
    resetButton->setPixmap( QPixmap(resetproperty_xpm));
    resetButton->setFixedWidth( resetButton->sizeHint().width() );
    hbox->layout()->setAlignment( Qt::AlignRight );
    listview->addChild( hbox );
    hbox->hide();
    QObject::connect( resetButton, SIGNAL( clicked() ),
		      listview, SLOT( resetAttribute() ) );
    QToolTip::add( resetButton, QmvEditor::tr( "Reset attribute to its default value" ) );
    QWhatsThis::add( resetButton,
                     QmvEditor::tr( "Click this button to reset the Attribute"
                                           "to its default value" ) );
    updateResetButtonState();
}
Ejemplo n.º 3
0
KRandRModule::KRandRModule(QWidget *parent, const char *name, const QStringList&)
    : KCModule(parent, name)
	, m_changed(false)
{
	if (!isValid()) {
		QVBoxLayout *topLayout = new QVBoxLayout(this);
		topLayout->addWidget(new QLabel(i18n("<qt>Your X server does not support resizing and rotating the display. Please update to version 4.3 or greater. You need the X Resize And Rotate extension (RANDR) version 1.1 or greater to use this feature.</qt>"), this));
		kdWarning() << "Error: " << errorCode() << endl;
		return;
	}

	QVBoxLayout* topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());

	QHBox* screenBox = new QHBox(this);
	topLayout->addWidget(screenBox);
	QLabel *screenLabel = new QLabel(i18n("Settings for screen:"), screenBox);
	m_screenSelector = new KComboBox(screenBox);

	for (int s = 0; s < numScreens(); s++) {
		m_screenSelector->insertItem(i18n("Screen %1").arg(s+1));
	}

	m_screenSelector->setCurrentItem(currentScreenIndex());
        screenLabel->setBuddy( m_screenSelector );
	QWhatsThis::add(m_screenSelector, i18n("The screen whose settings you would like to change can be selected using this drop-down list."));

	connect(m_screenSelector, SIGNAL(activated(int)), SLOT(slotScreenChanged(int)));

	if (numScreens() <= 1)
		m_screenSelector->setEnabled(false);

	QHBox* sizeBox = new QHBox(this);
	topLayout->addWidget(sizeBox);
	QLabel *sizeLabel = new QLabel(i18n("Screen size:"), sizeBox);
	m_sizeCombo = new KComboBox(sizeBox);
	QWhatsThis::add(m_sizeCombo, i18n("The size, otherwise known as the resolution, of your screen can be selected from this drop-down list."));
	connect(m_sizeCombo, SIGNAL(activated(int)), SLOT(slotSizeChanged(int)));
        sizeLabel->setBuddy( m_sizeCombo );

	QHBox* refreshBox = new QHBox(this);
	topLayout->addWidget(refreshBox);
	QLabel *rateLabel = new QLabel(i18n("Refresh rate:"), refreshBox);
	m_refreshRates = new KComboBox(refreshBox);
	QWhatsThis::add(m_refreshRates, i18n("The refresh rate of your screen can be selected from this drop-down list."));
	connect(m_refreshRates, SIGNAL(activated(int)), SLOT(slotRefreshChanged(int)));
        rateLabel->setBuddy( m_refreshRates );

	m_rotationGroup = new QButtonGroup(2, Qt::Horizontal, i18n("Orientation (degrees counterclockwise)"), this);
	topLayout->addWidget(m_rotationGroup);
	m_rotationGroup->setRadioButtonExclusive(true);
	QWhatsThis::add(m_rotationGroup, i18n("The options in this section allow you to change the rotation of your screen."));

	m_applyOnStartup = new QCheckBox(i18n("Apply settings on KDE startup"), this);
	topLayout->addWidget(m_applyOnStartup);
	QWhatsThis::add(m_applyOnStartup, i18n("If this option is enabled the size and orientation settings will be used when KDE starts."));
	connect(m_applyOnStartup, SIGNAL(clicked()), SLOT(setChanged()));

	QHBox* syncBox = new QHBox(this);
	syncBox->layout()->addItem(new QSpacerItem(20, 1, QSizePolicy::Maximum));
	m_syncTrayApp = new QCheckBox(i18n("Allow tray application to change startup settings"), syncBox);
	topLayout->addWidget(syncBox);
	QWhatsThis::add(m_syncTrayApp, i18n("If this option is enabled, options set by the system tray applet will be saved and loaded when KDE starts instead of being temporary."));
	connect(m_syncTrayApp, SIGNAL(clicked()), SLOT(setChanged()));

	topLayout->addStretch(1);

	// just set the "apply settings on startup" box
	load();
	m_syncTrayApp->setEnabled(m_applyOnStartup->isChecked());

	slotScreenChanged(QApplication::desktop()->primaryScreen());

	setButtons(KCModule::Apply);
}