void ActionEditor::accept() { // Save any open parameter changes first... saveParameter(); // Read the data and prepare to save QString iconName = ui.IbActionIcon->icon(); QString actionName = ui.LeActionFriendlyName->text(); QString command = ui.LeActionCommand->text(); QString predicate = predicateString(); // We need to ensure that they are all valid before applying if (iconName.isEmpty() || actionName.isEmpty() || command.isEmpty() || !Solid::Predicate::fromString(predicate).isValid()) { KMessageBox::error(this, i18n("It appears that the action name, command, icon or condition are not valid.\nTherefore, changes will not be applied."), i18n("Invalid action")); return; } // apply the changes if (iconName != activeItem->icon()) { // Has the icon changed? activeItem->setIcon( ui.IbActionIcon->icon() ); // Write the change } if (actionName != activeItem->name()) { // Has the friendly name changed? activeItem->setName( ui.LeActionFriendlyName->text() ); // Write the change } if (command != activeItem->exec()) { // Has the command changed? activeItem->setExec( ui.LeActionCommand->text() ); // Write the change } if (predicate != activeItem->predicate().toString() ) { // Has it changed? activeItem->setPredicate( predicate ); // Write the change } QDialog::accept(); }
void Hdd::init() { KGlobal::locale()->insertCatalog("plasma_applet_system-monitor"); QString predicateString("IS StorageVolume"); setEngine(dataEngine("soliddevice")); setTitle(i18n("Disk Space"), true); configChanged(); }
void Hdd::createConfigurationInterface(KConfigDialog *parent) { QWidget *widget = new QWidget(); ui.setupUi(widget); m_hddModel.clear(); m_hddModel.setHorizontalHeaderLabels(QStringList() << i18n("Mount Point") << i18n("Name")); QStandardItem *parentItem = m_hddModel.invisibleRootItem(); Plasma::DataEngine::Data data; QString predicateString("IS StorageVolume"); foreach (const QString& uuid, engine()->query(predicateString)[predicateString].toStringList()) { if (!isValidDevice(uuid, &data)) { continue; } QStandardItem *item1 = new QStandardItem(filePath(data)); item1->setEditable(false); item1->setCheckable(true); item1->setData(uuid); if (sources().contains(uuid)) { item1->setCheckState(Qt::Checked); } QStandardItem *item2 = new QStandardItem(hddTitle(uuid, data)); item2->setData(guessHddTitle(data)); item2->setEditable(true); parentItem->appendRow(QList<QStandardItem *>() << item1 << item2); } ui.treeView->setModel(&m_hddModel); ui.treeView->resizeColumnToContents(0); ui.intervalSpinBox->setValue(interval() / 60 / 1000); ui.intervalSpinBox->setSuffix(ki18np(" minute", " minutes")); parent->addPage(widget, i18n("Partitions"), "drive-harddisk"); connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); connect(ui.treeView, SIGNAL(clicked(QModelIndex)), parent, SLOT(settingsModified())); connect(ui.intervalSpinBox, SIGNAL(valueChanged(QString)), parent, SLOT(settingsModified())); }
void MVJoinTable::print(FILE* ofd, const char* indent, const char* title)const { char buffer[20]; const char *deltaTypeText = NULL; switch (deltaType_) { case EMPTY_DELTA : deltaTypeText = "Empty Delta"; break; case INSERTONLY_DELTA: deltaTypeText = "InsertOnly Delta"; break; case NONEMPTY_DELTA : deltaTypeText = "Nonempty Delta"; break; } fprintf(ofd, "Table no. %d: %s (%s),\n", tableIndex_, tableName_.data(), deltaTypeText); NAString titleString(" "); CollIndex lastBit; predicateBitmap_.lastUsed(lastBit); #pragma nowarn(1506) // warning elimination for (Int32 i=lastBit; i>=0 ; i--) #pragma warn(1506) // warning elimination { snprintf( buffer, 20, "%d", i ); titleString += buffer; titleString += ", "; } NAString predicateString(" "); NAString inRiString(" "); NAString outRiString(" "); BitmapToString(predicateBitmap_, predicateString); BitmapToString(incomingRiBitmap_, inRiString); BitmapToString(outgoingRiBitmap_, outRiString); fprintf(ofd, "\tTableIndices : %s.\n", titleString.data()); fprintf(ofd, "\tPredicates to: %s.\n", predicateString.data()); fprintf(ofd, "\tIncoming RIs : %s.\n", inRiString.data()); fprintf(ofd, "\tOutgoing RIs : %s.\n", outRiString.data()); }