dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) : QDialog(parent), ui(new Ui::dlgPackageExporter) { mpHost = host; ui->setupUi(this); treeWidget = ui->treeWidget; closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close); exportButton = new QPushButton(tr("&Export")); // //HEIKO: added ability to make fully fledged Mudlet packages including a package // name config file and arbitray additional package content selection. // However, this feature is currently restricted to windows only // until quazip is part of the other Mudlet builds //#ifdef Q_OS_WIN ui->browseButton->hide(); ui->filePath->hide(); ui->textLabel1->hide(); packageName = QInputDialog::getText(0,"Package Name", "Package Name"); QString packagePath = QFileDialog::getExistingDirectory(0,"Where do you want to save the package?","Where do you want to save the package?"); tempDir = QDir::homePath()+"/.config/mudlet/profiles/"+mpHost->getName()+"/tmp/"; packagePath.replace("\\", "/"); tempDir = tempDir + "/" + packageName; QDir packageDir = QDir(tempDir); if ( !packageDir.exists() ){ packageDir.mkpath(tempDir); } zipFile = packagePath + "/" + packageName + ".zip"; filePath = tempDir + "/" + packageName + ".xml"; QString luaConfig = tempDir + "/config.lua"; QFile configFile(luaConfig); QStringList strings; if (configFile.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&configFile); out << "mpackage = \"" << packageName << "\"\n"; out.flush(); configFile.close(); } connect(ui->addFiles, SIGNAL(clicked()), this, SLOT(slot_addFiles())); //#else // ui->addFiles->hide(); // ui->textLabel1_2->hide(); // connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button())); // exportButton->setDisabled(true); // disabled by default until the user selects a location //#endif ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole); connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package())); listTriggers(); listAliases(); listKeys(); listScripts(); listActions(); listTimers(); }
dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) : QDialog(parent), ui(new Ui::dlgPackageExporter) { mpHost = host; ui->setupUi(this); treeWidget = ui->treeWidget; connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button())); closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close); exportButton = new QPushButton(tr("&Export")); exportButton->setDisabled(true); // disabled by default until the user selects a location ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole); connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package())); listTriggers(); listAliases(); listKeys(); listScripts(); listActions(); listTimers(); }
void ManageSieveCommand::execute() { if ( d->done ) return; bool ok = true; switch ( d->cmd ) { case Logout: log( "Received LOGOUT command", Log::Debug ); d->sieve->Connection::setState( Connection::Closing ); break; case Capability: end(); if ( d->no.isEmpty() ) d->sieve->capabilities(); break; case StartTls: ok = startTls(); break; case Authenticate: ok = authenticate(); break; case HaveSpace: ok = haveSpace(); break; case PutScript: ok = putScript(); break; case ListScripts: ok = listScripts(); break; case SetActive: ok = setActive(); break; case GetScript: ok = getScript(); break; case DeleteScript: ok = deleteScript(); break; case RenameScript: ok = renameScript(); break; case Noop: ok = noop(); break; case XAoxExplain: ok = explain(); break; case Unknown: no( "Unknown command" ); break; } if ( d->query && d->query->failed() && d->no.isEmpty() ) no( "Database failed: " + d->query->error() ); else if ( d->t && d->t->failed() && d->no.isEmpty() ) no( "Database failed: " + d->t->error() ); // XXX need to rollback? if ( !d->no.isEmpty() ) ok = true; if ( !ok ) return; d->done = true; if ( d->no.isEmpty() ) { d->sieve->enqueue( "OK" ); if ( !d->ok.isEmpty() ) { d->sieve->enqueue( " " ); d->sieve->enqueue( encoded( d->ok ) ); } d->sieve->enqueue( "\r\n" ); } else { d->sieve->enqueue( "NO" ); if ( !d->no.isEmpty() ) { d->sieve->enqueue( " " ); d->sieve->enqueue( encoded( d->no ) ); } d->sieve->enqueue( "\r\n" ); }; d->sieve->runCommands(); }