Esempio n. 1
0
void kdvi::makeToolBar2(QWidget *parent)
{
    QPixmap pm;

    toolBar2 = new QFrame( parent );

    QBoxLayout * gl = new QBoxLayout( toolBar2, QBoxLayout::Down );

    sbox = new ScrollBox( toolBar2 );
    connect( sbox, SIGNAL(valueChanged(QPoint)),
             dviwin, SLOT(scroll(QPoint)) );
    connect( sbox, SIGNAL(button3Pressed()), dviwin, SLOT(nextPage()) );
    connect( sbox, SIGNAL(button2Pressed()), dviwin, SLOT(prevPage()) );
    connect( dviwin, SIGNAL(pageSizeChanged( QSize )),
             sbox, SLOT(setPageSize( QSize )) );
    connect( dviwin, SIGNAL(viewSizeChanged( QSize )),
             sbox, SLOT(setViewSize( QSize )) );
    connect( dviwin, SIGNAL(currentPosChanged( QPoint )),
             sbox, SLOT(setViewPos( QPoint )) );
    QToolTip::add( sbox, 0, tipgroup, i18n("Scroll window and switch the page") );
    sbox->setFixedSize(70,80);
    gl->addWidget( sbox );

    // Create a MarkList

    marklist = new MarkList( toolBar2 );
    connect( marklist, SIGNAL(selected(const char *)),
             SLOT(pageActivated(const char *)) );
    QToolTip::add( marklist, 0, tipgroup, i18n("Select page and mark pages for printing") );

    gl->addWidget( marklist );
    gl->activate();

    sbox->setPageSize( dviwin->pageSize() );
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
About::About (QWidget * aParent, const char *aName, bool aInit)
  : AboutInherited(aParent, aName)
{
  QBoxLayout* box;
  QLabel* lbl;
  QFrame* frm;
  QString str;
  QFont fnt;

  if (aInit) return;

  box = new QVBoxLayout(this, 20, 6);

  lblTheme = new QLabel(" ", this);
  fnt = lblTheme->font();
  fnt.setPointSize(fnt.pointSize() * 1.2);
  lblTheme->setFont(fnt);
  lblTheme->setMinimumSize(lblTheme->sizeHint());
  lblTheme->setAutoResize(true);
  box->addWidget(lblTheme);

  lblVersion = new QLabel(" ", this);
  lblVersion->setMinimumSize(lblVersion->sizeHint());
  lblVersion->setAutoResize(true);
  box->addWidget(lblVersion);

  lblAuthor = new QLabel(" ", this);
  lblAuthor->setMinimumSize(lblAuthor->sizeHint());
  lblAuthor->setAutoResize(true);
  box->addWidget(lblAuthor);

  lblHomepage = new QLabel(" ", this);
  lblHomepage->setMinimumSize(lblHomepage->sizeHint());
  lblHomepage->setAutoResize(true);
  box->addWidget(lblHomepage);

  frm = new QFrame(this);
  frm->setFrameStyle(QFrame::HLine|QFrame::Raised);
  box->addSpacing(5);
  box->addWidget(frm);
  box->addSpacing(5);

  lbl = new QLabel(i18n("KDE Theme Manager"), this);
  lbl->setFont(fnt);
  lbl->setMinimumSize(lbl->sizeHint());
  box->addWidget(lbl);

  str.sprintf(i18n("Version %s\n\n"
		   "Copyright (C) 1998 by\n%s\n\n"
		   "Gnu Public License (GPL)"),
	           KTHEME_VERSION, 
                   "Stefan Taferner <*****@*****.**>\n"
                   "Waldo Bastian <*****@*****.**>");
  lbl = new QLabel(str, this);
  lbl->setMinimumSize(lbl->sizeHint());
  box->addWidget(lbl);

  box->addStretch(1000);
  box->activate();
}
Esempio n. 3
0
CcaseCommentDlg::CcaseCommentDlg(bool bCheckin)
  : QDialog(0, "", true)
{
  setCaption( i18n("Clearcase Comment") );

  QBoxLayout *layout = new QVBoxLayout(this, 10);

  QLabel *messagelabel = new QLabel(i18n("Enter log message:"), this);
  messagelabel->setMinimumSize(messagelabel->sizeHint());
  layout->addWidget(messagelabel, 0);

  _edit = new QMultiLineEdit(this);
  QFontMetrics fm(_edit->fontMetrics());
  _edit->setMinimumSize(fm.width("0")*40, fm.lineSpacing()*3);
  layout->addWidget(_edit, 10);

  QBoxLayout *layout2 = new QHBoxLayout(layout);
  if(bCheckin) {
    _check = new QCheckBox(i18n("Reserve"), this);
    layout2->addWidget(_check);
  }

  KButtonBox *buttonbox = new KButtonBox(this);
  buttonbox->addStretch();
  QPushButton *ok = buttonbox->addButton(KStdGuiItem::ok());
  QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
  connect(ok, SIGNAL(clicked()), SLOT(accept()) );
  connect(cancel, SIGNAL(clicked()), SLOT(reject()) );
  ok->setDefault(true);
  buttonbox->layout();
  layout2->addWidget(buttonbox, 0);

  layout->activate();
  adjustSize();
}
Esempio n. 4
0
bool QBoxLayoutProto::activate()
{
  QBoxLayout *item = qscriptvalue_cast<QBoxLayout*>(thisObject());
  if (item)
    return item->activate();
  return false;
}
Esempio n. 5
0
MainWidget::MainWidget( QWidget* parent, const char* name )
    : QFrame( parent, name )
{
    QBoxLayout *grid = new QHBoxLayout( this, 5 );     //(rows,col)
    bPainter = new BallPainter();

    lsb = new LinesBoard(bPainter, this);
    grid->addWidget( lsb );

    QBoxLayout *right = new QVBoxLayout(grid, 2);
    QLabel *label = new QLabel(i18n("Next balls:"), this);
    lPrompt = new LinesPrompt(bPainter, this);
    connect(lPrompt, SIGNAL(PromptPressed()), parent, SLOT(switchPrompt()));

    right->addWidget( label, 0, Qt::AlignBottom | Qt::AlignHCenter );
    right->addWidget( lPrompt, 0, Qt::AlignTop | Qt::AlignHCenter );

    grid->activate();
    grid->freeze(0,0);

//    warning("width: %i height: %i", width(), height() );

//    warning("wh: %i hh: %i", sizeHint().width(), sizeHint().height() );

}
Esempio n. 6
0
SaveScm::SaveScm( QWidget *parent, const char *name )
	: QDialog( parent, name, TRUE )
{
	setFocusPolicy(QWidget::StrongFocus);
	setCaption( i18n("Add a color scheme"));
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10 );

	QBoxLayout *stackLayout = new QVBoxLayout( 3 );
	topLayout->addLayout( stackLayout );

	nameLine = new QLineEdit( this );
	nameLine->setFocus();
	nameLine->setMaxLength(18);
	nameLine->setFixedHeight( nameLine->sizeHint().height() );
	
	QLabel* tmpQLabel;
	tmpQLabel = new QLabel( nameLine, 
			i18n( "&Enter a name for the new color scheme\n"\
					"to be added to your personal list.\n\n"\
					"The colors currently used in the preview will\n"\
					"be copied into this scheme to begin with." ), this );
	tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix );
	tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() );
	tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() );
	
	stackLayout->addStretch( 10 );
	stackLayout->addWidget( tmpQLabel );
	stackLayout->addWidget( nameLine );
	
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this );
	tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
	tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
	
	topLayout->addWidget( tmpQFrame );
	
	KButtonBox *bbox = new KButtonBox( this );
	bbox->addStretch( 10 );
	
	QPushButton *ok = bbox->addButton( i18n( "&OK" ) );
	connect( ok, SIGNAL( clicked() ), SLOT( accept() ) );
	
	QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) );
	connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
	
	bbox->layout();
	topLayout->addWidget( bbox );

    topLayout->activate();
	
	resize( 250, 0 );
}
Esempio n. 7
0
Frame::Frame(QWidget* parent, const char* name): QFrame(parent, name){
    button1 = new QPushButton("Simple Popup", this);
    connect ( button1, SIGNAL( clicked() ), SLOT( button1Clicked() ) );
    button2 = new QPushButton("Fancy Popup", this);
    connect ( button2, SIGNAL( pressed() ), SLOT( button2Pressed() ) );

    QBoxLayout * l = new QHBoxLayout( this );
    button1->setMaximumSize(button1->sizeHint());
    button2->setMaximumSize(button2->sizeHint());
    l->addWidget( button1 );
    l->addWidget( button2 );
    l->activate();

//     button1->setGeometry(20,20,100,30);
//     button2->setGeometry(140,20,100,30);
    resize(270, 70);

    //create a very simple popup: it is just composed with other
    //widget and will be shown after clicking on button1

    popup1 = new QFrame( this ,0, WType_Popup);
    popup1->setFrameStyle( WinPanel|Raised );
    popup1->resize(150,100);
    QLineEdit *tmpE = new QLineEdit( popup1 );
    connect( tmpE, SIGNAL( returnPressed() ), popup1, SLOT( hide() ) );
    tmpE->setGeometry(10,10, 130, 30);
    tmpE->setFocus();
    QPushButton *tmpB = new QPushButton("Click me!", popup1);
    connect( tmpB, SIGNAL( clicked() ), popup1, SLOT( close() ) );
    tmpB->setGeometry(10, 50, 130, 30);

    // the fancier version uses its own class. It will be shown when
    // pressing button2, so they behavior is more like a modern menu
    // or toolbar.

    popup2 = new FancyPopup( this );

    // you might also add new widgets to the popup, just like you do
    // it with any other widget.  The next four lines (if not
    // commented out) will for instance add a line edit widget.

//     tmpE = new QLineEdit( popup2 );
//     tmpE->setFocus();
//     connect( tmpE, SIGNAL( returnPressed() ), popup2, SLOT( close() ) );
//     tmpE->setGeometry(10, 10, 130, 30);
}
Esempio n. 8
0
int main(int argc, char **argv)
{
   QApplication app(argc, argv);
   
   QWidget *toplevel = new QWidget();
   
   QBoxLayout *mainbox = new QBoxLayout(toplevel, QBoxLayout::TopToBottom, 10);
   
   KSeparator *sep1 = new KSeparator( KSeparator::VLine, toplevel );
   mainbox->addWidget(sep1);
   
   KSeparator *sep2 = new KSeparator( KSeparator::HLine, toplevel );
   mainbox->addWidget(sep2);
   
   mainbox->activate();
   
   app.setMainWidget(toplevel);
   toplevel->show();
   return app.exec();
}
Esempio n. 9
0
KKeyDialog::KKeyDialog( QDict<KKeyEntry> *aKeyDict, QWidget *parent )
    : QDialog( parent, 0, TRUE )
{
	setCaption(i18n("Configure key bindings"));
	setFocusPolicy( QWidget::StrongFocus );
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10 ); 
	
	KKeyChooser *kc =  new KKeyChooser( aKeyDict, this );
	
	topLayout->addWidget( kc, 10 );
	
	// CREATE BUTTONS
	
	KButtonBox *bbox = new KButtonBox( this );
	
	bHelp = bbox->addButton( i18n("&Help") );
	//connect( bHelp, SIGNAL(clicked()), SLOT(help()) );
	bHelp->setEnabled( false );
	
	bDefaults = bbox->addButton( i18n("&Defaults") );
	connect( bDefaults, SIGNAL(clicked()), kc, SLOT(allDefault()) );
	//bDefaults->setEnabled( false );
	
	bbox->addStretch( 10 );
		
	bOk = bbox->addButton( i18n("&OK") );
	connect( bOk, SIGNAL(clicked()), SLOT(accept()) );
	
	bCancel = bbox->addButton( i18n("&Cancel") );
	connect( bCancel, SIGNAL(clicked()), SLOT(reject()) );
		
	bbox->layout();
	topLayout->addWidget( bbox );
	
	topLayout->activate();
	
	resize( 400, 350 );
}
Esempio n. 10
0
void KDMSessionsWidget::setupPage(QWidget *)
{
      QGroupBox *group0 = new QGroupBox( i18n("Allow to shutdown"), this );

      sdcombo = new QComboBox( FALSE, group0 );
      connect(sdcombo, SIGNAL(highlighted(int)), SLOT(slotSetAllowShutdown(int)));
      sdcombo->insertItem(klocale->translate("None"), 0);
      sdcombo->insertItem(klocale->translate("All"), 1);
      sdcombo->insertItem(klocale->translate("Root Only"), 2);
      sdcombo->insertItem(klocale->translate("Console Only"), 3);
      sdcombo->setCurrentItem(sdMode);
      sdcombo->setFixedSize(sdcombo->sizeHint());

      QGroupBox *group1 = new QGroupBox( klocale->translate("Commands"), this );
      QLabel *shutdown_label = new QLabel(klocale->translate("Shutdown"), group1);
      shutdown_label->setFixedSize(shutdown_label->sizeHint());
      shutdown_lined = new QLineEdit(group1);
      shutdown_lined->setFixedHeight(shutdown_lined->sizeHint().height());
      shutdown_lined->setText(shutdownstr);

      QLabel *restart_label = new QLabel(klocale->translate("Restart"), group1);
      restart_label->setFixedSize(restart_label->sizeHint());

      restart_lined = new QLineEdit(group1);
      restart_lined->setFixedHeight(shutdown_lined->height());
      restart_lined->setText(restartstr);

      QGroupBox *group2 = new QGroupBox( klocale->translate("Session types"), this );
      
      QLabel *type_label = new QLabel(klocale->translate("New type"), group2);
      type_label->setFixedSize(type_label->sizeHint());

      session_lined = new QLineEdit(group2);
      session_lined->setFixedHeight(session_lined->sizeHint().height());
      connect(session_lined, SIGNAL(textChanged(const char*)),
              SLOT(slotCheckNewSession(const char*)));
      connect(session_lined, SIGNAL(returnPressed()),
              SLOT(slotAddSessionType()));

      QLabel *types_label = new QLabel(klocale->translate("Available types"), group2);
      types_label->setFixedSize(types_label->sizeHint());

      sessionslb = new MyListBox(group2);
      connect(sessionslb, SIGNAL(highlighted(int)), SLOT(slotSessionHighlighted(int)));
      sessionslb->insertStrList(&sessions);

      btnrm = new QPushButton( klocale->translate("Remove"), group2 );
      btnrm->setFixedSize(btnrm->sizeHint());
      btnrm->setEnabled(false);
      connect( btnrm, SIGNAL( clicked() ), SLOT( slotRemoveSessionType() ) );

      btnadd = new QPushButton( klocale->translate("Add"), group2 );
      btnadd->setFixedSize(btnadd->sizeHint());
      btnadd->setEnabled(false);
      connect( btnadd, SIGNAL( clicked() ), SLOT( slotAddSessionType() ) );

      btnup = new KDirectionButton(UpArrow, group2);
      btnup->setFixedSize(20, 20);
      btnup->setEnabled(false);
      connect(btnup, SIGNAL( clicked() ), SLOT( slotSessionUp() ));
      btndown = new KDirectionButton(DownArrow, group2);
      btndown->setFixedSize(20, 20);
      btndown->setEnabled(false);
      connect(btndown,SIGNAL( clicked() ), SLOT( slotSessionDown() ));

      QBoxLayout *main = new QVBoxLayout( this, 10 );
      QBoxLayout *lgroup0 = new QVBoxLayout( group0, 10 );

      QBoxLayout *lgroup1 = new QVBoxLayout( group1, 10 );
      QBoxLayout *lgroup1a = new QHBoxLayout();
      QBoxLayout *lgroup1b = new QHBoxLayout();

      QBoxLayout *lgroup2 = new QVBoxLayout( group2, 10 );
      QBoxLayout *lgroup2sub = new QHBoxLayout();
      QBoxLayout *lgroup2a = new QVBoxLayout();
      QBoxLayout *lgroup2b = new QVBoxLayout();
      QBoxLayout *lgroup2c = new QVBoxLayout();

      main->addWidget(group0);
      main->addWidget(group1);
      main->addWidget(group2, 2);

      lgroup0->addSpacing(10);
      lgroup0->addWidget(sdcombo);

      lgroup1->addSpacing(group1->fontMetrics().height()/2);
      lgroup1->addLayout(lgroup1a);
      lgroup1->addLayout(lgroup1b);
      lgroup1a->addWidget(shutdown_label);
      lgroup1a->addWidget(shutdown_lined);

      lgroup1b->addWidget(restart_label);
      lgroup1b->addWidget(restart_lined);
      lgroup1->activate();

      lgroup2->addSpacing(group2->fontMetrics().height()/2);
      lgroup2->addLayout(lgroup2sub);
      lgroup2sub->addLayout(lgroup2a, 2);
      lgroup2sub->addLayout(lgroup2b, 2);
      lgroup2sub->addLayout(lgroup2c);
      lgroup2a->addWidget(type_label, 10, AlignLeft);
      lgroup2a->addWidget(session_lined);
      lgroup2a->addWidget(btnrm, 10, AlignRight);
      lgroup2a->addWidget(btnadd, 10, AlignRight);
      lgroup2b->addWidget(types_label, 10, AlignLeft);
      lgroup2b->addWidget(sessionslb);
      lgroup2c->addStretch(1);
      lgroup2c->addWidget(btnup);
      lgroup2c->addWidget(btndown);
      lgroup2c->addStretch(1);
      lgroup2->activate();

      main->activate();
}
Esempio n. 11
0
KMdiDockContainer::KMdiDockContainer( QWidget *parent, QWidget *win, int position, int flags )
		: QWidget( parent ), KDockContainer()
{
	m_tabSwitching = false;
	m_block = false;
	m_inserted = -1;
	m_mainWin = win;
	oldtab = -1;
	mTabCnt = 0;
	m_position = position;
	m_previousTab = -1;
	m_separatorPos = 18000;
	m_movingState = NotMoving;
	m_startEvent = 0;
	kdDebug( 760 ) << k_funcinfo << endl;

	QBoxLayout *l;
	m_horizontal = ( ( position == KDockWidget::DockTop ) || ( position == KDockWidget::DockBottom ) );


	if ( m_horizontal )
		l = new QVBoxLayout( this ); //vertical layout for top and bottom docks
	else
		l = new QHBoxLayout( this ); //horizontal layout for left and right docks

	l->setAutoAdd( false );

	m_tb = new KMultiTabBar( m_horizontal ? KMultiTabBar::Horizontal : KMultiTabBar::Vertical, this );

	m_tb->setStyle( KMultiTabBar::KMultiTabBarStyle( flags ) );
	m_tb->showActiveTabTexts( true );

	KMultiTabBar::KMultiTabBarPosition kmtbPos;
	switch( position )
	{
	case KDockWidget::DockLeft:
		kmtbPos = KMultiTabBar::Left;
		break;
	case KDockWidget::DockRight:
		kmtbPos = KMultiTabBar::Right;
		break;
	case KDockWidget::DockTop:
		kmtbPos = KMultiTabBar::Top;
		break;
	case KDockWidget::DockBottom:
		kmtbPos = KMultiTabBar::Bottom;
		break;
	default:
		kmtbPos = KMultiTabBar::Right;
		break;
	}
	m_tb->setPosition( kmtbPos );

	m_ws = new QWidgetStack( this );

	m_ws->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

	//layout the tabbar
	if ( position == KDockWidget::DockLeft || position == KDockWidget::DockTop )
	{
		//add the tabbar then the widget stack
		l->add( m_tb );
		l->add( m_ws );
	}
	else
	{
		//add the widget stack then the tabbar
		l->add( m_ws );
		l->add( m_tb );
	}

	l->activate();
	m_ws->hide();

}
Esempio n. 12
0
Zoom::Zoom( QWidget *parent, const char *name )
      : QDialog( parent, name)
{
      setFocusPolicy(QWidget::StrongFocus);
      
      mag = 1;
      
      int border = 10;
      
      QBoxLayout *topLayout = new QVBoxLayout( this, border );
      
      topLayout->addStretch( 10 );

      //sbMag = new KSpinBox( this );
      sbMag = new QComboBox (false, this);

      // (2.0) make this configurable if needed -- at least don't hard code!

      unsigned int i;
      mags = new int [21];
      for (i = 1; i <= 10; i++)
	mags [i] = (int) (100*i/(10));

      for (i = 1; i <= 10; i++)
	mags [i+10] = (int)(100+200*i/(10));

      for (i = 1; i <= 20; i++)
	sbMag->insertItem( withPercent (mags[i]) );

      //      sbMag->adjustSize();
      sbMag->setMinimumSize( sbMag->size() );
      //      connect ( sbMag, SIGNAL (valueIncreased()),		SLOT (slotValueIncreased()) );
      //      connect ( sbMag, SIGNAL (valueDecreased()),		SLOT (slotValueDecreased()) );
      connect (sbMag, SIGNAL (activated (const char *)),
	       SLOT (slotZoom (const char *)) );

      QLabel* tmpQLabel;
      tmpQLabel = new QLabel( sbMag, i18n("&Zoom factor"), this );
      tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() );
      
      topLayout->addWidget( tmpQLabel );
      topLayout->addWidget( sbMag );
      
      QFrame* tmpQFrame;
      tmpQFrame = new QFrame( this );
      tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
      tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
      
      topLayout->addWidget( tmpQFrame );
      
      // CREATE BUTTONS
      
      KButtonBox *bbox = new KButtonBox( this );
      bbox->addStretch( 10 );
      
      /*
      okButton = bbox->addButton( i18n("&OK") );
      connect( okButton, SIGNAL(clicked()), SLOT(slotOk ()) );
      okButton->setEnabled (false);

      apply = bbox->addButton( i18n("&Apply") );
      connect( apply, SIGNAL(clicked()), SLOT(applyZoom()) );
      apply->setEnabled (false);
      */
      QButton *close = bbox->addButton( i18n("&Close") );
      connect( close, SIGNAL(clicked()), SLOT(reject()) );
              
      bbox->layout();
      topLayout->addWidget( bbox );

      topLayout->activate();
      
      resize( 200,0 );
}
Esempio n. 13
0
KKeyChooser::KKeyChooser( QDict<KKeyEntry> *aKeyDict, QWidget *parent )
    : QWidget( parent )
{
	
	bKeyIntercept = FALSE;
	kbMode = NoKey;
	
	aKeyIt = new QDictIterator<KKeyEntry> ( *aKeyDict );
	
	// TOP LAYOUT MANAGER
	
	// The following layout is used for the dialog
	// 		LIST LABELS LAYOUT
	//		SPLIT LIST BOX WIDGET
	//		CHOOSE KEY GROUP BOX WIDGET
	//		BUTTONS LAYOUT
	// Items are added to topLayout as they are created.
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 0, 10 ); 
	
	// CREATE LIST LABELS
	
	QGridLayout *stackLayout = new QGridLayout( 2, 2, 2);
	topLayout->addLayout( stackLayout, 50 );
	
	stackLayout->setRowStretch(1,10);

	keyLabel = new QLabel(this);
	stackLayout->addWidget(keyLabel, 0, 1);
	keyLabel->setText( i18n("Current key") );
	keyLabel->setFixedHeight( keyLabel->sizeHint().height() );
	
	// CREATE SPLIT LIST BOX
	
	// Copy all currentKeyCodes to configKeyCodes
	// and fill up the split list box with the action/key pairs.
	
	wList = new KSplitList( this );
	stackLayout->addMultiCellWidget( wList, 1, 1, 0, 1 );
	
	actLabel = new QLabel( wList, i18n("&Action"), this );
	stackLayout->addWidget( actLabel, 0, 0 );
	actLabel->setFixedHeight( actLabel->sizeHint().height() );
	
	wList->setAutoUpdate(FALSE);
	wList->setFocus();
	
	aIt = aKeyIt;
	aIt->toFirst();
	while ( aIt->current() ) {
		aIt->current()->aConfigKeyCode = aIt->current()->aCurrentKeyCode;
		
		KSplitListItem *sli = new KSplitListItem(
		 	item( aIt->current()->aConfigKeyCode, aIt->currentKey() )
		);
		
		connect( wList, SIGNAL( newWidth( int ) ),
				 sli, SLOT( setWidth( int ) ) );
		wList->insertItem( sli );
		
		++ ( *aIt );
	}

	if ( wList->count() == 0 ) wList->setEnabled( FALSE );
	//connect( wList, SIGNAL( selected( int ) ), SLOT( toChange( int ) ) );
	connect( wList, SIGNAL( highlighted( int ) ), SLOT( updateAction( int ) ) );
	
	// CREATE CHOOSE KEY GROUP
	
	fCArea = new QGroupBox( this );
	topLayout->addWidget( fCArea, 1 );
	
	fCArea->setTitle( i18n("Choose a key for the selected action") );
	fCArea->setFrameStyle( QFrame::Box | QFrame::Sunken );
	
	// CHOOSE KEY GROUP LAYOUT MANAGER
	
	QGridLayout *grid = new QGridLayout( fCArea, 6, 4, 5 );
	
	grid->setRowStretch(0,10);
	grid->setRowStretch(1,10);
	grid->setRowStretch(2,10);
	grid->setRowStretch(3,10);
	grid->setRowStretch(4,10);
	grid->setRowStretch(5,10);

	grid->setColStretch(0,0);
	grid->setColStretch(1,10);
	grid->setColStretch(2,90);
	grid->setColStretch(3,0);
	
	grid->addRowSpacing(0,15);
	grid->addRowSpacing(5,1);
	
	
	kbGroup = new QButtonGroup( fCArea );
    kbGroup->hide();
    kbGroup->setExclusive( true );
	
	QRadioButton *rb = new QRadioButton( i18n("&No key"), fCArea );
    rb->adjustSize();
    rb->setFixedHeight( rb->height() );
    rb->setMinimumWidth( rb->width() );
    kbGroup->insert( rb, NoKey );
	
	grid->addMultiCellWidget( rb, 1, 1, 1, 2 );
	
	rb = new QRadioButton( i18n("&Default key"), fCArea );
    rb->adjustSize();
    rb->setFixedHeight( rb->height() );
    rb->setMinimumWidth( rb->width() );
    kbGroup->insert( rb, DefaultKey );
	
	grid->addMultiCellWidget( rb, 2, 2, 1, 2 );
	
	rb = new QRadioButton( i18n("&Custom key"), fCArea );
    rb->adjustSize();
    rb->setFixedHeight( rb->height() );
    rb->setMinimumWidth( rb->width() );
    kbGroup->insert( rb, CustomKey );
	
	connect( kbGroup, SIGNAL( clicked( int ) ), SLOT( keyMode( int ) ) );
	
	grid->addMultiCellWidget( rb, 3, 3, 1, 2 );
	
	QBoxLayout *pushLayout = new QHBoxLayout( 2 );
	grid->addLayout( pushLayout, 4, 2 );
	
	cShift = new QCheckBox( fCArea );
	cShift->setText( "SHIFT" );
	cShift->setEnabled( FALSE );
	connect( cShift, SIGNAL( clicked() ), SLOT( shiftClicked() ) );
	
	cCtrl = new QCheckBox( fCArea );
	cCtrl->setText( "CTRL" );
	cCtrl->setEnabled( FALSE );
	connect( cCtrl, SIGNAL( clicked() ), SLOT( ctrlClicked() ) );
	
	cAlt = new QCheckBox( fCArea );
	cAlt->setText( "ALT" );
	cAlt->setEnabled( FALSE );
	connect( cAlt, SIGNAL( clicked() ), SLOT( altClicked() ) );
	
	bChange = new KKeyButton("key", fCArea);
	bChange->setEnabled( FALSE );
	connect( bChange, SIGNAL( clicked() ), SLOT( changeKey() ) );
	
	// Set height of checkboxes to basic key button height.
	// Basic key button height = push button height.
	cAlt->adjustSize();
	cAlt->setFixedHeight( bChange->sizeHint().height() );
	cAlt->setMinimumWidth( cAlt->width() );
	cShift->adjustSize();
	cShift->setFixedHeight( bChange->sizeHint().height() );
	cShift->setMinimumWidth( cShift->width() );
	cCtrl->adjustSize();
	cCtrl->setFixedHeight( bChange->sizeHint().height() );
	cCtrl->setMinimumWidth( cCtrl->width() );
	fCArea->setMinimumHeight( bChange->sizeHint().height() + 20 +
		3*rb->height() + 4*10);
	
	// Add widgets to the geometry manager
	
	pushLayout->addWidget( cShift );
	pushLayout->addSpacing( 8 );
	pushLayout->addWidget( cCtrl );
	pushLayout->addSpacing( 8 );
	pushLayout->addWidget( cAlt );
	pushLayout->addSpacing( 18 );
	pushLayout->addWidget( bChange );
	pushLayout->addStretch( 10 );
	
	lNotConfig = new QLabel(fCArea);
	lNotConfig->resize(0,0);
	lNotConfig->setFont( QFont("Helvetica", 14, QFont::Bold) );
	lNotConfig->setAlignment( AlignCenter );
	lNotConfig->setFrameStyle( QFrame::Panel | QFrame::Sunken );
	if ( wList->count()==0 )
		lNotConfig->setText(i18n("No keys defined"));
	else {
		lNotConfig->setText(i18n("Not configurable"));
		lNotConfig->hide();
	}
	lNotConfig->hide();

	lInfo = new QLabel(fCArea);
	resize(0,0);
	lInfo->setAlignment( AlignCenter );
	lInfo->setEnabled( FALSE );
	lInfo->hide();
	
	wList->setAutoUpdate(TRUE);
	wList->update();
	
	globalDict = new QDict<int> ( 37, false );
	globalDict->setAutoDelete( true );
	readGlobalKeys();
	
	topLayout->activate();
}
Esempio n. 14
0
ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
    : QWidget( parent, name )
{
    // Make the top-level layout; a vertical box to contain all widgets
    // and sub-layouts.
    QBoxLayout *topLayout = new QVBoxLayout( this, 5 );

    // Create a menubar...
    QMenuBar *menubar = new QMenuBar( this );
    menubar->setSeparator( QMenuBar::InWindowsStyle );
    QPopupMenu* popup;
    popup = new QPopupMenu( this );
    popup->insertItem( "&Quit", qApp, SLOT(quit()) );
    menubar->insertItem( "&File", popup );

    // ...and tell the layout about it.
    topLayout->setMenuBar( menubar );

    // Make an hbox that will hold a row of buttons.
    QBoxLayout *buttons = new QHBoxLayout( topLayout );
    int i;
    for ( i = 1; i <= 4; i++ ) {
	QPushButton* but = new QPushButton( this );
	QString s;
	s.sprintf( "Button %d", i );
	but->setText( s );

	// Set horizontal stretch factor to 10 to let the buttons
	// stretch horizontally. The buttons will not stretch
	// vertically, since bigWidget below will take up vertical
	// stretch.
	buttons->addWidget( but, 10 );
	// (Actually, the result would have been the same with a
	// stretch factor of 0; if no items in a layout have non-zero
	// stretch, the space is divided equally between members.)
    }

    // Make another hbox that will hold a left-justified row of buttons.
    QBoxLayout *buttons2 = new QHBoxLayout( topLayout );

    QPushButton* but = new QPushButton( "Button five", this );
    buttons2->addWidget( but );

    but = new QPushButton( "Button 6", this );
    buttons2->addWidget( but );

    // Fill up the rest of the hbox with stretchable space, so that
    // the buttons get their minimum width and are pushed to the left.
    buttons2->addStretch( 10 );

    // Make  a big widget that will grab all space in the middle.
    QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
    bigWidget->setText( "This widget will get all the remaining space" );
    bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );

    // Set vertical stretch factor to 10 to let the bigWidget stretch
    // vertically. It will stretch horizontally because there are no
    // widgets beside it to take up horizontal stretch.
    //    topLayout->addWidget( bigWidget, 10 );
    topLayout->addWidget( bigWidget ); 

    // Make a grid that will hold a vertical table of QLabel/QLineEdit
    // pairs next to a large QMultiLineEdit.

    // Don't use hard-coded row/column numbers in QGridLayout, you'll
    // regret it when you have to change the layout.
    const int numRows = 3;
    const int labelCol = 0;
    const int linedCol = 1;
    const int multiCol = 2;

    // Let the grid-layout have a spacing of 10 pixels between
    // widgets, overriding the default from topLayout.
    QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
    int row;

    for ( row = 0; row < numRows; row++ ) {
	QLineEdit *ed = new QLineEdit( this );
	// The line edit goes in the second column
	grid->addWidget( ed, row, linedCol );	

	// Make a label that is a buddy of the line edit
	QString s;
	s.sprintf( "Line &%d", row+1 );
	QLabel *label = new QLabel( ed, s, this );
	// The label goes in the first column.
	grid->addWidget( label, row, labelCol );
    }

    // The multiline edit will cover the entire vertical range of the
    // grid (rows 0 to numRows) and stay in column 2.

    QMultiLineEdit *med = new QMultiLineEdit( this );
    grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );

    // The labels will take the space they need. Let the remaining
    // horizontal space be shared so that the multiline edit gets
    // twice as much as the line edit.
    grid->setColStretch( linedCol, 10 );
    grid->setColStretch( multiCol, 20 );

    // Add a widget at the bottom.
    QLabel* sb = new QLabel( this );
    sb->setText( "Let's pretend this is a status bar" );
    sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    // This widget will use all horizontal space, and have a fixed height.

    // we should have made a subclass and implemented sizePolicy there...
    sb->setFixedHeight( sb->sizeHint().height() );

    sb->setAlignment( AlignVCenter | AlignLeft );
    topLayout->addWidget( sb );

    topLayout->activate();
}
Esempio n. 15
0
//CT 21Oct1998 - rewritten for using layouts
KDesktopConfig::KDesktopConfig (QWidget * parent, const char *name)
  : KConfigWidget (parent, name)
{

  QBoxLayout *lay = new QVBoxLayout(this, 5);

  ElectricBox = new QButtonGroup(klocale->translate("Active desktop borders"),
				 this);

  QGridLayout *eLay = new QGridLayout(ElectricBox,5,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,1);

  enable= new
    QCheckBox(klocale->translate("Enable active desktop borders"),
	      ElectricBox);
  enable->adjustSize();
  enable->setMinimumSize(enable->size());
  eLay->addMultiCellWidget(enable,1,1,0,1);

  movepointer = new
    QCheckBox(klocale->translate("Move pointer towards center after switch"),
	      ElectricBox);
  movepointer->adjustSize();
  movepointer->setMinimumSize(movepointer->size());
  eLay->addMultiCellWidget(movepointer,2,2,0,1);

  delaylabel = new QLabel(klocale->translate("Desktop switch delay:"),
			  ElectricBox);
  delaylabel->adjustSize();
  delaylabel->setMinimumSize(delaylabel->size());
  delaylabel->setAlignment(AlignVCenter|AlignLeft);
  eLay->addWidget(delaylabel,3,0);

  delaylcd = new QLCDNumber (2, ElectricBox);
  delaylcd->setFrameStyle( QFrame::NoFrame );
  delaylcd->setFixedHeight(30);
  delaylcd->adjustSize();
  delaylcd->setMinimumSize(delaylcd->size());
  eLay->addWidget(delaylcd,3,1);

  delayslider = new KSlider(0,MAX_EDGE_RES/10,10,0,
			    KSlider::Horizontal, ElectricBox);
  delayslider->setSteps(10,10);
  delayslider->adjustSize();
  delayslider->setMinimumSize(delaylabel->width(), delayslider->height());
  eLay->addMultiCellWidget(delayslider,4,4,1,2);

  connect( delayslider, SIGNAL(valueChanged(int)), delaylcd, SLOT(display(int)) );

  connect( enable, SIGNAL(clicked()), this, SLOT(setEBorders()));

  eLay->activate();

  lay->addWidget(ElectricBox,5);

  //CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
  MagicBox = new QButtonGroup(klocale->translate("Magic Borders"), this);

  eLay = new QGridLayout(MagicBox,4,3,10,5);
  eLay->addRowSpacing(0,10);
  eLay->addRowSpacing(2,10);
  eLay->setColStretch(0,0);
  eLay->setColStretch(1,0);
  eLay->setColStretch(2,1);

  BrdrSnapLabel = new QLabel(klocale->translate("Border Snap Zone:\n       (pixels)"), MagicBox);
  BrdrSnapLabel->adjustSize();
  BrdrSnapLabel->setMinimumSize(BrdrSnapLabel->size());
  BrdrSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(BrdrSnapLabel,1,0);

  BrdrSnapLCD = new QLCDNumber (2, MagicBox);
  BrdrSnapLCD->setFrameStyle( QFrame::NoFrame );
  BrdrSnapLCD->setFixedHeight(30);
  BrdrSnapLCD->adjustSize();
  BrdrSnapLCD->setMinimumSize(BrdrSnapLCD->size());
  eLay->addWidget(BrdrSnapLCD,1,1);

  BrdrSnapSlider = new KSlider(0,MAX_BRDR_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  BrdrSnapSlider->setSteps(1,1);
  BrdrSnapSlider->adjustSize();
  BrdrSnapSlider->setMinimumSize( BrdrSnapLabel->width()+
				  BrdrSnapLCD->width(),
				  BrdrSnapSlider->height());
  eLay->addWidget(BrdrSnapSlider,1,2);
  eLay->addRowSpacing(0,5);

  connect( BrdrSnapSlider, SIGNAL(valueChanged(int)), BrdrSnapLCD, SLOT(display(int)) );

  WndwSnapLabel = new QLabel(klocale->translate("Window Snap Zone:\n       (pixels)"), MagicBox);
  WndwSnapLabel->adjustSize();
  WndwSnapLabel->setMinimumSize(WndwSnapLabel->size());
  WndwSnapLabel->setAlignment(AlignTop);
  eLay->addWidget(WndwSnapLabel,3,0);

  WndwSnapLCD = new QLCDNumber (2, MagicBox);
  WndwSnapLCD->setFrameStyle( QFrame::NoFrame );
  WndwSnapLCD->setFixedHeight(30);
  WndwSnapLCD->adjustSize();
  WndwSnapLCD->setMinimumSize(WndwSnapLCD->size());
  eLay->addWidget(WndwSnapLCD,3,1);

  WndwSnapSlider = new KSlider(0,MAX_WNDW_SNAP,1,0,
			       KSlider::Horizontal, MagicBox);
  WndwSnapSlider->setSteps(1,1);
  WndwSnapSlider->adjustSize();
  WndwSnapSlider->setMinimumSize( WndwSnapLabel->width()+
				  WndwSnapLCD->width(),
				  WndwSnapSlider->height());
  eLay->addWidget(WndwSnapSlider,3,2);

  connect( WndwSnapSlider, SIGNAL(valueChanged(int)), WndwSnapLCD, SLOT(display(int)) );

  eLay->activate();

  lay->addWidget(MagicBox,5);

  lay->activate();

  GetSettings();
}
Esempio n. 16
0
KFontChooser::KFontChooser( QWidget *parent, const char *name )
	: QWidget( parent, name )
{
	int i;
	
	fnt = QFont( "helvetica", 12 );
	changed = False;
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10, 5 );
	topLayout->addStretch( 5 );
	
	QBoxLayout *stackLayout = new QVBoxLayout( 4 );
	
	topLayout->addLayout( stackLayout );
		
	cmbFont = new QComboBox( false, this );
	cmbFont->setFixedHeight( cmbFont->sizeHint().height() );
	
	getFontList( fixedList, true );
	getFontList( fontList );
	
	cmbFont->insertStrList( &fontList );
	QStrListIterator it( fontList );
	for ( i = 0; it.current(); ++it, i++ ) {
		if ( !strcmp( fnt.family(), it.current() ) )
			cmbFont->setCurrentItem( i );
	}
	
	connect( cmbFont, SIGNAL( activated( const char * ) ),
		SLOT( slotSelectFont( const char * ) ) );
		
	QLabel *label = new QLabel( cmbFont, i18n("&Typeface"), this );
	label->adjustSize();
	label->setMinimumSize( label->size() );
	
	stackLayout->addWidget( label );
	stackLayout->addWidget( cmbFont );

	cbBold = new QCheckBox(  i18n("&Bold"), this );
	cbBold->setMinimumSize( cbBold->sizeHint() );
	cbBold->setChecked( fnt.bold() );
	connect( cbBold, SIGNAL( toggled( bool ) ), SLOT( slotFontBold( bool ) ) );
	
	topLayout->addWidget( cbBold );
	
	cbItalic = new QCheckBox(  i18n("&Italic"), this );
	cbItalic->setMinimumSize( cbItalic->sizeHint() );
	cbItalic->setChecked( fnt.italic() );
	connect( cbItalic, SIGNAL( toggled( bool ) ), SLOT( slotFontItalic( bool ) ) );
	
	topLayout->addWidget( cbItalic );
	
	QBoxLayout *pushLayout = new QHBoxLayout(  2 );
	
	topLayout->addLayout( pushLayout );
	
	stackLayout = new QVBoxLayout( 4 );
	
	pushLayout->addLayout( stackLayout, 10 );
	pushLayout->addSpacing( 10 );
	
	sbSize = new KNumericSpinBox( this );
	
	sbSize->setStep( 1 );
	sbSize->setRange( 8, 16 );
	sbSize->setValue( 12 );
	sbSize->adjustSize();

	connect( sbSize, SIGNAL( valueDecreased() ),
		 SLOT( slotFontSize() ) );
		 
	connect( sbSize, SIGNAL( valueIncreased() ),
		 SLOT( slotFontSize() ) );
	
	label = new QLabel( sbSize, i18n("&Size"), this );
	label->setMinimumSize( label->sizeHint() );

	cmbCharset = new QComboBox( false, this );
	
	cmbCharset->adjustSize();
	cmbCharset->setInsertionPolicy( QComboBox::NoInsertion );
	connect( cmbCharset, SIGNAL( activated( const char * ) ),
		 SLOT( slotCharset( const char * ) ) );
	
	sbSize->setFixedHeight( cmbCharset->height() );
	sbSize->setMinimumWidth(sbSize->width());
	cmbCharset->setFixedHeight( cmbCharset->height() );
	cmbCharset->setMinimumWidth( cmbCharset->width());

	stackLayout->addWidget( label );
	stackLayout->addWidget( sbSize );
	
	stackLayout = new QVBoxLayout( 4 );
	
	pushLayout->addLayout( stackLayout, 30 );
	
	label = new QLabel( cmbCharset, i18n("&Character set"), this );
	label->adjustSize();
	label->setMinimumSize( label->size() );
	
	stackLayout->addWidget( label );
	stackLayout->addWidget( cmbCharset );

	topLayout->activate();
	fillCharsetCombo();
}
Esempio n. 17
0
kdvi::kdvi( char *fname, QWidget *, const char *name )
    : KTopLevelWidget( name )
{
    msg = NULL;
    ssmenu = NULL;
    hbl = NULL;
    prefs = NULL;

    keys = new KAccel(this);

    readConfig();
    setMinimumSize( 400, 60 );
    setCaption( kapp->getCaption() );
    tipgroup = new QToolTipGroup( this, "TipGroup" );
    connect( tipgroup, SIGNAL(showTip(const char *)), SLOT(showTip(const char *)) );
    connect( tipgroup, SIGNAL(removeTip()), SLOT(removeTip()) );

    // Create KPanner for toolBar2 and dviwindow

    kpan = new KPanner( this, "panner",
                        KPanner::O_VERTICAL|KPanner::U_ABSOLUTE, 100);
    setView( kpan, TRUE );
    setFrameBorderWidth( 4 );
    kpan->setAbsSeparator( pannerValue );
    connect( kpan, SIGNAL(positionChanged()), SLOT(pannerChanged()) );

    // Create a dvi window

    dviwin = new dviWindow( basedpi, mfmode, paper, makepk,
                            kpan->child1(), "dviWindow" );
    connect( dviwin, SIGNAL(currentPage(int)), SLOT(setPage(int)) );
    connect( dviwin, SIGNAL(shrinkChanged(int)), SLOT(shrinkChanged(int)) );
    connect( dviwin, SIGNAL(fileChanged()), SLOT(fileChanged()) );
    connect( dviwin, SIGNAL(statusChange(const char *)),
             SLOT(showTip(const char *)) );
    connect( dviwin, SIGNAL(setPoint(QPoint)), SLOT(showPoint(QPoint)) );

    // Create a menubar

    menuBar = NULL;
    makeMenuBar();

    // Create toolbars

    toolBar = NULL;
    makeButtons();
    makeToolBar2( kpan->child0() );

    // Create a statusbar

    statusBar = NULL;
    makeStatusBar( i18n("No document") );

    // Lay out widgets

    QBoxLayout *l;
    l = new QBoxLayout( kpan->child0(), QBoxLayout::LeftToRight );
    l->addWidget( toolBar2 );
    l->activate();
    l = new QBoxLayout( kpan->child1(), QBoxLayout::LeftToRight );
    l->addWidget( dviwin );
    l->activate();

    // Create RMB menu

    rmbmenu = new QPopupMenu;
    rmbmenu->setMouseTracking( TRUE );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Toggle Menubar")),
                          this, SLOT(toggleShowMenubar()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Mark page")),
                          marklist, SLOT(markSelected()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Redraw")),
                          dviwin, SLOT(drawPage()) );
    rmbmenu->connectItem( rmbmenu->insertItem(i18n("Preferences ...")),
                          this, SLOT(optionsPreferences()) );

    // Bind keys

    bindKeys();
    updateMenuAccel();

// Drag and drop

    KDNDDropZone * dropZone = new KDNDDropZone( this , DndURL);
    connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ),
             SLOT( dropEvent( KDNDDropZone *) ) );

    // Read config options

    applyPreferences();

    selectSmall();
    dviwin->installEventFilter( this );

    message( "" );
    openFile(QString(fname));
}
Esempio n. 18
0
KDMSessionsWidget::KDMSessionsWidget(QWidget *parent)
    : QWidget(parent)
{
    QString wtstr;


    QGroupBox *group0 = new QGroupBox(i18n("Allow Shutdown"), this);

    sdlcombo = new KComboBox(group0);
    sdlcombo->setEditable(false);
    sdllabel = new QLabel(i18nc("shutdown request origin", "&Local:"), group0);
    sdllabel->setBuddy(sdlcombo);
    sdlcombo->insertItem(SdAll, i18nc("@item:inlistbox allow shutdown", "Everybody"));
    sdlcombo->insertItem(SdRoot, i18nc("@item:inlistbox allow shutdown", "Only Root"));
    sdlcombo->insertItem(SdNone, i18nc("@item:inlistbox allow shutdown", "Nobody"));
    connect(sdlcombo, SIGNAL(activated(int)), SIGNAL(changed()));
    sdrcombo = new KComboBox(group0);
    sdrcombo->setEditable(false);
    sdrlabel = new QLabel(i18nc("shutdown request origin", "&Remote:"), group0);
    sdrlabel->setBuddy(sdrcombo);
    sdrcombo->insertItem(SdAll, i18nc("@item:inlistbox allow shutdown", "Everybody"));
    sdrcombo->insertItem(SdRoot, i18nc("@item:inlistbox allow shutdown", "Only Root"));
    sdrcombo->insertItem(SdNone, i18nc("@item:inlistbox allow shutdown", "Nobody"));
    connect(sdrcombo, SIGNAL(activated(int)), SIGNAL(changed()));
    group0->setWhatsThis(i18n(
        "Here you can select who is allowed to shutdown the computer using KDM. "
        "You can specify different values for local (console) and remote displays. "
        "Possible values are:<ul>"
        " <li><em>Everybody:</em> everybody can shutdown the computer using KDM</li>"
        " <li><em>Only root:</em> KDM will only allow shutdown after the user has "
            "entered the root password</li>"
        " <li><em>Nobody:</em> nobody can shutdown the computer using KDM</li></ul>"));


    QGroupBox *group1 = new QGroupBox(i18nc(
        "@title:group shell commands for shutdown", "Commands"), this);

    shutdown_lined = new KUrlRequester(group1);
    QLabel *shutdown_label = new QLabel(i18nc("command for ...", "H&alt:"), group1);
    shutdown_label->setBuddy(shutdown_lined);
    connect(shutdown_lined, SIGNAL(textChanged(QString)),
            SIGNAL(changed()));
    wtstr = i18n("Command to initiate the system halt. Typical value: /sbin/halt");
    shutdown_label->setWhatsThis(wtstr);
    shutdown_lined->setWhatsThis(wtstr);

    restart_lined = new KUrlRequester(group1);
    QLabel *restart_label = new QLabel(i18nc("command for ...", "Reb&oot:"), group1);
    restart_label->setBuddy(restart_lined);
    connect(restart_lined, SIGNAL(textChanged(QString)),
            SIGNAL(changed()));
    wtstr = i18n("Command to initiate the system reboot. Typical value: /sbin/reboot");
    restart_label->setWhatsThis(wtstr);
    restart_lined->setWhatsThis(wtstr);


    QGroupBox *group4 = new QGroupBox(i18nc("@title:group", "Miscellaneous"), this);

    bm_combo = new KBackedComboBox(group4);
    bm_combo->insertItem("None", i18nc("boot manager", "None"));
    bm_combo->insertItem("Grub", i18n("Grub"));
    bm_combo->insertItem("Grub2", i18n("Grub2"));
    bm_combo->insertItem("Burg", i18n("Burg"));
#if defined(__linux__) && (defined(__i386__) || defined(__amd64__))
    bm_combo->insertItem("Lilo", i18n("Lilo"));
#endif
    QLabel *bm_label = new QLabel(i18n("Boot manager:"), group4);
    bm_label->setBuddy(bm_combo);
    connect(bm_combo, SIGNAL(activated(int)), SIGNAL(changed()));
    wtstr = i18n("Enable boot options in the \"Shutdown...\" dialog.");
    bm_label->setWhatsThis(wtstr);
    bm_combo->setWhatsThis(wtstr);

    QBoxLayout *main = new QVBoxLayout(this);
    main->setMargin(10);
    QGridLayout *lgroup0 = new QGridLayout(group0);
    lgroup0->setSpacing(10);
    QGridLayout *lgroup1 = new QGridLayout(group1);
    lgroup1->setSpacing(10);
    QGridLayout *lgroup4 = new QGridLayout(group4);
    lgroup4->setSpacing(10);

    main->addWidget(group0);
    main->addWidget(group1);
    main->addWidget(group4);
    main->addStretch();

    lgroup0->setColumnMinimumWidth(2, KDialog::spacingHint() * 2);
    lgroup0->setColumnStretch(1, 1);
    lgroup0->setColumnStretch(4, 1);
    lgroup0->addWidget(sdllabel, 1, 0);
    lgroup0->addWidget(sdlcombo, 1, 1);
    lgroup0->addWidget(sdrlabel, 1, 3);
    lgroup0->addWidget(sdrcombo, 1, 4);

    lgroup1->setColumnMinimumWidth(2, KDialog::spacingHint() * 2);
    lgroup1->setColumnStretch(1, 1);
    lgroup1->setColumnStretch(4, 1);
    lgroup1->addWidget(shutdown_label, 1, 0);
    lgroup1->addWidget(shutdown_lined, 1, 1);
    lgroup1->addWidget(restart_label, 1, 3);
    lgroup1->addWidget(restart_lined, 1, 4);

    lgroup4->addWidget(bm_label, 1, 0);
    lgroup4->addWidget(bm_combo, 1, 1);
    lgroup4->setColumnStretch(2, 1);

    main->activate();

}
Esempio n. 19
0
PrintSetup::PrintSetup( QWidget *parent, const char *name, QString pname,
				QString spooler, QString variable )
	: QDialog( parent, name, TRUE )
{
	setFocusPolicy(QWidget::StrongFocus);
	setCaption( i18n( "Printer setup" ) );
	
	int border = 10;
	
	QBoxLayout *topLayout = new QVBoxLayout( this, border );
	
	topLayout->addStretch( 10 );
	
	QGridLayout *grid = new QGridLayout( 7, 2, 5 );
	topLayout->addLayout( grid );
	

	grid->addRowSpacing(2,5);
	grid->addRowSpacing(4,5);

	grid->setColStretch(0,10);
	grid->setColStretch(1,100);
	
	leName = new QLineEdit( this );
	leName->setFocus();
	leName->setFixedHeight( leName->sizeHint().height() );
	leName->setText( pname );
	
	grid->addWidget( leName, 1, 1 );
	
	QLabel* tmpQLabel;
	tmpQLabel = new QLabel( leName, i18n("&Printer name"), this );
	tmpQLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix );
	tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() );
	
	grid->addWidget( tmpQLabel, 1, 0 );
	
	leSpool = new QLineEdit( this );
	leSpool->setFixedHeight( leName->sizeHint().height() );
	leSpool->setText( spooler );
	
	grid->addWidget( leSpool, 3, 1 );
	
	tmpQLabel = new QLabel( leSpool, i18n("&Spooler command"), this );
	tmpQLabel->setAlignment(  AlignRight | AlignVCenter | ShowPrefix );
	tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() );
	
	grid->addWidget( tmpQLabel, 3, 0 );
	
	leVar = new QLineEdit( this );
	leVar->setFixedHeight( leName->sizeHint().height() );
	leVar->setText( variable );
	
	grid->addWidget( leVar, 5, 1 );
	
	tmpQLabel = new QLabel( leVar, i18n("&Environment variable"), this );
	tmpQLabel->setAlignment(  AlignRight | AlignVCenter | ShowPrefix );
	tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() );
	
	grid->addWidget( tmpQLabel, 5, 0 );
	
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this );
	tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
	tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
	
	topLayout->addWidget( tmpQFrame );
	
	// CREATE BUTTONS
	
	KButtonBox *bbox = new KButtonBox( this );
	bbox->addStretch( 10 );
		
	QPushButton* ok = bbox->addButton( i18n("&OK") );
	connect( ok, SIGNAL(clicked()), SLOT(accept()) );
	
	QPushButton* cancel = bbox->addButton( i18n("&Cancel") );
	connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
		
	bbox->layout();
	topLayout->addWidget( bbox );

	topLayout->activate();
	
	resize( 300,0 );
}
Esempio n. 20
0
PrintDialog::PrintDialog( QWidget *parent, const char *name, int maxPages,
							bool marked )		
	: QDialog( parent, name, TRUE )
{
	setFocusPolicy(QWidget::StrongFocus);
	
	pgMode = All;
	/*
	printerName.sprintf( "" ); // default printer will be chosen.
	spoolerCommand.sprintf( "lpr" );
	printerVariable.sprintf( "PRINTER" );
	*/

	KConfig *config = KApplication::getKApplication()->getConfig();
	/* Read in the default options. */
	config->setGroup( "Print" );
	printerName=config->readEntry ("Name","");
	spoolerCommand=config->readEntry ("Spool","lpr");
	printerVariable=config->readEntry ("Variable","PRINTER");


	pgMax = maxPages;
	pgStart=0; pgEnd=0;
	
	int border = 10;
	
	QBoxLayout *topLayout = new QVBoxLayout( this, border );
	
	cbFile = new QCheckBox( i18n("Print to file"), this );
	cbFile->setFixedHeight( cbFile->sizeHint().height() );
	
	topLayout->addWidget( cbFile );
	
	QGroupBox *group = new QGroupBox( i18n( "Pages" ), this );
	topLayout->addWidget( group, 10 );
	
	QGridLayout *grid = new QGridLayout( group, 5, 7, 5 );
	
	grid->setRowStretch( 0, 10 );
	grid->setRowStretch( 1, 100 );
	grid->setRowStretch( 2, 0 );
	grid->setRowStretch( 3, 100 );
	grid->setRowStretch( 4, 10 );
	
	grid->setColStretch( 0, 0 );
	grid->setColStretch( 1, 100 );
	grid->setColStretch( 2, 100 );
	grid->setColStretch( 3, 100 );
	grid->setColStretch( 4, 0 );
	grid->setColStretch( 5, 100 );
	grid->setColStretch( 6, 0 );
		
	pgGroup = new QButtonGroup( group );
	pgGroup->hide();
	pgGroup->setExclusive( true );
	connect( pgGroup, SIGNAL( clicked( int ) ), SLOT( slotPageMode( int ) ) );
	
	int widest = 0;
	
	QRadioButton *arb = new QRadioButton( i18n("&All"), group );
	arb->setFixedHeight( arb->sizeHint().height()+6 );
	arb->setChecked( true );
	pgGroup->insert( arb, All );
	
	grid->addWidget( arb, 1, 1 );
	
	if ( arb->sizeHint().width() > widest )
	  widest = arb->sizeHint().width();
	
	QRadioButton *rb = new QRadioButton( i18n("&Current"), group );
	rb->setFixedHeight( rb->sizeHint().height()+6 );
	pgGroup->insert( rb, Current );
	
	grid->addWidget( rb, 1, 2 );
	
	if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
	
	rb = new QRadioButton( i18n("&Marked"), group );
	rb->setFixedHeight( rb->sizeHint().height()+6 );
	if ( !marked )
	  rb->setEnabled( false );
	else
	  {
	    arb->setChecked ( false );
	    rb->setChecked ( true );
	  }

	pgGroup->insert( rb, Marked );
	
	grid->addWidget( rb, 3, 1 );
	
	if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
	
	rb = new QRadioButton( i18n("&Range"), group );
	rb->setFixedHeight( rb->sizeHint().height()+6 );
	pgGroup->insert( rb, Range );
	
	grid->addWidget( rb, 3, 2 );
	
	if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width();
	
	leStart = new QLineEdit( group );
	leStart->setFixedHeight( rb->sizeHint().height()+6 );
	
	grid->addWidget( leStart, 3, 3 );
	
	lTo = new QLabel( group );
	lTo->setText( i18n("to") );
	lTo->setAlignment( AlignCenter );
	lTo->setMinimumSize( lTo->sizeHint() );
	
	grid->addWidget( lTo, 3, 4 );
	
	leEnd = new QLineEdit( group );
	leEnd->setFixedHeight( rb->sizeHint().height()+6 );
	
	grid->addWidget( leEnd, 3, 5 );
	
	group->setMinimumSize( QSize( 4*widest+25, 4*(rb->sizeHint().height()+6) ) );
	
	cbOrder = new QCheckBox( i18n("Print document in re&verse order"), this );
	cbOrder->setFixedHeight( cbOrder->sizeHint().height() );
	
	topLayout->addWidget( cbOrder );
	
	
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this );
	tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
	tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
	
	topLayout->addWidget( tmpQFrame );
	
	// CREATE BUTTONS
	
	KButtonBox *bbox = new KButtonBox( this );
	
	QPushButton* setup = bbox->addButton( i18n("&Setup ...") );
	connect( setup, SIGNAL(clicked()), SLOT( setup()) );
	
	
	bbox->addStretch( 10 );

	QPushButton* ok = bbox->addButton( i18n("&OK") );
	connect( ok, SIGNAL(clicked()), SLOT( checkRange() ) );

	QPushButton* cancel = bbox->addButton( i18n("&Cancel") );
	connect( cancel, SIGNAL(clicked()), SLOT(reject()) );

	bbox->layout();
	topLayout->addWidget( bbox );
	
	topLayout->activate();
	
	if ( marked )
	  slotPageMode( Marked );
	else
	  slotPageMode( All );

	resize( 250, 0 );
	
}