AddRelationDialog::AddRelationDialog(Project &project, Relation *rel, QWidget *p, const QString& caption, ButtonCodes buttons) : KDialog(p), m_project( project ), m_relation( rel ), m_deleterelation( true ) { setCaption( caption ); setButtons( buttons ); setDefaultButton( Ok ); showButtonSeparator( true ); if ( caption.isEmpty() ) { setCaption( i18nc( "@title:window", "Add Dependency" ) ); } m_relation = rel; m_panel = new RelationPanel(this); setMainWidget(m_panel); m_panel->activateWindow(); m_panel->fromName->setText(rel->parent()->name()); m_panel->toName->setText(rel->child()->name()); if (rel->type() == Relation::FinishStart) { m_panel->bFinishStart->setChecked(true); } else if (rel->type() == Relation::FinishFinish) { m_panel->bFinishFinish->setChecked(true); } else if (rel->type() == Relation::StartStart) { m_panel->bStartStart->setChecked(true); } m_panel->lag->setUnit( Duration::Unit_h ); m_panel->lag->setValue(rel->lag().toDouble( Duration::Unit_h ) ); //FIXME store user input m_panel->relationType->setFocus(); enableButtonOk(true); //connect(m_panel->relationType, SIGNAL(clicked(int)), SLOT(typeClicked(int))); connect(m_panel->bFinishStart, SIGNAL(toggled(bool)), SLOT(slotFinishStartToggled(bool))); connect(m_panel->bFinishFinish, SIGNAL(toggled(bool)), SLOT(slotFinishFinishToggled(bool))); connect(m_panel->bStartStart, SIGNAL(toggled(bool)), SLOT(slotStartStartToggled(bool))); connect(m_panel->lag, SIGNAL(valueChanged(double)), SLOT(lagChanged())); connect(&project, SIGNAL(nodeRemoved(Node*)), SLOT(slotNodeRemoved(Node*))); }
KReplaceDialog::KReplaceDialog( ReplaceTool* tool, QWidget* parent ) : KAbstractFindDialog( parent ), mTool( tool ) { setCaption( i18nc("@title:window","Replace Bytes") ); setButtonGuiItem( Ok, KGuiItem( i18nc("@action;button", "&Replace"), QLatin1String("edit-find-replace"), i18nc("@info:tooltip","Start replace"), i18nc("@info:whatsthis", "If you press the <interface>Replace</interface> button, " "the bytes you entered above are searched for within " "the byte array and any occurrence is replaced with " "the replacement bytes.")) ); setupFindBox(); // replace term QGroupBox *ReplaceBox = new QGroupBox( i18nc("@title:group","Replace With"), mainWidget() ); QVBoxLayout *ReplaceBoxLayout = new QVBoxLayout; ReplaceDataEdit = new Okteta::ByteArrayComboBox( ReplaceBox ); const QString toolTip = i18nc("@info:tooltip", "Enter the bytes to replace with, or select bytes previously replaced with from the list."); ReplaceDataEdit->setToolTip( toolTip ); ReplaceBoxLayout->addWidget( ReplaceDataEdit ); ReplaceBox->setLayout( ReplaceBoxLayout ); setupOperationBox( ReplaceBox ); // PromptCheckBox = new QCheckBox( i18nc("@option:check","&Prompt on replace") ); PromptCheckBox->setWhatsThis( i18nc("@info:whatsthis","Ask before replacing each match found.") ); setupCheckBoxes( PromptCheckBox ); enableButtonOk( false ); setModal( true ); }
void RemoteDevicePropertiesDialog::show(const DeviceOptions &opts, const RemoteFsDevice::Details &det, int props, int disabledProps, bool create, bool isConnected) { isCreate=create; if (isCreate) { setCaption(tr("Add Device")); } if (create) { devProp->setVisible(false); } else { tab->setCurrentIndex(isConnected ? 1 : 0); } devProp->setEnabled(!create && isConnected); devProp->showRemoteConnectionNote(!isConnected); devProp->update(QString(), opts, QList<DeviceStorage>(), props, disabledProps); remoteProp->update(det, create, isConnected); connect(devProp, SIGNAL(updated()), SLOT(enableOkButton())); connect(remoteProp, SIGNAL(updated()), SLOT(enableOkButton())); Dialog::show(); enableButtonOk(false); }
PolicyDlg::PolicyDlg (const QString& caption, QWidget *parent, const char *name) : KDialog( parent ) { setObjectName( name ); setModal( true ); setCaption( caption ); setButtons( Ok|Cancel ); m_dlgUI = new PolicyDlgUI (this); setMainWidget(m_dlgUI); m_dlgUI->leDomain->setValidator(new DomainLineValidator(m_dlgUI->leDomain)); m_dlgUI->cbPolicy->setMinimumWidth( m_dlgUI->cbPolicy->fontMetrics().maxWidth() * 25 ); enableButtonOk( false ); connect(m_dlgUI->leDomain, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged(const QString&))); setFixedSize (sizeHint()); m_dlgUI->leDomain->setFocus (); }
void NamedAreaDialog::slotNew() { QPointer<EditNamedAreaDialog> dialog = new EditNamedAreaDialog(this, m_selection); dialog->setCaption(i18n("New Named Area")); dialog->setRegion(*m_selection); dialog->exec(); if (dialog->result() == Rejected) return; if (dialog->areaName().isEmpty()) return; m_list->addItem(dialog->areaName()); QList<QListWidgetItem*> items = m_list->findItems(dialog->areaName(), Qt::MatchExactly | Qt::MatchCaseSensitive); m_list->setCurrentItem(items.first()); displayAreaValues(dialog->areaName()); delete dialog; enableButtonOk(true); enableButton(KDialog::User1, true); enableButton(KDialog::User2, true); }
void FileDlg::slotUpdateOkButton() { bool hasName = !ui.name->text().isEmpty(); bool hasUrls = m_urlWidget->hasUrls(); bool isDuplicate = (m_currentFileNames.indexOf(ui.name->text()) > -1); QStringList information; if (!hasName) { information << i18n("Enter a filename."); } if (isDuplicate) { information << i18n("The filename exists already, choose a different one."); } if (!hasUrls) { information << i18n("Enter at least one URL."); } ui.infoWidget->setText(information.join(" ")); ui.infoWidget->setVisible(!information.isEmpty()); enableButtonOk(hasName && hasUrls && !isDuplicate); }
ProvidersEditor::ProvidersEditor( QWidget *parent, bool newProvider, const QSqlDatabase& database ) : KDialog( parent ) { modelCreated = false; db = database; enableButtonOk(false); ui = new ProvidersEditorUI( this ); setMainWidget( ui ); setCaption( i18n("Product Editor") ); setButtons( KDialog::Ok|KDialog::Cancel ); connect( ui->btnRemove, SIGNAL(clicked()), SLOT( removeItem()) ); connect( ui->btnAttach, SIGNAL(clicked()), SLOT( addItem()) ); connect( ui->editName, SIGNAL(editingFinished()), this, SLOT(checkFieldsState())); connect( ui->editAddress, SIGNAL(textChanged()), this, SLOT(checkFieldsState())); connect( ui->editPhone, SIGNAL(editingFinished()), this, SLOT(checkFieldsState())); connect( ui->editCell, SIGNAL(textChanged(const QString &)), this, SLOT(checkFieldsState())); QString path = KStandardDirs::locate("appdata", "styles/"); path = path+"floating_bottom.svg"; panel = new MibitFloatPanel(this, path, Bottom); panel->setSize(350,200); panel->setMode(pmManual); panel->setHiddenTotally(true); panel->addWidget(ui->attachment); connect( ui->btnAdd, SIGNAL(clicked()), panel, SLOT( showPanel() ) ); connect( ui->btnAttach, SIGNAL(clicked()), panel, SLOT( hidePanel() ) ); connect( ui->btnCancelAttach, SIGNAL(clicked()), panel, SLOT( hidePanel()) ); m_pInfo.id = 0; m_pInfo.name = ""; m_pInfo.address = ""; m_pInfo.phone = ""; m_pInfo.cell = ""; }
void SectionFormatDialog::updateTreeState() { if (!m_curIdx.isValid()) { return; } bool allOk = true; QPalette pal = m_widget.sectionNameLineEdit->palette(); if (!m_widget.sectionNameLineEdit->hasAcceptableInput()) { KColorScheme::adjustBackground(pal, KColorScheme::NegativeBackground); m_widget.sectionNameLineEdit->setPalette(pal); QToolTip::showText(m_widget.sectionNameLineEdit->mapToGlobal(QPoint()), i18n("Invalid characters or section with such name exists.")); allOk = false; } else { KColorScheme::adjustBackground(pal, KColorScheme::NormalBackground); m_widget.sectionNameLineEdit->setPalette(pal); } m_widget.sectionTree->setEnabled(allOk); enableButtonOk(allOk); }
ReservationsDialog::ReservationsDialog( QWidget *parent, Gaveta *theDrawer, int userid ) : KDialog( parent ) { drawer = theDrawer; userId = userid; m_modelAssigned = false; trNumber = 0; rNumber = 0; rPayment = 0; rProfit = 0; item_discounts = ""; ui = new ReservationsDialogUI( this ); setMainWidget( ui ); setCaption( i18n("Reservations") ); setButtons( KDialog::Ok|KDialog::Cancel ); enableButtonOk(false); QString path = KStandardDirs::locate("appdata", "styles/"); path = path+"floating_bottom.svg"; panel = new MibitFloatPanel(this, path, Top); panel->setSize(250,150); panel->addWidget(ui->confirmFrame); panel->setMode(pmManual); panel->setHiddenTotally(true); panel->hide(); connect(ui->btnYes, SIGNAL(clicked()), SLOT(cancelReservation() )); connect(ui->btnNo, SIGNAL(clicked()), panel, SLOT(hidePanel() )); connect(ui->btnCancelReservation, SIGNAL(clicked()), panel, SLOT(showPanel() )); connect(ui->tableWidget, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); setDefaultButton(KDialog::Ok); //disable the cancel button ui->btnCancelReservation->setDisabled(true); }
void NewAuthor::checkIfComplete() { bool complete = !ui.leName->text().isEmpty() && !ui.leContact->text().isEmpty(); enableButtonOk(complete); }
void LocaleConfigMoneyDialog::slotChanged() { enableButtonOk(true); }
void AddRelationDialog::lagChanged() { enableButtonOk(true); }
void AddRelationDialog::typeClicked(int id) { if (id != m_relation->type()) enableButtonOk(true); }
void ManageBookmarkDialog::selectionChanged(int currentRow) { enableButtonOk(currentRow != -1); }
void AddRelationDialog::slotStartStartToggled(bool ch) { //kDebug(planDbg())<<ch; if (ch && m_relation->type() != Relation::StartStart) enableButtonOk(true); }
void DevicePropertiesDialog::enableOkButton() { enableButtonOk(devProp->isSaveable() && devProp->isModified()); }
void ExportWorksheetDialog::fileNameChanged(const QString& name) { enableButtonOk( !name.simplified().isEmpty() ); }
void TaskProgressDialog::slotChanged() { enableButtonOk(true); }
void KIGPDialog::imageUrlChanged(const QString &url ) { enableButtonOk( !url.isEmpty()); }
void DictServerDialog::hostNameChangedSlot(const QString& hostname) { enableButtonOk(!hostname.isEmpty()); }
void IngredientParserDialog::parseText() { previewIngView->clear(); Q3ListViewItem *last_item = 0; int line_num = 0; QStringList ingredients; if (ingredientTextEdit->document()->isEmpty()) ingredients = QStringList(); else ingredients = ingredientTextEdit->toPlainText().split( '\n', QString::SkipEmptyParts); for ( QStringList::const_iterator it = ingredients.constBegin(); it != ingredients.constEnd(); ++it ) { QString line = (*it).simplified(); ++line_num; int format_at = 0; Ingredient ing; //======amount======// int first_space = line.indexOf( " ", format_at+1 ); if ( first_space == -1 ) first_space = line.length(); int second_space = line.indexOf( " ", first_space+1 ); if ( second_space == -1 ) second_space = line.length(); Ingredient i; bool ok; i.setAmount(line.mid(format_at,second_space-format_at),&ok); if ( !ok ) { i.setAmount(line.mid(format_at,first_space-format_at),&ok); if ( ok ) format_at = first_space+1; } else format_at = second_space+1; if ( ok ) { ing.amount = i.amount; ing.amount_offset = i.amount_offset; } else kDebug()<<"no amount on line "<<line_num; //======unit======// first_space = line.indexOf( " ", format_at+1 ); if ( first_space == -1 ) first_space = line.length(); bool isUnit = false; QString unitCheck = line.mid(format_at,first_space-format_at); for ( UnitList::const_iterator unit_it = m_unitList.constBegin(); unit_it != m_unitList.constEnd(); ++unit_it ) { if ( (*unit_it).name() == unitCheck || (*unit_it).plural() == unitCheck || (*unit_it).nameAbbrev() == unitCheck || (*unit_it).pluralAbbrev() == unitCheck ) { isUnit = true; format_at = first_space+1; break; } } if ( isUnit ) { ing.units.setName(unitCheck); ing.units.setPlural(unitCheck); } else kDebug()<<"no unit on line "<<line_num; //======ingredient======// int ing_end = line.indexOf( QRegExp("(,|;)"), format_at+1 ); if ( ing_end == -1 ) ing_end = line.length(); ing.name = line.mid(format_at,ing_end-format_at); format_at = ing_end+2; //======prep method======// int end = line.length(); ing.prepMethodList = ElementList::split(",",line.mid(format_at,end-format_at)); last_item = new IngListViewItem(previewIngView,last_item,ing); enableButtonOk( true ); } }
void InputBoxNoCancel::slotTextChanged(const QString& text) { Q_UNUSED(text) enableButtonOk(!d->stringEdit->text().isEmpty()); }
void GrepDialog::patternComboEditTextChanged( const QString& text) { enableButtonOk( !text.isEmpty() ); }
void ItemViewSettup::slotChanged() { emit enableButtonOk( true ); }
SpecialOrderEditor::SpecialOrderEditor( QWidget *parent, bool newOne ) : KDialog( parent ) { m_modelAssigned = false; priceEach = 0; paymentEach = 0; groupInfo.isAvailable = true; groupInfo.cost = 0; groupInfo.price = 0; groupInfo.count = 0; groupInfo.name = ""; ui = new SpecialOrderUI( this ); setMainWidget( ui ); setCaption( i18n("Special Orders") ); setButtons( KDialog::Ok|KDialog::Cancel ); //Set Validators for input boxes ui->editAddQty->setValidator(new QDoubleValidator(0.00, 999999999999.99, 3, ui->editAddQty)); ui->editQty->setValue(1); ui->editAddQty->setText("1.00"); connect( ui->editQty, SIGNAL(editingFinished()), this, SLOT(calculateCost())); connect( ui->editQty, SIGNAL(valueChanged(int)), this, SLOT(calculateCost())); connect( ui->editQty, SIGNAL(editingFinished()), this, SLOT(checkFieldsState())); connect( ui->editPayment, SIGNAL(valueChanged(double)), this, SLOT(checkFieldsState())); connect( ui->editFilter, SIGNAL(textEdited ( const QString &)), SLOT(applyFilter(const QString &)) ); connect( ui->btnAdd, SIGNAL(clicked()), SLOT(addItem()) ); connect( ui->editAddQty, SIGNAL(returnPressed()), SLOT(addItem()) ); connect( ui->btnRemove, SIGNAL(clicked()), SLOT(removeItem()) ); connect( ui->groupView, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), SLOT(itemDoubleClicked(QTableWidgetItem*)) ); connect( ui->deliveryDT, SIGNAL(valueChanged(QDateTime)), this, SLOT(checkDate(QDateTime)) ); connect( ui->editNotes, SIGNAL(textChanged()), SLOT(updateNoteLength()) ); //for now, when creating a s.o. the status cannot be modified. It can be when edited. if (newOne) { dateTime = QDateTime::currentDateTime(); ui->deliveryDT->setDateTime(QDateTime::currentDateTime().addDays(1)); } //tip QString path = KStandardDirs::locate("appdata", "styles/"); path = path+"tip.svg"; qtyTip = new MibitTip(this, ui->editQty, path, DesktopIcon("dialog-warning",32) ); path = KStandardDirs::locate("appdata", "styles/")+"rotated_tip.svg"; groupTip = new MibitTip(this, ui->groupView, path, DesktopIcon("dialog-warning",32), tpAbove ); path = KStandardDirs::locate("appdata", "styles/"); path = path+"floating_bottom.svg"; newClientPanel = new MibitFloatPanel(this, path, Top); newClientPanel->setSize(550,250); newClientPanel->addWidget(ui->frameClient); newClientPanel->setMode(pmManual); newClientPanel->setHiddenTotally(true); ui->editClientName->setEmptyMessage(i18n("Enter client name here...")); ui->editClientPhone->setEmptyMessage(i18n("Enter client phone here...")); ui->editClientCell->setEmptyMessage(i18n("Enter client cell phone here...")); connect( ui->btnNewClient, SIGNAL(clicked()), newClientPanel, SLOT(showPanel() )); connect( ui->btnNewClient, SIGNAL(clicked()), this, SLOT(enableCreateClient() )); connect( ui->btnClientCancel, SIGNAL(clicked()), newClientPanel, SLOT(hidePanel())); connect( ui->btnClientAdd, SIGNAL(clicked()), this, SLOT(createClient())); connect( ui->editClientName, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) ); connect( ui->editClientAddress, SIGNAL(textChanged()), this, SLOT(checkValidInfo()) ); connect( ui->editClientPhone, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) ); connect( ui->editClientCell, SIGNAL(textEdited(const QString &)), this, SLOT(checkValidInfo()) ); setDefaultButton(KDialog::None); ui->btnFilter->setDefault(true); ui->btnFilter->hide(); //hack to dont have a default OK or Cancel button ui->clientsCombo->setFocus(); enableButtonOk(false); }
void RemoteDevicePropertiesDialog::enableOkButton() { bool useDevProp=devProp->isEnabled(); enableButtonOk(remoteProp->isSaveable() && (!useDevProp || devProp->isSaveable()) && (isCreate || remoteProp->isModified() || !useDevProp || devProp->isModified())); }
void SubcategoryEditor::checkValid() { bool validText = !ui->editName->text().isEmpty(); enableButtonOk(validText); }
void UMLEntityAttributeDialog::slotNameChanged(const QString &_text) { enableButtonOk(!_text.isEmpty()); }
void TrackOrganiser::show(const QList<Song> &songs, const QString &udi, bool forceUpdate) { // If we are called from the TagEditor dialog, then forceUpdate will be true. This is so that we dont do 2 // MPD updates (one from TagEditor, and one from here!) alwaysUpdate=forceUpdate; foreach (const Song &s, songs) { if (!CueFile::isCue(s.file)) { origSongs.append(s); } } if (origSongs.isEmpty()) { deleteLater(); if (alwaysUpdate) { doUpdate(); } return; } QString musicFolder; bool isMopidy=false; #ifdef ENABLE_DEVICES_SUPPORT if (udi.isEmpty()) { musicFolder=MPDConnection::self()->getDetails().dir; opts.load(MPDConnectionDetails::configGroupName(MPDConnection::self()->getDetails().name), true); isMopidy=MPDConnection::self()->isMopdidy(); } else { deviceUdi=udi; Device *dev=getDevice(parentWidget()); if (!dev) { deleteLater(); return; } opts=dev->options(); musicFolder=dev->path(); } #else opts.load(MPDConnectionDetails::configGroupName(MPDConnection::self()->getDetails().name), true); musicFolder=MPDConnection::self()->getDetails().dir; isMopidy=MPDConnection::self()->isMopdidy(); #endif qSort(origSongs); filenameScheme->setText(opts.scheme); vfatSafe->setChecked(opts.vfatSafe); asciiOnly->setChecked(opts.asciiOnly); ignoreThe->setChecked(opts.ignoreThe); replaceSpaces->setChecked(opts.replaceSpaces); connect(configFilename, SIGNAL(clicked()), SLOT(configureFilenameScheme())); connect(filenameScheme, SIGNAL(textChanged(const QString &)), this, SLOT(updateView())); connect(vfatSafe, SIGNAL(toggled(bool)), this, SLOT(updateView())); connect(asciiOnly, SIGNAL(toggled(bool)), this, SLOT(updateView())); connect(ignoreThe, SIGNAL(toggled(bool)), this, SLOT(updateView())); connect(replaceSpaces, SIGNAL(toggled(bool)), this, SLOT(updateView())); if (!songsOk(origSongs, musicFolder, udi.isEmpty())) { return; } if (isMopidy) { connect(mopidyNote, SIGNAL(leftClickedUrl()), SLOT(showMopidyMessage())); } else { REMOVE(mopidyNote); } connect(ratingsNote, SIGNAL(leftClickedUrl()), SLOT(showRatingsMessage())); Dialog::show(); enableButtonOk(false); updateView(); }
void PolicyDlg::slotTextChanged( const QString& text ) { enableButtonOk( text.length() > 1 ); }