コード例 #1
0
void WebdavCalendar::initGui()
{
  QBoxLayout *bottomLayout = new QHBoxLayout();

  mDaysCheckBox = new QCheckBox( this );
  mDaysCheckBox->setText( i18n( "Sync only events newer than" ) );

  mDaysSpinBox = new QSpinBox( this );
  mDaysSpinBox->setDisabled( true );
  mDaysSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );

  connect( mDaysCheckBox, SIGNAL( toggled( bool ) ),
           this, SLOT( toggleDays( bool ) ) );

  bottomLayout->addWidget( mDaysCheckBox );
  bottomLayout->addWidget( mDaysSpinBox );
  bottomLayout->addWidget( new QLabel( i18n( "day(s)" ), this ) );

  QGridLayout *webdavLayout = new QGridLayout();

  mUrl = new KLineEdit( this );
  mUsername = new KLineEdit( this );
  mPassword = new KLineEdit( this );
  mPassword->setEchoMode( KLineEdit::Password );

  KPushButton *removeButton = new KPushButton( this );
  removeButton->setText( i18n( "Remove" ) );
  connect( removeButton, SIGNAL( clicked() ),
           this, SLOT( deleteWidget() ) );

  mDefaultCheckBox = new QCheckBox( this );
  mDefaultCheckBox->setText( i18n( "Set as Default" ) );

  webdavLayout->addWidget( new QLabel( i18n( "Location:" ), this ), 0, 0 );
  webdavLayout->addWidget( mUrl, 0, 1 );
  webdavLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Fixed ), 0, 2 );
  webdavLayout->addWidget( removeButton, 0, 3 );
  webdavLayout->addMultiCellLayout( bottomLayout, 1, 1, 0, 1 );
  webdavLayout->addWidget( mDefaultCheckBox, 1, 3 );

  QGridLayout *mainLayout = new QGridLayout( this );
  mainLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Fixed ), 0, 0 );
  mainLayout->addMultiCellLayout( webdavLayout, 1, 1, 0, 4 );
  mainLayout->addWidget( new QLabel( i18n( "Username:"******"Password:" ), this ), 2, 3 );
  mainLayout->addWidget( mPassword, 2, 4 );
}
コード例 #2
0
GofunListWidget::GofunListWidget(QWidget* parent) : QWidget(parent)
{
	list = new QListView(this);
	list->addColumn(tr("Values"));
	list->setResizeMode(QListView::AllColumns);
	list->setSorting(-1);
	
	edit = new QLineEdit(this);
	edit->setEnabled(false);
	
	connect(edit,SIGNAL(textChanged(const QString&)),this,SLOT(updateValue(const QString&)));
	connect(list,SIGNAL(selectionChanged()),this,SLOT(updateEdit()));
	
	add_button = new QPushButton(tr("Add"),this);
	rem_button = new QPushButton(tr("Remove"),this);
	up_button = new QPushButton(tr("Up"),this);
	down_button = new QPushButton(tr("Down"),this);
	
	connect(add_button,SIGNAL(clicked()),this,SLOT(add()));
	connect(rem_button,SIGNAL(clicked()),this,SLOT(remove()));
	connect(up_button,SIGNAL(clicked()),this,SLOT(up()));
	connect(down_button,SIGNAL(clicked()),this,SLOT(down()));
	
	QGridLayout* grid = new QGridLayout(this,4,3);
	grid->addWidget(add_button,0,0);
	grid->addWidget(rem_button,0,1);
	grid->addMultiCellWidget(list,1,1,0,2);
	grid->addMultiCellWidget(edit,2,2,0,2);
	
	QGridLayout* right = new QGridLayout(4,1);
	grid->addMultiCellLayout(right,0,4,3,3);
	
	right->addWidget(up_button,1,0);
	right->addWidget(down_button,2,0);
}
コード例 #3
0
PasswdDialog::PasswdDialog()
        : QDialog(NULL, NULL, true)
{
    bLogin = false;
    oldPassword = QString::fromLocal8Bit(pClient->Password);
    QGridLayout *lay = new QGridLayout(this, 2, 2, 10, 5);
    lblPasswd = new QLabel(i18n("Password:"******"Close"), this);
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    hLay->addWidget(btnClose);
    hLay->addStretch();
    btnLogin = new QPushButton(i18n("Login"), this);
    btnLogin->setDefault(true);
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    hLay->addWidget(btnLogin);
    hLay->addStretch();
    setCaption(i18n("Invalid password"));
    textChanged("");
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
};
GofunDesktopEntrySettingsMore::GofunDesktopEntrySettingsMore(QWidget* parent) : QDialog(parent)
{
	setCaption(tr("More settings"));

	QGridLayout* grid = new QGridLayout(this);
	grid->layout()->setMargin(5);
	grid->layout()->setSpacing(3);
	
	QPushButton* ok_button = new QPushButton(tr("Ok"),this);
	QPushButton* cancel_button = new QPushButton(tr("Cancel"),this);
	
	connect(ok_button,SIGNAL(clicked()),this,SLOT(accept()));
	connect(cancel_button,SIGNAL(clicked()),this,SLOT(reject()));
	
	QGridLayout* grid_more = new QGridLayout;
	
	generic_name = new QLineEdit(this);
	
	grid_more->addWidget(new QLabel(tr("Generic name"),this),0,0);
	grid_more->addWidget(generic_name,0,1);
	
	grid->addMultiCellLayout(grid_more,0,0,0,1);
	grid->addWidget(ok_button,1,0);
	grid->addWidget(cancel_button,1,1);
}
コード例 #5
0
ファイル: markerdialog.cpp プロジェクト: NoSuchProcess/qucs
MarkerDialog::MarkerDialog(Marker *pm_, QWidget *parent)
    : QDialog(parent, 0, FALSE, Qt::WDestructiveClose)
{
    setWindowTitle(tr("Edit Marker Properties"));
    pMarker = pm_;

    QGridLayout *g = new QGridLayout;

    Precision = new QLineEdit();
    Precision->setText(QString::number(pMarker->Precision));
    Precision->setValidator(new QIntValidator(0, 12, this));

    g->addWidget(new QLabel(tr("Precision: ")), 0, 0);
    g->addWidget(Precision, 0, 1);

    NumberBox = new QComboBox();
    NumberBox->insertItem(tr("real/imaginary"));
    NumberBox->insertItem(tr("magnitude/angle (degree)"));
    NumberBox->insertItem(tr("magnitude/angle (radian)"));
    NumberBox->setCurrentItem(pMarker->numMode);

    g->addWidget(new QLabel(tr("Number Notation: ")), 1,0);
    g->addWidget(NumberBox, 1, 1);

    assert(pMarker->diag());
    if(pMarker->diag()->Name=="Smith") // BUG
    {
        //S parameter also displayed as Z, need Z0 here
        SourceImpedance = new QLineEdit();
        SourceImpedance->setText(QString::number(pMarker->Z0));

        g->addWidget(new QLabel(tr("Z0: ")), 2,0);
        g->addWidget(SourceImpedance,2,1);
    }

    TransBox = new QCheckBox(tr("transparent"));
    TransBox->setChecked(pMarker->transparent);
    g->addMultiCellWidget(TransBox,3,3,0,1);

    // first => activated by pressing RETURN
    QPushButton *ButtOK = new QPushButton(tr("OK"));
    connect(ButtOK, SIGNAL(clicked()), SLOT(slotAcceptValues()));

    QPushButton *ButtCancel = new QPushButton(tr("Cancel"));
    connect(ButtCancel, SIGNAL(clicked()), SLOT(reject()));

    QHBoxLayout *b = new QHBoxLayout();
    b->setSpacing(5);
    b->addWidget(ButtOK);
    b->addWidget(ButtCancel);
    g->addMultiCellLayout(b,4,4,0,1);

    this->setLayout(g);
}
コード例 #6
0
LoginDialog::LoginDialog()
        : QDialog(NULL, NULL, true)
{
    setIcon(Pict("licq"));
    bLogin = false;
    QGridLayout *lay = new QGridLayout(this, 4, 2, 10, 5);
    lblUIN = new QLabel(i18n("UIN:"), this);
    lblUIN->setAlignment(AlignRight | AlignVCenter);
    lay->addWidget(lblUIN, 0, 0);
    edtUIN = new QLineEdit(this);
    edtUIN->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    connect(edtUIN, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    lay->addWidget(edtUIN, 0, 1);
    lblPasswd = new QLabel(i18n("Password:"******"Use existing UIN"), this);
    connect(chkOldUser, SIGNAL(toggled(bool)), this, SLOT(setOldUser(bool)));
    lay->addMultiCellWidget(chkOldUser, 2, 2, 0, 1);
    QHBoxLayout *hLay = new QHBoxLayout();
    lay->addMultiCellLayout(hLay, 3, 3, 0, 1);
    hLay->addStretch();
    btnClose = new QPushButton(i18n("Close"), this);
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    hLay->addWidget(btnClose);
    hLay->addStretch();
    btnLogin = new QPushButton(i18n("Register"), this);
    btnLogin->setDefault(true);
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    hLay->addWidget(btnLogin);
    hLay->addStretch();
    setCaption(i18n("Registration"));
    setOldUser(false);
    textChanged("");
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
};
コード例 #7
0
void LocalCalendar::initGui()
{
  QBoxLayout *bottomLayout = new QHBoxLayout();

  mDaysCheckBox = new QCheckBox( this );
  mDaysCheckBox->setText( i18n( "Sync only events newer than" ) );

  mDaysSpinBox = new QSpinBox( this );
  mDaysSpinBox->setDisabled( true );
  mDaysSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );

  connect( mDaysCheckBox, SIGNAL( toggled( bool ) ),
           this, SLOT( toggleDays( bool ) ) );

  bottomLayout->addWidget( mDaysCheckBox );
  bottomLayout->addWidget( mDaysSpinBox );
  bottomLayout->addWidget( new QLabel( i18n( "day(s)" ), this ) );

  QGridLayout *localLayout = new QGridLayout( this );

  mPathRequester = new KURLRequester( this );

  KPushButton *removeButton = new KPushButton( this );
  removeButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
  removeButton->setText( i18n( "Remove" ) );
  connect( removeButton, SIGNAL( clicked() ),
           this, SLOT( deleteWidget() ) );

  mDefaultCheckBox = new QCheckBox( this );
  mDefaultCheckBox->setText( i18n( "Set as Default" ) );

  localLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Expanding ), 0, 0 );
  localLayout->addWidget( new QLabel( i18n( "Location:" ), this ), 1, 0 );
  localLayout->addWidget( mPathRequester, 1, 1 );
  localLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Fixed ), 1, 2 );
  localLayout->addWidget( removeButton, 1, 3 );
  localLayout->addMultiCellLayout( bottomLayout, 2, 2, 0, 2 );
  localLayout->addWidget( mDefaultCheckBox, 2, 3 ); 
}
コード例 #8
0
GofunProcessProblemFeedback::GofunProcessProblemFeedback(QWidget* parent) : QDialog(parent)
{
	setCaption(tr("Launch failure"));

	QGridLayout* grid = new QGridLayout(this);
	grid->layout()->setMargin(5);
	grid->layout()->setSpacing(3);
	
	QGridLayout* grid_report = new QGridLayout();
	grid_report->layout()->setSpacing(3);

	output = new QTextEdit(this);
	output->setReadOnly(true);
	exit_status = new QLabel(this);
	normal_exit = new QLabel(this);
	command = new QLineEdit(this);
	command->setReadOnly(true);
	command->setBackgroundMode(Qt::PaletteDark);
	
	grid_report->addWidget(new QLabel(tr("Command"),this),0,0);
	grid_report->addWidget(command,0,1);
	grid_report->addWidget(new QLabel(tr("Normal exit:"),this),1,0);
	grid_report->addWidget(normal_exit,1,1);
	grid_report->addWidget(new QLabel(tr("Exit status:"),this),2,0);
	grid_report->addWidget(exit_status,2,1);
	grid_report->addMultiCellWidget(new QLabel(tr("Output"),this),3,3,0,1);
	grid_report->addMultiCellWidget(output,4,4,0,1);
	
	QPushButton* try_again = new QPushButton(tr("Try again"),this);
	QPushButton* give_up = new QPushButton(tr("Give up"),this);
	
	connect(try_again,SIGNAL(clicked()),this,SLOT(accept()));
	connect(give_up,SIGNAL(clicked()),this,SLOT(reject()));
	
	grid->addMultiCellLayout(grid_report,0,0,0,1);
	grid->addWidget(try_again,1,0);
	grid->addWidget(give_up,1,1);
}
コード例 #9
0
ファイル: volume.cpp プロジェクト: opieproject/opie
VolumeControl::VolumeControl ( VolumeApplet *icon, bool /*showMic*/, QWidget *parent, const char *name )
    : QFrame ( parent, name, WStyle_StaysOnTop | WType_Popup )
{
    m_icon = icon;

    bool has_wav_alarm = ODevice::inst()->hasWaveSpeaker();
    bool has_bass = true;
    bool has_treble = true;

    if ( !ODevice::inst()->modelString().contains( "Model_iPAQ" )) {
        has_bass = false;
        has_treble = false;
    }

    setFrameStyle( QFrame::PopupPanel | QFrame::Raised );

    QGridLayout *grid = new QGridLayout( this, 1, 1, 6, 4 );
    grid->setSpacing( 4 );
    grid->setMargin( 6 );

    QVBoxLayout *vbox;
    QLabel *l;

    vbox = new QVBoxLayout();
    vbox->setSpacing( 4 );
    grid->addLayout( vbox, 1, 0 );

    upButton = new QPushButton ( this );
    upButton->setSizePolicy( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding ));
    upButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
    upButton->setFocusPolicy( QWidget::NoFocus );

    vbox->addWidget ( upButton );

    downButton = new QPushButton ( this );
    downButton->setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding ));
    downButton->setPixmap ( Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ) );
    downButton->setFocusPolicy ( QWidget::NoFocus );

    vbox->addWidget ( downButton );

    volSlider = new QSlider ( this );
    volSlider->setRange ( 0, 100 );
    volSlider->setTickmarks ( QSlider::Both );
    volSlider->setTickInterval ( 20 );
    volSlider->setFocusPolicy ( QWidget::NoFocus );

    l = new QLabel ( this );
    l->setPixmap ( QPixmap ( vol_xpm ));

    grid->addWidget ( l, 0, 1, AlignCenter );
    grid->addWidget ( volSlider, 1, 1, AlignCenter );

    volLed = new OLedBox ( green, this );
    volLed->setFocusPolicy ( QWidget::NoFocus );
    volLed->setFixedSize ( 16, 16  );
    volLed->setReadOnly( false );

    grid->addWidget ( volLed, 2, 1, AlignCenter );

    QVBox *basstrebleBox = new QVBox( this );

    trebleSlider = new QSlider ( basstrebleBox );
    trebleSlider->setRange ( 0, 100 );
    trebleSlider->setTickmarks ( QSlider::Both );
    trebleSlider->setTickInterval ( 20 );
    trebleSlider->setMaximumHeight( 40 );
    trebleSlider->setFocusPolicy ( QWidget::NoFocus );

    bassSlider = new QSlider ( basstrebleBox );
    bassSlider->setRange ( 0, 100 );
    bassSlider->setTickmarks ( QSlider::Both );
    bassSlider->setTickInterval ( 20 );
    bassSlider->setMaximumHeight( 40 );
    bassSlider->setFocusPolicy ( QWidget::NoFocus );

    QLabel *bassLabel = new QLabel ( this );
    bassLabel->setPixmap ( QPixmap ( bass_xpm ));

    QLabel *trebleLabel = new QLabel( this );
    trebleLabel->setPixmap( QPixmap ( treble_xpm ) );

    grid->addWidget( trebleLabel, 0, 4, AlignCenter );
    grid->addWidget( basstrebleBox, 1, 4, AlignCenter );
    grid->addWidget ( bassLabel, 2, 4, AlignCenter );

    if ( !has_bass ) {
        bassSlider->hide();
        bassLabel->hide();
    }

    if ( !has_treble ) {
        trebleSlider->hide();
        trebleLabel->hide();
    }

    micSlider = new QSlider ( this );
    micSlider->setRange ( 0, 100 );
    micSlider->setTickmarks ( QSlider::Both );
    micSlider->setTickInterval ( 20 );
    micSlider->setFocusPolicy ( QWidget::NoFocus );

    l = new QLabel ( this );
    l->setPixmap ( QPixmap ( mic_xpm ));

    grid->addWidget ( l, 0, 2, AlignCenter );
    grid->addWidget ( micSlider, 1, 2, AlignCenter );

    micLed = new OLedBox ( red, this );
    micLed->setFocusPolicy ( QWidget::NoFocus );
    micLed->setFixedSize ( 16, 16 );
    micLed->setReadOnly( false );

    grid->addWidget ( micLed, 2, 2, AlignCenter );

    alarmSlider = new QSlider ( this );
    alarmSlider->setRange ( 0, 100 );
    alarmSlider->setTickmarks ( QSlider::Both );
    alarmSlider->setTickInterval ( 20 );
    alarmSlider->setFocusPolicy ( QWidget::NoFocus );

    QLabel *alarmLabel = new QLabel ( this );
    alarmLabel->setPixmap ( QPixmap ( alarm_xpm ));

    grid->addWidget ( alarmLabel, 0, 3, AlignCenter );
    grid->addWidget ( alarmSlider, 1, 3, AlignCenter );

    alarmLed = new OLedBox ( yellow, this );
    alarmLed->setFocusPolicy ( QWidget::NoFocus );
    alarmLed->setFixedSize ( 16, 16 );
    alarmLed->setReadOnly( false );

    grid->addWidget ( alarmLed, 2, 3, AlignCenter );

    if ( !has_wav_alarm ) {
        alarmSlider->hide();
        alarmLabel->hide();
        alarmLed->hide();
    }

    grid->addWidget ( new QLabel ( tr( "Enable Sounds for:" ), this ), 0, 6, AlignVCenter | AlignLeft );

    vbox = new QVBoxLayout();
    vbox->setSpacing ( 4 );
    grid->addMultiCellLayout ( vbox, 1, 2, 6, 6 );

    tapBox = new QCheckBox ( tr( "Screen Taps" ), this );
    tapBox->setFocusPolicy ( QWidget::NoFocus );

    vbox->addWidget ( tapBox, AlignVCenter | AlignLeft );

    keyBox = new QCheckBox ( tr( "Key Clicks" ), this );
    keyBox->setFocusPolicy ( QWidget::NoFocus );

    vbox->addWidget ( keyBox, AlignVCenter | AlignLeft );

    alarmBox = new QCheckBox ( tr( "Alarm Sound" ), this );
    alarmBox->setFocusPolicy ( QWidget::NoFocus );

    vbox->addWidget ( alarmBox, AlignVCenter | AlignLeft );

    if ( has_wav_alarm ) {
        alarmBox->hide();
    }

    vbox->addStretch ( 100 );

    setFixedSize ( sizeHint());
    setFocusPolicy ( QWidget::NoFocus );

    rateTimer = new QTimer( this );
    connect ( rateTimer, SIGNAL( timeout()), this, SLOT( rateTimerDone()));

    connect ( upButton,   SIGNAL( pressed()),  this, SLOT( buttonChanged()));
    connect ( upButton,   SIGNAL( released()), this, SLOT( buttonChanged()));
    connect ( downButton, SIGNAL( pressed()),  this, SLOT( buttonChanged()));
    connect ( downButton, SIGNAL( released()), this, SLOT( buttonChanged()));

    connect ( micSlider, SIGNAL( valueChanged(int)), this, SLOT( micMoved(int)));
    connect ( volSlider, SIGNAL( valueChanged(int)), this, SLOT( volMoved(int)));
    connect ( alarmSlider, SIGNAL( valueChanged(int)), this, SLOT( alarmMoved(int)));
    connect ( bassSlider, SIGNAL( valueChanged(int)), this, SLOT( bassMoved(int)));
    connect ( trebleSlider, SIGNAL( valueChanged(int)), this, SLOT( trebleMoved(int)));


    connect ( volLed,   SIGNAL( toggled(bool)), this, SLOT( volMuteToggled(bool)));
    connect ( micLed,   SIGNAL( toggled(bool)), this, SLOT( micMuteToggled(bool)));
    connect ( alarmLed, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));

    connect ( alarmBox, SIGNAL( toggled(bool)), this, SLOT( alarmSoundToggled(bool)));
    connect ( keyBox,   SIGNAL( toggled(bool)), this, SLOT( keyClickToggled(bool)));
    connect ( tapBox,   SIGNAL( toggled(bool)), this, SLOT( screenTapToggled(bool)));

    // initialize variables

    readConfig ( true );

    // initialize the config file, in case some entries are missing

    writeConfigEntry ( "VolumePercent", m_vol_percent,   UPD_None );
    writeConfigEntry ( "BassPercent",   m_vol_percent,   UPD_None );
    writeConfigEntry ( "TreblePercent", m_vol_percent,   UPD_None );
    writeConfigEntry ( "Mute",          m_vol_muted,     UPD_None );
    writeConfigEntry ( "AlarmPercent",  m_alarm_percent, UPD_None );
    writeConfigEntry ( "TouchSound",    m_snd_touch,     UPD_None );
    writeConfigEntry ( "KeySound",      m_snd_key,       UPD_None );
    writeConfigEntry ( "AlarmSound",    m_snd_alarm,     UPD_Vol );

    writeConfigEntry ( "Mic",           m_mic_percent,   UPD_None );
    writeConfigEntry ( "MicMute",       m_mic_muted,     UPD_Mic );
}
コード例 #10
0
ファイル: channelgroupconf.cpp プロジェクト: opieproject/opie
ChannelGroupConf::ChannelGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
	QGridLayout *layout = new QGridLayout(this);
	QVBoxLayout *volLayout = new QVBoxLayout(this);
	QVBoxLayout *chanLayout = new QVBoxLayout(this);

	layout->addRowSpacing(1,5);
	layout->addRowSpacing(3,5);
	layout->addRowSpacing(5,5);

	layout->addColSpacing(1,1);
	layout->addColSpacing(3,1);
	layout->addColSpacing(5,1);
	layout->addColSpacing(7,1);

	QPushButton *one = new QPushButton("1", this, "one");
	layout->addWidget(one, 0, 2, 0);
	connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *two = new QPushButton("2", this, "two");
	layout->addWidget(two, 0, 4, 0);
	connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *three = new QPushButton("3", this, "three");
	layout->addWidget(three, 0, 6, 0);
	connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *four = new QPushButton("4", this, "four");
	layout->addWidget(four, 2, 2, 0);
	connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *five = new QPushButton("5", this, "five");
	layout->addWidget(five, 2, 4, 0);
	connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *six = new QPushButton("6", this, "six");
	layout->addWidget(six, 2, 6, 0);
	connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *seven = new QPushButton("7", this, "seven");
	layout->addWidget(seven, 4, 2, 0);
	connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *eight = new QPushButton("8", this, "eight");
	layout->addWidget(eight, 4, 4, 0);
	connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *nine = new QPushButton("9", this, "nine");
	layout->addWidget(nine, 4, 6, 0);
	connect(nine, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QPushButton *zero = new QPushButton("0", this, "zero");
	layout->addWidget(zero, 6, 4, 0);
	connect(zero, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	layout->addMultiCellLayout(volLayout, 0, 6, 0, 0, 0);
	layout->addMultiCellLayout(chanLayout, 0, 6, 8, 8, 0);

	QPushButton *volUp = new QPushButton("+", this, "volUp");
	volLayout->addWidget(volUp, 1, 0);
	connect(volUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QLabel *volLabel = new QLabel("Volume ", this, "volLabel");
	volLayout->addWidget(volLabel, 0, 0);

	QPushButton *volDown = new QPushButton("-", this, "volDown");
	volLayout->addWidget(volDown, 1, 0);
	connect(volDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );


	QPushButton *chanUp = new QPushButton("+", this, "chanUp");
	chanLayout->addWidget(chanUp, 1, 0);
	connect(chanUp, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

	QLabel *chanLabel = new QLabel("Channel", this, "chanLabel");
	chanLayout->addWidget(chanLabel, 0, 0);

	QPushButton *chanDown = new QPushButton("-", this, "chanDown");
	chanLayout->addWidget(chanDown, 1, 0);
	connect(chanDown, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );

}
コード例 #11
0
void AddresseeEditorWidget::setupTab1()
{
  // This is the General tab
  QWidget *tab1 = new QWidget( mTabWidget );

  QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
  layout->setMargin( KDialogBase::marginHint() );
  layout->setSpacing( KDialogBase::spacingHint() );

  QLabel *label;
  KSeparator* bar;
  QPushButton *button;

  //////////////////////////////////
  // Upper left group (person info)

  // Person icon
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop,
                                                      KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 0, 1, 0, 0 );

  // First name
  button = new QPushButton( i18n( "Edit Name..." ), tab1 );
  QToolTip::add( button, i18n( "Edit the contact's name" ) );
  mNameEdit = new KLineEdit( tab1, "mNameEdit" );
  connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( nameTextChanged( const QString& ) ) );
  connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
  mNameLabel = new KSqueezedTextLabel( tab1 );

  if ( KABPrefs::instance()->automaticNameParsing() ) {
    mNameLabel->hide();
    mNameEdit->show();
  } else {
    mNameEdit->hide();
    mNameLabel->show();
  }

  layout->addWidget( button, 0, 1 );
  layout->addWidget( mNameEdit, 0, 2 );
  layout->addWidget( mNameLabel, 0, 2 );
  label = new QLabel( i18n( "<roleLabel>:", "%1:" ).arg( KABC::Addressee::roleLabel() ), tab1 );
  mRoleEdit = new KLineEdit( tab1 );
  connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );
  label->setBuddy( mRoleEdit );
  layout->addWidget( label, 1, 1 );
  layout->addWidget( mRoleEdit, 1, 2 );

  // Organization
  label = new QLabel( i18n( "<organizationLabel>:", "%1:" ).arg( KABC::Addressee::organizationLabel() ), tab1 );
  mOrgEdit = new KLineEdit( tab1 );
  label->setBuddy( mOrgEdit );
  connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( organizationTextChanged( const QString& ) ) );
  layout->addWidget( label, 2, 1 );
  layout->addWidget( mOrgEdit, 2, 2 );

  // File as (formatted name)
  label = new QLabel( i18n( "Formatted name:" ), tab1 );
  mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
  layout->addWidget( label, 3, 1 );
  layout->addWidget( mFormattedNameLabel, 3, 2 );

  // Left hand separator. This separator doesn't go all the way
  // across so the dialog still flows from top to bottom
  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 4, 4, 0, 2 );

  //////////////////////////////////////
  // Phone numbers (upper right)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook",
                    KIcon::Desktop, KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 0, 1, 3, 3 );

  mPhoneEditWidget = new PhoneEditWidget( tab1 );
  connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 );

  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 4, 4, 3, 6 );

  //////////////////////////////////////
  // Addresses (lower left)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "kfm_home", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 5, 6, 0, 0 );

  mAddressEditWidget = new AddressEditWidget( tab1 );
  connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mAddressEditWidget, 5, 10, 1, 2 );

  //////////////////////////////////////
  // Email / Web (lower right)
  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  layout->addMultiCellWidget( label, 5, 6, 3, 3 );

  mEmailWidget = new EmailEditWidget( tab1 );
  connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 );

  // add the separator
  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 7, 7, 3, 6 );

  QHBoxLayout *homePageLayout = new QHBoxLayout( 0, 11, 7 );

  label = new QLabel( tab1 );
  label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop,
                                                     KIcon::SizeMedium ) );
  homePageLayout->addWidget( label );

  label = new QLabel( i18n( "<urlLabel>:", "%1:" ).arg( KABC::Addressee::urlLabel() ), tab1 );
  mURLEdit = new KLineEdit( tab1 );
  connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );
  label->setBuddy( mURLEdit );
  homePageLayout->addWidget( label );
  homePageLayout->addWidget( mURLEdit );
  layout->addMultiCellLayout( homePageLayout, 8, 8, 3, 6 );

  QHBoxLayout *blogLayout = new QHBoxLayout( 0, 11, 7 );
  label = new QLabel( i18n("Blog feed:"), tab1 );
  blogLayout->addWidget( label );
  mBlogEdit = new KLineEdit( tab1 );
  blogLayout->addWidget( mBlogEdit );
  connect( mBlogEdit, SIGNAL( textChanged( const QString & ) ),
           SLOT( textChanged( const QString & ) ) );
  label->setBuddy( mBlogEdit );
  layout->addMultiCellLayout( blogLayout, 9, 9, 4, 6 );

  mIMWidget = new IMEditWidget( tab1, mAddressee );
  connect( mIMWidget, SIGNAL( modified() ), SLOT( emitModified() ) );
  layout->addMultiCellWidget( mIMWidget, 10, 10, 4, 6 );

  layout->addColSpacing( 6, 50 );

  bar = new KSeparator( KSeparator::HLine, tab1 );
  layout->addMultiCellWidget( bar, 11, 11, 0, 6 );

  ///////////////////////////////////////
  QHBox *categoryBox = new QHBox( tab1 );
  categoryBox->setSpacing( KDialogBase::spacingHint() );

  // Categories
  mCategoryButton = new QPushButton( i18n( "Select Categories..." ), categoryBox );
  connect( mCategoryButton, SIGNAL( clicked() ), SLOT( selectCategories() ) );

  mCategoryEdit = new KLineEdit( categoryBox );
  mCategoryEdit->setReadOnly( true );
  connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
           SLOT( textChanged( const QString& ) ) );

  mSecrecyWidget = new SecrecyWidget( categoryBox );
  connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );

  layout->addMultiCellWidget( categoryBox, 12, 12, 0, 6 );

  // Build the layout and add to the tab widget
  layout->activate(); // required

  mTabWidget->addTab( tab1, i18n( "&General" ) );
}
コード例 #12
0
ファイル: editmessagedialog.cpp プロジェクト: nijel/kalcatel
EditMessageDialog::EditMessageDialog(AlcatelContactList *cont, QWidget *parent, const char *name ) : KDialog(parent,name, true) {
    contacts = cont;
    QLabel *label;
    QFrame *line;

    reread = false;
    resize(450, 280 );
    setCaption( i18n( "New message" ) );

    QGridLayout *mainLayout = new QGridLayout( this );
    mainLayout->setSpacing( 6 );
    mainLayout->setMargin( 8 );

    label = new QLabel( i18n("<b>New message</b>"), this );
    mainLayout->addMultiCellWidget(label,0,0,0,4);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,1,1,0,4);

    mainLayout->setRowStretch(0, -1);
    mainLayout->setRowStretch(1, -1);

    sendCheck = new QCheckBox(i18n("Send message"), this);
    sendCheck->setChecked(true);
    mainLayout->addMultiCellWidget(sendCheck,2,2,0,1);

    QWhatsThis::add(sendCheck ,i18n("<b>Send message</b><br>When checked message will be sent as you press OK button."));

    writeCheck = new QCheckBox(i18n("Store to mobile as"), this);
    writeCheck->setChecked(true);
    mainLayout->addMultiCellWidget(writeCheck,2,2,2,3);

    QWhatsThis::add(writeCheck ,i18n("<b>Store to mobile</b><br>When checked, message will be written to mobile (SIM) as sent or unsent just as you press OK button."));

    typeCombo = new QComboBox(this);
    typeCombo->insertItem(i18n("Sent"));
    typeCombo->insertItem(i18n("Unsent"));
    mainLayout->addWidget(typeCombo, 2,4);

    QWhatsThis::add( typeCombo,i18n("<b>Type of message</b><br>Which will be type of message stored in mobile?"));

    connect( sendCheck, SIGNAL( toggled(bool) ), this, SLOT( slotSendChanged(bool) ) );
    connect( writeCheck, SIGNAL( toggled(bool) ), this, SLOT( slotWriteChanged(bool) ) );

    label = new QLabel( i18n("Send to:"), this );
    mainLayout->addWidget(label, 3,0);

    sendToCombo = new KComboBox(true, this);
    sendToCombo->setValidator(new PhoneNumberValidator(false, true, sendToCombo));
    mainLayout->addMultiCellWidget(sendToCombo,3,3,1,3);
    QWhatsThis::add(sendToCombo ,i18n("<b>Send to number(s)</b><br>Enter here number(s) of receivers of this message, more numbers should be separated with space, comma or semicolon."));

    QPushButton *buttonContacts = new QPushButton(i18n("Contacts..."), this);
    connect ( buttonContacts, SIGNAL( clicked() ), this, SLOT(selectContacts()));
    mainLayout->addWidget(buttonContacts,3,4);
    QWhatsThis::add(buttonContacts ,i18n("<b>Contacts</b><br>Use this button to add number from your contacts."));

    messageEdit = new QTextEdit(this);
    messageEdit->setTextFormat(Qt::PlainText);
    messageEdit->setWordWrap(QTextEdit::WidgetWidth);

    mainLayout->addMultiCellWidget(messageEdit,4,4,0,4);

    connect( messageEdit, SIGNAL( textChanged() ), this, SLOT( slotTextChanged() ) );
    connect( messageEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) );

    QWhatsThis::add( messageEdit,i18n("<b>Message text</b><br>Write here message text, note that characters with accents will be very probably interpreted another way that you wanted, just few pass correctly."));

    msgInfoLabel = new QLabel( i18n("Used %1 of %2 characters").arg(0).arg(160), this );
    mainLayout->addMultiCellWidget(msgInfoLabel,5,5,0,2);

    mainLayout->addWidget(new QLabel( i18n("Class of message"),this),5,3);
    classCombo = new QComboBox(this);
    classCombo->insertItem(i18n("0 - flash"));
    classCombo->insertItem(i18n("1 - mobile"));
    classCombo->insertItem(i18n("2 - sim"));
    classCombo->insertItem(i18n("3 - terminal"));
    classCombo->setCurrentItem(1);
    mainLayout->addWidget(classCombo, 5,4);

    QWhatsThis::add( classCombo,i18n("<b>Class of message</b><br>Class 0 message just shows on display imediately after receiving. Class 1 and 2 message are normal messages, 1 should be preferably stored into mobile while 2 on SIM card. Class 3 should go to terminal equipment which most mobiles doesn't support."));

    QHBoxLayout *layout = new QHBoxLayout;

    layout->setSpacing( 6 );
    layout->setMargin( 0 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout->addItem( spacer );

    QPushButton *buttonOK = new QPushButton(i18n("&OK"), this);
    buttonOK->setDefault(true);
    layout->addWidget(buttonOK);

    QPushButton *buttonCancel = new QPushButton(i18n("&Cancel"), this);
    layout->addWidget(buttonCancel);

    mainLayout->addMultiCellLayout( layout, 7,7, 0,4 );

    line = new QFrame( this);
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );

    mainLayout->addMultiCellWidget( line, 6,6, 0,4 );
    connect( buttonOK, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
}
コード例 #13
0
/*!
    This function constructs a dialog which contains a label and a linedit for the given variable
    It return either the entered value or an empty string if the user hit cancel
 */
QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize)
{
  // --BEGIN-- building a dynamic dialog
  QDialog dlg(this);
  dlg.setCaption(i18n("Enter Values for Variables"));

  QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
  QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
  QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
  QGridLayout * layoutBtn = new QGridLayout( 0, 2, 1, 0, 6, "layoutBtn");

  KTextEdit *te = NULL;
  QLabel * labTop = NULL;
  QCheckBox * cb = NULL;

  labTop = new QLabel( &dlg, "label" );
  layoutTop->addWidget(labTop, 0, 0);
  labTop->setText(i18n("Enter the replacement values for %1:").arg( var ));
  layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 );


  cb = new QCheckBox( &dlg, "cbVar" );
  cb->setChecked( FALSE );
  cb->setText(i18n( "Make value &default" ));

  te = new KTextEdit( &dlg, "teVar" );
  layoutVar->addWidget( te, 0, 1, Qt::AlignTop);
  layoutVar->addWidget( cb, 1, 1, Qt::AlignTop);
  if ((*mapSave)[var].length() > 0) {
    cb->setChecked( TRUE );
    te->setText((*mapSave)[var]);
  }

  QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
  QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
                            "If you use the same variable later, even in another snippet, the value entered to the right "
                            "will be the default value for that variable.") );

  layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );

  KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
  btn1->setText(i18n("&Cancel"));
  layoutBtn->addWidget( btn1, 0, 0 );

  KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
  btn2->setText(i18n("&Apply"));
  btn2->setDefault( TRUE );
  layoutBtn->addWidget( btn2, 0, 1 );

  layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
  te->setFocus();
  // --END-- building a dynamic dialog

  //connect the buttons to the QDialog default slots
  connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
  connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );

  //execute the dialog
  QString strReturn = "";
  if (dlgSize.isValid())
    dlg.setGeometry(dlgSize);
  if ( dlg.exec() == QDialog::Accepted ) {
    if (cb->isChecked())     //if the checkbox is on; save the values for later
      (*mapSave)[var] = te->text();
    else
      (*mapSave).erase(var);

    strReturn = te->text();    //copy the entered values back the the given map

    dlgSize = dlg.geometry();
  }

  //do some cleanup
  delete cb;
  delete te;
  delete labTop;
  delete btn1;
  delete btn2;
  delete layoutTop;
  delete layoutVar;
  delete layoutBtn;
  delete layout;

  return strReturn;
}
コード例 #14
0
/*!
    This function constructs a dialog which contains a label and a linedit for every
    variable that is stored in the given map except the double-delimiter entry
    It return true if everything was ok and false if the user hit cancel
 */
bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
                                       int & iWidth, int & iBasicHeight, int & iOneHeight)
{
  //if no var -> no need to show
  if (map->count() == 0)
    return true;

  //if only var is the double-delimiter -> no need to show
  QMap<QString, QString>::Iterator it = map->begin();
  if ( map->count() == 1 && it.data()==_SnippetConfig.getDelimiter()+_SnippetConfig.getDelimiter() )
    return true;

  QMap<QString, KTextEdit *> mapVar2Te;  //this map will help keeping track which TEXTEDIT goes with which variable
  QMap<QString, QCheckBox *> mapVar2Cb;  //this map will help keeping track which CHECKBOX goes with which variable

  // --BEGIN-- building a dynamic dialog
  QDialog dlg(this);
  dlg.setCaption(i18n("Enter Values for Variables"));

  QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
  QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
  QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
  QGridLayout * layoutBtn = new QGridLayout( 0, 1, 1, 0, 6, "layoutBtn");

  KTextEdit *te = NULL;
  QLabel * labTop = NULL;
  QCheckBox * cb = NULL;

  labTop = new QLabel( &dlg, "label" );
  labTop->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         labTop->sizePolicy().hasHeightForWidth() ) );
  labTop->setText(i18n("Enter the replacement values for these variables:"));
  layoutTop->addWidget(labTop, 0, 0);
  layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 );


  int i = 0;                                           //walk through the variable map and add
  for ( it = map->begin(); it != map->end(); ++it ) {  //a checkbox, a lable and a lineedit to the main layout
    if (it.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
      continue;

    cb = new QCheckBox( &dlg, "cbVar" );
    cb->setChecked( FALSE );
    cb->setText(it.key());
    layoutVar->addWidget( cb, i ,0, Qt::AlignTop );

    te = new KTextEdit( &dlg, "teVar" );
    layoutVar->addWidget( te, i, 1, Qt::AlignTop );

    if ((*mapSave)[it.key()].length() > 0) {
      cb->setChecked( TRUE );
      te->setText((*mapSave)[it.key()]);
    }

    mapVar2Te[it.key()] = te;
    mapVar2Cb[it.key()] = cb;

    QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
    QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
                              "If you use the same variable later, even in another snippet, the value entered to the right "
			      "will be the default value for that variable.") );

    i++;
  }
  layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );

  KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
  btn1->setText(i18n("&Cancel"));
  btn1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         btn1->sizePolicy().hasHeightForWidth() ) );
  layoutBtn->addWidget( btn1, 0, 0 );

  KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
  btn2->setText(i18n("&Apply"));
  btn2->setDefault( TRUE );
  btn2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
                         btn2->sizePolicy().hasHeightForWidth() ) );
  layoutBtn->addWidget( btn2, 0, 1 );

  layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
  // --END-- building a dynamic dialog

  //connect the buttons to the QDialog default slots
  connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
  connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );

  //prepare to execute the dialog
  bool bReturn = false;
  //resize the textedits
  if (iWidth > 1) {
    QRect r = dlg.geometry();
    r.setHeight(iBasicHeight + iOneHeight*mapVar2Te.count());
    r.setWidth(iWidth);
    dlg.setGeometry(r);
  }
  if ( i > 0 && // only if there are any variables
    dlg.exec() == QDialog::Accepted ) {

    QMap<QString, KTextEdit *>::Iterator it2;
    for ( it2 = mapVar2Te.begin(); it2 != mapVar2Te.end(); ++it2 ) {
      if (it2.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
        continue;
      (*map)[it2.key()] = it2.data()->text();    //copy the entered values back to the given map

      if (mapVar2Cb[it2.key()]->isChecked())     //if the checkbox is on; save the values for later
        (*mapSave)[it2.key()] = it2.data()->text();
      else
        (*mapSave).erase(it2.key());
    }
    bReturn = true;

    iBasicHeight = dlg.geometry().height() - layoutVar->geometry().height();
    iOneHeight = layoutVar->geometry().height() / mapVar2Te.count();
    iWidth = dlg.geometry().width();
  }

  //do some cleanup
  QMap<QString, KTextEdit *>::Iterator it1;
  for (it1 = mapVar2Te.begin(); it1 != mapVar2Te.end(); ++it1)
    delete it1.data();
  mapVar2Te.clear();
  QMap<QString, QCheckBox *>::Iterator it2;
  for (it2 = mapVar2Cb.begin(); it2 != mapVar2Cb.end(); ++it2)
    delete it2.data();
  mapVar2Cb.clear();
  delete layoutTop;
  delete layoutVar;
  delete layoutBtn;
  delete layout;

  if (i==0) //if nothing happened this means, that there are no variables to translate
    return true; //.. so just return OK

  return bReturn;
}
コード例 #15
0
KDMAppearanceWidget::KDMAppearanceWidget(QWidget *parent, const char *name)
  : QWidget(parent, name)
{
  QString wtstr;

  QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(),
                      KDialog::spacingHint(), "vbox");
  QGroupBox *group = new QGroupBox(i18n("Appearance"), this);
  vbox->addWidget(group);

  QGridLayout *grid = new QGridLayout( group, 5, 2, KDialog::marginHint(),
                       KDialog::spacingHint(), "grid");
  grid->addRowSpacing(0, group->fontMetrics().height());
  grid->setColStretch(0, 1);
  grid->setColStretch(1, 1);

  QHBoxLayout *hlay = new QHBoxLayout( KDialog::spacingHint() );
  grid->addMultiCellLayout(hlay, 1,1, 0,1);
  greetstr_lined = new KLineEdit(group);
  QLabel *label = new QLabel(greetstr_lined, i18n("&Greeting:"), group);
  hlay->addWidget(label);
  connect(greetstr_lined, SIGNAL(textChanged(const QString&)),
      SLOT(changed()));
  hlay->addWidget(greetstr_lined);
  wtstr = i18n("This is the \"headline\" for KDM's login window. You may want to "
           "put some nice greeting or information about the operating system here.<p>"
           "KDM will substitute the following character pairs with the "
           "respective contents:<br><ul>"
           "<li>%d -> current display</li>"
           "<li>%h -> host name, possibly with domain name</li>"
           "<li>%n -> node name, most probably the host name without domain name</li>"
           "<li>%s -> the operating system</li>"
           "<li>%r -> the operating system's version</li>"
           "<li>%m -> the machine (hardware) type</li>"
           "<li>%% -> a single %</li>"
           "</ul>" );
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( greetstr_lined, wtstr );


  QGridLayout *hglay = new QGridLayout( 3, 4, KDialog::spacingHint() );
  grid->addMultiCellLayout(hglay, 2,4, 0,0);

  label = new QLabel(i18n("Logo area:"), group);
  hglay->addWidget(label, 0, 0);
  QVBoxLayout *vlay = new QVBoxLayout( KDialog::spacingHint() );
  hglay->addMultiCellLayout(vlay, 0,0, 1,2);
  noneRadio = new QRadioButton( i18n("logo area", "&None"), group );
  clockRadio = new QRadioButton( i18n("Show cloc&k"), group );
  logoRadio = new QRadioButton( i18n("Sho&w logo"), group );
  QButtonGroup *buttonGroup = new QButtonGroup( group );
  label->setBuddy( buttonGroup );
  connect( buttonGroup, SIGNAL(clicked(int)), SLOT(slotAreaRadioClicked(int)) );
  connect( buttonGroup, SIGNAL(clicked(int)), SLOT(changed()) );
  buttonGroup->hide();
  buttonGroup->insert(noneRadio, KdmNone);
  buttonGroup->insert(clockRadio, KdmClock);
  buttonGroup->insert(logoRadio, KdmLogo);
  vlay->addWidget(noneRadio);
  vlay->addWidget(clockRadio);
  vlay->addWidget(logoRadio);
  wtstr = i18n("You can choose to display a custom logo (see below), a clock or no logo at all.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( noneRadio, wtstr );
  QWhatsThis::add( logoRadio, wtstr );
  QWhatsThis::add( clockRadio, wtstr );

  logoLabel = new QLabel(i18n("&Logo:"), group);
  logobutton = new QPushButton(group);
  logoLabel->setBuddy( logobutton );
  logobutton->setAutoDefault(false);
  logobutton->setAcceptDrops(true);
  logobutton->installEventFilter(this); // for drag and drop
  connect(logobutton, SIGNAL(clicked()), SLOT(slotLogoButtonClicked()));
  hglay->addWidget(logoLabel, 1, 0);
  hglay->addWidget(logobutton, 1, 1, AlignCenter);
  hglay->addRowSpacing(1, 110);
  wtstr = i18n("Click here to choose an image that KDM will display. "
	       "You can also drag and drop an image onto this button "
	       "(e.g. from Konqueror).");
  QWhatsThis::add( logoLabel, wtstr );
  QWhatsThis::add( logobutton, wtstr );
  hglay->addRowSpacing( 2, KDialog::spacingHint());
  hglay->setColStretch( 3, 1);


  hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
  grid->addLayout(hglay, 2, 1);

  label = new QLabel(i18n("Position:"), group);
  hglay->addMultiCellWidget(label, 0,1, 0,0, AlignVCenter);
  QValidator *posValidator = new QIntValidator(0, 100, group);
  QLabel *xLineLabel = new QLabel(i18n("&X:"), group);
  hglay->addWidget(xLineLabel, 0, 1);
  xLineEdit = new QLineEdit (group);
  connect( xLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
  hglay->addWidget(xLineEdit, 0, 2);
  xLineLabel->setBuddy(xLineEdit);
  xLineEdit->setValidator(posValidator);
  QLabel *yLineLabel = new QLabel(i18n("&Y:"), group);
  hglay->addWidget(yLineLabel, 1, 1);
  yLineEdit = new QLineEdit (group);
  connect( yLineEdit, SIGNAL( textChanged(const QString&) ), SLOT( changed() ));
  hglay->addWidget(yLineEdit, 1, 2);
  yLineLabel->setBuddy(yLineEdit);
  yLineEdit->setValidator(posValidator);
  wtstr = i18n("Here you specify the relative coordinates (in percent) of the login dialog's <em>center</em>.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( xLineLabel, wtstr );
  QWhatsThis::add( xLineEdit, wtstr );
  QWhatsThis::add( yLineLabel, wtstr );
  QWhatsThis::add( yLineEdit, wtstr );
  hglay->setColStretch( 3, 1);
  hglay->setRowStretch( 2, 1);


  hglay = new QGridLayout( 2, 3, KDialog::spacingHint() );
  grid->addLayout(hglay, 3, 1);
  hglay->setColStretch(3, 1);

  guicombo = new KBackedComboBox(group);
  guicombo->insertItem( "", i18n("<default>") );
  loadGuiStyles(guicombo);
  guicombo->listBox()->sort();
  label = new QLabel(guicombo, i18n("GUI s&tyle:"), group);
  connect(guicombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 0, 0);
  hglay->addWidget(guicombo, 0, 1);
  wtstr = i18n("You can choose a basic GUI style here that will be "
        "used by KDM only.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( guicombo, wtstr );

  colcombo = new KBackedComboBox(group);
  colcombo->insertItem( "", i18n("<default>") );
  loadColorSchemes(colcombo);
  colcombo->listBox()->sort();
  label = new QLabel(colcombo, i18n("&Color scheme:"), group);
  connect(colcombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 1, 0);
  hglay->addWidget(colcombo, 1, 1);
  wtstr = i18n("You can choose a basic Color Scheme here that will be "
        "used by KDM only.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( colcombo, wtstr );

  echocombo = new KBackedComboBox(group);
  echocombo->insertItem("NoEcho", i18n("No Echo"));
  echocombo->insertItem("OneStar", i18n("One Star"));
  echocombo->insertItem("ThreeStars", i18n("Three Stars"));
  label = new QLabel(echocombo, i18n("Echo &mode:"), group);
  connect(echocombo, SIGNAL(activated(int)), SLOT(changed()));
  hglay->addWidget(label, 2, 0);
  hglay->addWidget(echocombo, 2, 1);
  wtstr = i18n("You can choose whether and how KDM shows your password when you type it.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( echocombo, wtstr );


  // The Language group box
  group = new QGroupBox(0, Vertical, i18n("Locale"), this);
  vbox->addWidget(group);

  langcombo = new KLanguageButton(group);
  loadLanguageList(langcombo);
  connect(langcombo, SIGNAL(activated(const QString &)), SLOT(changed()));
  label = new QLabel(langcombo, i18n("Languag&e:"), group);
  QGridLayout *hbox = new QGridLayout( group->layout(), 2, 2, KDialog::spacingHint() );
  hbox->setColStretch(1, 1);
  hbox->addWidget(label, 1, 0);
  hbox->addWidget(langcombo, 1, 1);
  wtstr = i18n("Here you can choose the language used by KDM. This setting does not affect"
    " a user's personal settings; that will take effect after login.");
  QWhatsThis::add( label, wtstr );
  QWhatsThis::add( langcombo, wtstr );


  vbox->addStretch(1);

}
コード例 #16
0
GofunURLComposer::GofunURLComposer()
{
	setCaption(tr("Url Composer"));
	
	QGridLayout* grid = new QGridLayout(this);
	QGridLayout* grid_url = new QGridLayout();
	
	QGroupBox* gb_advanced = new QGroupBox(tr("Advanced"),this);
	gb_advanced->setColumnLayout(0, Qt::Vertical );
	gb_advanced->layout()->setSpacing( 6 );
	gb_advanced->layout()->setMargin( 5 );
	
	QGridLayout* grid_advanced = new QGridLayout(gb_advanced->layout());
	
	scheme = new QComboBox(gb_advanced);
	scheme->insertItem("http");
	scheme->insertItem("shttp");
	scheme->insertItem("ftp");
	scheme->insertItem("file");
	scheme->insertItem(tr("Other"));
	other_scheme = new QLineEdit(gb_advanced);
	other_scheme->setEnabled(false);
	
	host = new QLineEdit(gb_advanced);
	port = new QLineEdit(gb_advanced);
	QIntValidator* port_validator = new QIntValidator(-1,65535,gb_advanced);
	port->setValidator(port_validator);
	path = new QLineEdit(gb_advanced);
	query = new QLineEdit(gb_advanced);
	
	connect(scheme,SIGNAL(textChanged(const QString&)),this,SLOT(schemeChanged(const QString&)));
	connect(scheme,SIGNAL(activated(const QString& )),this,SLOT(schemeChanged(const QString& )));
	connect(other_scheme,SIGNAL(textChanged(const QString&)),this,SLOT(otherSchemeChanged(const QString&)));
	connect(host,SIGNAL(textChanged(const QString&)),this,SLOT(hostChanged(const QString&)));
	connect(port,SIGNAL(textChanged(const QString&)),this,SLOT(portChanged(const QString&)));
	connect(path,SIGNAL(textChanged(const QString&)),this,SLOT(pathChanged(const QString&)));
	connect(query,SIGNAL(textChanged(const QString&)),this,SLOT(queryChanged(const QString&)));	
	
	grid_advanced->addWidget(new QLabel(tr("Scheme"),gb_advanced),0,0);
	grid_advanced->addWidget(scheme,0,1);
	grid_advanced->addWidget(other_scheme,0,2);
	grid_advanced->addWidget(new QLabel(tr("Host"),gb_advanced),1,0);
	grid_advanced->addMultiCellWidget(host,1,1,1,2);
	grid_advanced->addWidget(new QLabel(tr("Port"),gb_advanced),2,0);
	grid_advanced->addMultiCellWidget(port,2,2,1,2);
	grid_advanced->addWidget(new QLabel(tr("Path"),gb_advanced),3,0);
	grid_advanced->addMultiCellWidget(path,3,3,1,2);
	grid_advanced->addWidget(new QLabel(tr("Query"),gb_advanced),4,0);
	grid_advanced->addMultiCellWidget(query,4,4,1,2);
	
	QGroupBox* gb_fetch = new QGroupBox(tr("Fetch URL"),this);
	gb_fetch->setColumnLayout(3, Qt::Vertical );
	gb_fetch->layout()->setSpacing( 6 );
	gb_fetch->layout()->setMargin( 5 );
	
	QPushButton* fetch_file = new QPushButton(tr("File"),gb_fetch);
	QPushButton* fetch_directory = new QPushButton(tr("Directory"),gb_fetch);
	QPushButton* fetch_browser = new QPushButton(tr("Internet"),gb_fetch);
	
	connect(fetch_file,SIGNAL(clicked()),this,SLOT(fetchFile()));
	connect(fetch_directory,SIGNAL(clicked()),this,SLOT(fetchDirectory()));
	connect(fetch_browser,SIGNAL(clicked()),this,SLOT(fetchWithWebBrowser()));
	
	grid_url->addWidget(gb_fetch,0,0);
	grid_url->addWidget(gb_advanced,0,1);
	grid_url->addWidget(new QLabel(tr("URL"),this),1,0);
	
	QGroupBox* gb_url = new QGroupBox(tr("URL"),this);
	gb_url->setColumnLayout(1, Qt::Vertical );
	gb_url->layout()->setSpacing( 6 );
	gb_url->layout()->setMargin( 5 );

	composed_url = new GofunClipboardLineEdit(gb_url);
	
	connect(composed_url,SIGNAL(textChanged(const QString&)),this,SLOT(composedChanged(const QString&)));
	
	grid_url->addMultiCellWidget(gb_url,1,1,0,1);
	
	QPushButton* ok_button = new QPushButton(tr("Ok"),this);
	QPushButton* cancel_button = new QPushButton(tr("Cancel"),this);
	QPushButton* test_button = new QPushButton(tr("Test"),this);
	
	connect(ok_button,SIGNAL(clicked()),this,SLOT(accept()));
	connect(cancel_button,SIGNAL(clicked()),this,SLOT(reject()));
	connect(test_button,SIGNAL(clicked()),this,SLOT(test()));
	
	grid->addMultiCellLayout(grid_url,0,0,0,3);
	
	grid->addWidget(ok_button,1,0);
	grid->addWidget(cancel_button,1,1);
	QSpacerItem* spacer = new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Minimum);
	grid->addItem(spacer,1,2);
	grid->addWidget(test_button,1,3);
	
	link_item = 0;
};
コード例 #17
0
ファイル: editcontactdialog.cpp プロジェクト: nijel/kalcatel
EditContactDialog::EditContactDialog(AlcatelCategoryList *cat, AlcatelContactList *lst, const AlcatelContact *cont, QWidget *parent, const char *name ) : KDialog(parent,name,true) {
    contact = cont;
    list= lst;
    categories = cat;

    QLabel *label;
    QFrame *line;

    resize(500, 580 );
    if (cont == NULL) setCaption( i18n( "New contact" ) );
    else setCaption( i18n( "Edit contact" ) );

    QGridLayout *mainLayout = new QGridLayout( this );
    mainLayout->setSpacing( 6 );
    mainLayout->setMargin( 8 );

    if (cont == NULL) label = new QLabel( i18n("<b>New contact</b>"), this );
    else label = new QLabel( i18n("<b>Edit contact</b>"), this );
    mainLayout->addMultiCellWidget(label,0,0,0,3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,1,1,0,3);

    mainLayout->setRowStretch(0, -1);
    mainLayout->setRowStretch(1, -1);

    mainLayout->addWidget(new QLabel(i18n("First name"), this), 2, 0);
    mainLayout->addWidget(editFirstName = new QLineEdit(this), 2, 1);

    mainLayout->addWidget(new QLabel(i18n("Last name"), this), 2, 2);
    mainLayout->addWidget(editLastName = new QLineEdit(this), 2, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,3,3,0,3);

    mainLayout->addWidget(new QLabel(i18n("Company"), this), 4, 0);
    mainLayout->addWidget(editCompany = new QLineEdit(this), 4, 1);

    mainLayout->addWidget(new QLabel(i18n("Job title"), this), 4, 2);
    mainLayout->addWidget(editJobTitle = new QLineEdit(this), 4, 3);

    mainLayout->addWidget(new QLabel(i18n("Category"), this), 5, 0);
    mainLayout->addWidget(editCategory = new KComboBox(this), 5, 1);

    editCategory->insertItem(i18n("Not set")); /* -1 */
    editCategory->insertItem(i18n("none_category", "None")); /* 255 */
    for( AlcatelCategoryList::Iterator c_it = categories->begin(); c_it != categories->end(); ++c_it ) {
        editCategory->insertItem((*c_it).Name);
    }
//    , (*c_it).Id

    mainLayout->addWidget(new QLabel(i18n("Private"), this), 5, 2);
    mainLayout->addWidget(editPrivate = new QCheckBox(this), 5, 3);

    mainLayout->addWidget(new QLabel(i18n("Note"), this), 6, 0); /* this will be longer */
    mainLayout->addMultiCellWidget(editNote = new QLineEdit(this), 6, 6, 1, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,7,7,0,3);

    mainLayout->addWidget(new QLabel(i18n("Work number"), this),8 , 0);
    mainLayout->addWidget(editWorkNumber = new QLineEdit(this),8 , 1);
    editWorkNumber->setValidator(new PhoneNumberValidator(true, true, false, editWorkNumber));

    mainLayout->addWidget(new QLabel(i18n("Main number"), this),8 , 2);
    mainLayout->addWidget(editMainNumber = new QLineEdit(this),8 , 3);
    editMainNumber->setValidator(new PhoneNumberValidator(true, true, false, editMainNumber));

    mainLayout->addWidget(new QLabel(i18n("Fax number"), this),9 , 0);
    mainLayout->addWidget(editFaxNumber = new QLineEdit(this),9 , 1);
    editFaxNumber->setValidator(new PhoneNumberValidator(true, true, false, editFaxNumber));

    mainLayout->addWidget(new QLabel(i18n("Other number"), this),9 , 2);
    mainLayout->addWidget(editOtherNumber = new QLineEdit(this),9 , 3);
    editOtherNumber->setValidator(new PhoneNumberValidator(true, true, false, editOtherNumber));

    mainLayout->addWidget(new QLabel(i18n("Pager number"), this),10 , 0);
    mainLayout->addWidget(editPagerNumber = new QLineEdit(this),10 , 1);
    editPagerNumber->setValidator(new PhoneNumberValidator(true, true, false, editPagerNumber));

    mainLayout->addWidget(new QLabel(i18n("Mobile number"), this),10 , 2);
    mainLayout->addWidget(editMobileNumber = new QLineEdit(this),10 , 3);
    editMobileNumber->setValidator(new PhoneNumberValidator(true, true, false, editMobileNumber));

    mainLayout->addWidget(new QLabel(i18n("Home number"), this),11 , 0);
    mainLayout->addWidget(editHomeNumber = new QLineEdit(this),11 , 1);
    editHomeNumber->setValidator(new PhoneNumberValidator(true, true, false, editHomeNumber));

/* what should be here?
    mainLayout->addWidget(new QLabel(i18n(""), this), , 2);*/

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,12,12,0,3);

    mainLayout->addWidget(new QLabel(i18n("Email 1"), this), 13, 0);
    mainLayout->addWidget(editEmail1 = new QLineEdit(this), 13, 1);

    mainLayout->addWidget(new QLabel(i18n("Email 2"), this), 13, 2);
    mainLayout->addWidget(editEmail2 = new QLineEdit(this), 13, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,14,14,0,3);

    mainLayout->addWidget(new QLabel(i18n("Address"), this), 15, 0); /* this will be longer */
    mainLayout->addMultiCellWidget(editAddress = new QLineEdit(this), 15, 15, 1, 3);

    mainLayout->addWidget(new QLabel(i18n("City"), this), 16, 0);
    mainLayout->addWidget(editCity = new QLineEdit(this), 16, 1);

    mainLayout->addWidget(new QLabel(i18n("Zip"), this), 16, 2);
    mainLayout->addWidget(editZip = new QLineEdit(this), 16, 3);

    mainLayout->addWidget(new QLabel(i18n("State"), this), 17, 0);
    mainLayout->addWidget(editState = new QLineEdit(this), 17, 1);

    mainLayout->addWidget(new QLabel(i18n("Country"), this), 17, 2);
    mainLayout->addWidget(editCountry = new QLineEdit(this), 17, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,18,18,0,3);

    mainLayout->addWidget(new QLabel(i18n("Custom 1"), this), 19, 0);
    mainLayout->addWidget(editCustom1 = new QLineEdit(this), 19, 1);

    mainLayout->addWidget(new QLabel(i18n("Custom 2"), this), 19, 2);
    mainLayout->addWidget(editCustom2 = new QLineEdit(this), 19, 3);

    mainLayout->addWidget(new QLabel(i18n("Custom 3"), this), 20, 0);
    mainLayout->addWidget(editCustom3 = new QLineEdit(this), 20, 1);

    mainLayout->addWidget(new QLabel(i18n("Custom 4"), this), 20, 2);
    mainLayout->addWidget(editCustom4 = new QLineEdit(this), 20, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,21,21,0,3);

    mainLayout->addWidget(new QLabel(i18n("Storage"), this), 22, 0);

    editStorage = new KComboBox(this);
    editStorage->insertItem(i18n("none_storage", "None"));
    editStorage->insertItem(i18n("PC"));
    editStorage->insertItem(i18n("SIM"));
    editStorage->insertItem(i18n("Mobile"));
    connect( editStorage, SIGNAL( activated(int)), this, SLOT( slotStorage(int)));
    editStorage->setCurrentItem(1);
    mainLayout->addWidget(editStorage, 22, 1);

    mainLayout->addWidget(new QLabel(i18n("Position"), this), 22, 2);

    editPosition = new KIntNumInput(this);
    editPosition->setRange(-1, 9999,1,false);
    editPosition->setSpecialValueText(i18n("Auto"));
    mainLayout->addWidget(editPosition, 22, 3);

    QHBoxLayout *layout = new QHBoxLayout;

    layout->setSpacing( 6 );
    layout->setMargin( 0 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout->addItem( spacer );

    QPushButton *buttonOK = new QPushButton(i18n("&OK"), this);
    buttonOK->setDefault(true);
    layout->addWidget(buttonOK);

    QPushButton *buttonCancel = new QPushButton(i18n("&Cancel"), this);
    layout->addWidget(buttonCancel);

    mainLayout->addMultiCellLayout( layout, 24,24, 0,3 );

    line = new QFrame( this);
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );

    mainLayout->addMultiCellWidget( line, 23,23, 0,3 );
    connect( buttonOK, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );

    editPosition->setEnabled(false);
    loadContact();
    if (contact == NULL) editPosition->setValue(-1);
    editStorage->setEnabled(contact == NULL);
}