Example #1
0
KCountryPage::KCountryPage(QWidget *parent, const char *name ) : KCountryPageDlg(parent,name) {

	px_introSidebar->setPixmap(UserIcon("step1.png"));

	connect(cb_country, SIGNAL(activated(const QString &)), SLOT(setLangForCountry(const QString &)));
	connect(cb_language, SIGNAL(activated(const QString &)), SLOT(setLanguageChanged()));

	// naturally, the language is not changed on startup
	b_savedLanguageChanged = false;
	b_startedLanguageChanged = false;

	// set appropriate KDE version (kapplication.h)
	txt_welcome->setText(i18n("<h3>Welcome to KDE %1</h3>").arg(KDE_VERSION_STRING));

	flang = new KFindLanguage();

	// need this ones for decision over restarts of kp, kicker, etc
	s_oldlocale = KGlobal::locale()->language();

	// load the Menus and guess the selection
	loadCountryList(cb_country);
	fillLanguageMenu(cb_language);
	cb_language->setCurrentItem(flang->getBestLang());
	cb_country->setCurrentItem("C");

	// Highlight the users's country
	for(int i = 0; i < cb_country->count(); i++) {
		if(cb_country->id(i) == flang->getCountry()) {
			cb_country->setCurrentItem(cb_country->id(i));
			break;
		}
	}

	setLanguageChanged();
}
Example #2
0
/** Init graphical interface */
void KControlHeader::init()
{
    QWidget *mainView = new QWidget(this);

    QVBoxLayout *Form2Layout = new QVBoxLayout( mainView );
    Form2Layout->setSpacing( 6 );
    Form2Layout->setMargin( 0 );

    QFrame *Frame16 = new QFrame( mainView, "Frame16" );
    Frame16->setMinimumSize( QSize( 0, 50 ) );
    Frame16->setMaximumSize( QSize( 32767, 50 ) );
    Frame16->setFrameShape( QFrame::Box );
    Frame16->setFrameShadow( QFrame::Plain );
    Frame16->setPalette( QPalette( QColor(255, 255, 255) ) );
    QHBoxLayout *Frame16Layout = new QHBoxLayout( Frame16 );
    Frame16Layout->setSpacing( 6 );
    Frame16Layout->setMargin( 1 );

    QFrame *Frame17 = new QFrame( Frame16, "Frame17" );
    Frame17->setMinimumSize( QSize( 125, 0 ) );
    Frame17->setMaximumSize( QSize( 125, 32767 ) );
    Frame17->setFrameShape( QFrame::NoFrame );
    Frame17->setFrameShadow( QFrame::Raised );
    Frame17->setBackgroundPixmap( QPixmap(locate("appdata","pics/bk_frame.png") ) );
    QVBoxLayout *Frame17Layout = new QVBoxLayout( Frame17 );
    Frame17Layout->setSpacing( 6 );
    Frame17Layout->setMargin( 11 );

    QLabel *TextLabel1 = new QLabel( Frame17, "TextLabel1" );
    TextLabel1->setText( "<b style=\"text-decoration:underline;\">"+i18n("Information")+"</b>"  );
    TextLabel1->setBackgroundPixmap( QPixmap(locate("appdata","pics/bk_frame.png") ) );
    Frame17Layout->addWidget( TextLabel1 );
    Frame16Layout->addWidget( Frame17 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    Frame16Layout->addItem( spacer );

    QLabel *TextLabel2 = new QLabel( Frame16, "TextLabel2" );
    TextLabel2->setText( i18n( "Description and rules of the project." ) );
    TextLabel2->setPalette( QPalette( QColor(255, 255, 255) ) );
    Frame16Layout->addWidget( TextLabel2 );
    Form2Layout->addWidget( Frame16 );

    QGroupBox *GroupBox7 = new QGroupBox( mainView, "GroupBox7" );
    GroupBox7->setTitle( i18n( "Description" ) );
    GroupBox7->setColumnLayout(0, Qt::Vertical );
    GroupBox7->layout()->setSpacing( 0 );
    GroupBox7->layout()->setMargin( 0 );
    QVBoxLayout *GroupBox7Layout = new QVBoxLayout( GroupBox7->layout() );
    GroupBox7Layout->setAlignment( Qt::AlignTop );
    GroupBox7Layout->setSpacing( 6 );
    GroupBox7Layout->setMargin( 11 );

    QGridLayout *Layout13 = new QGridLayout;
    Layout13->setSpacing( 6 );
    Layout13->setMargin( 0 );

    QLabel *TextLabel10 = new QLabel( GroupBox7, "TextLabel10" );
    TextLabel10->setText( i18n( "Type:" ));
    TextLabel10->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    Layout13->addWidget( TextLabel10, 2, 0 );

    QHBoxLayout *Layout12 = new QHBoxLayout;
    Layout12->setSpacing( 6 );
    Layout12->setMargin( 0 );

    _headerType = new KComboBox( FALSE, GroupBox7, "_headerType" );
    Layout12->addWidget( _headerType );

    QLabel *TextLabel11 = new QLabel( GroupBox7, "TextLabel11" );
    TextLabel11->setText( i18n( "Level:" ));
    TextLabel11->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
    Layout12->addWidget( TextLabel11 );

    _headerLevel = new KComboBox( FALSE, GroupBox7, "_headerLevel" );
    Layout12->addWidget( _headerLevel );
    Layout13->addLayout( Layout12, 2, 1 );

    QLabel *TextLabel12 = new QLabel( GroupBox7, "TextLabel12" );
    TextLabel12->setText( i18n( "Language:" ));
    TextLabel12->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
    Layout13->addWidget( TextLabel12, 3, 0 );

    _headerLang = new KLanguageCombo( GroupBox7, "_headerLang" );
    loadCountryList( _headerLang );
    Layout13->addWidget( _headerLang, 3, 1 );

    QLabel *TextLabel9 = new QLabel( GroupBox7, "TextLabel9" );
    TextLabel9->setText( i18n( "Category:" ));
    TextLabel9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    Layout13->addWidget( TextLabel9, 1, 0 );

    _headerCategory = new KComboBox( true, GroupBox7, "_headerCategory" );
    Layout13->addWidget( _headerCategory, 1, 1 );

    _headerTitle = new QLineEdit( GroupBox7, "_headerTitle" );
    Layout13->addWidget( _headerTitle, 0, 1 );

    QLabel *TextLabel8 = new QLabel( GroupBox7, "TextLabel8" );
    TextLabel8->setText( i18n( "Title:" ));
    TextLabel8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    Layout13->addWidget( TextLabel8, 0, 0 );
    GroupBox7Layout->addLayout( Layout13 );
    Form2Layout->addWidget( GroupBox7 );

    QGroupBox *GroupBox8 = new QGroupBox( mainView, "GroupBox8" );
    GroupBox8->setTitle( i18n( "Picture" ) );
    GroupBox8->setColumnLayout(0, Qt::Vertical );
    GroupBox8->layout()->setSpacing( 0 );
    GroupBox8->layout()->setMargin( 0 );
    QHBoxLayout *GroupBox8Layout = new QHBoxLayout( GroupBox8->layout() );
    GroupBox8Layout->setAlignment( Qt::AlignTop );
    GroupBox8Layout->setSpacing( 6 );
    GroupBox8Layout->setMargin( 11 );

    QLabel *TextLabel13 = new QLabel( GroupBox8, "TextLabel13" );
    TextLabel13->setText( i18n( "Default picture:" ));
    GroupBox8Layout->addWidget( TextLabel13 );

    _headerPicture = new KURLRequester( GroupBox8, "_headerPicture" );
    GroupBox8Layout->addWidget( _headerPicture );
    Form2Layout->addWidget( GroupBox8 );

    QGroupBox *GroupBox6 = new QGroupBox( mainView, "GroupBox6" );
    GroupBox6->setTitle( i18n( "Author" ) );
    GroupBox6->setColumnLayout(0, Qt::Vertical );
    GroupBox6->layout()->setSpacing( 0 );
    GroupBox6->layout()->setMargin( 0 );
    QGridLayout *GroupBox6Layout = new QGridLayout( GroupBox6->layout() );
    GroupBox6Layout->setAlignment( Qt::AlignTop );
    GroupBox6Layout->setSpacing( 6 );
    GroupBox6Layout->setMargin( 11 );

    _headerName = new QLineEdit( GroupBox6, "_headerName" );

    GroupBox6Layout->addWidget( _headerName, 0, 1 );

    _headerEmail = new QLineEdit( GroupBox6, "_headerEmail" );

    GroupBox6Layout->addWidget( _headerEmail, 1, 1 );

    QLabel *TextLabel7 = new QLabel( GroupBox6, "TextLabel7" );
    TextLabel7->setText( i18n( "Web page:" ));
    TextLabel7->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    GroupBox6Layout->addWidget( TextLabel7, 2, 0 );

    QLabel *TextLabel6 = new QLabel( GroupBox6, "TextLabel6" );
    TextLabel6->setText( i18n( "Email:" ));
    TextLabel6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    GroupBox6Layout->addWidget( TextLabel6, 1, 0 );

    QLabel *TextLabel5 = new QLabel( GroupBox6, "TextLabel5" );
    TextLabel5->setText( i18n( "Name:" ));
    TextLabel5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );

    GroupBox6Layout->addWidget( TextLabel5, 0, 0 );

    _headerWWW = new QLineEdit( GroupBox6, "_headerWWW" );

    GroupBox6Layout->addWidget( _headerWWW, 2, 1 );
    Form2Layout->addWidget( GroupBox6 );

    // tab order
    setTabOrder( _headerTitle, _headerCategory );
    setTabOrder( _headerCategory, _headerType );
    setTabOrder( _headerType, _headerLevel );
    setTabOrder( _headerLevel, _headerLang );
    setTabOrder( _headerLang, _headerPicture->lineEdit() );
    setTabOrder( _headerPicture->lineEdit(), _headerPicture->comboBox() );
    setTabOrder( _headerPicture->comboBox(), _headerName );
    setTabOrder( _headerName, _headerEmail );
    setTabOrder( _headerEmail, _headerWWW );

    // set a sensible focus
    _headerTitle->setFocus();

    setMainWidget(mainView);
}