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(); }
// This function execute builtin functions void do_it(int bi) { switch(comtab[bi].builtin) { case BYE: goodbye = 1; // Set global goodbye variable to true break; case CDHOME: goHome(); break; case CD: // Go to specified path gotoDir(bi); break; case SETALIAS: // Adding alias to the alias table printf("adding alias to table\n"); createAlias(comtab[curr_cmd].atptr->args[0], comtab[curr_cmd].atptr->args[1]); printf("Done adding alias to table\n"); break; case UNALIAS: removeAlias(comtab[curr_cmd].atptr->args[0]); break; case PRINTALIAS: // Print either a specific alias or all aliases if( comtab[curr_cmd].nargs == 0) { printf("calling\n"); listAliases(); // Print all aliases } else { printAnAlias(comtab[curr_cmd].atptr->args[0]); // Print specific alias } break; case SETENV: // Set environment if( putenv( strcat(strcat(comtab[curr_cmd].atptr->args[0],"="),comtab[curr_cmd].atptr->args[1]) ) != 0) { printf("%s\n", strerror(errno)); } break; case UNSETENV: // Removing environment variables if( unsetenv(comtab[bi].atptr->args[0]) == -1) { printf("%s\n", strerror(errno)); } break; case PRINTENV: // Print environment variables printallEnv(); break; } }
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(); }