Exemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////////
// Call the script to install packages setting parameters
// to kiss dependent on flags, returning whether everyting worked
//////////////////////////////////////////////////////////////////////////////
QString KISS::install(int installFlags, QPtrList<packageInfo> *plist, bool &test)
{
  packageInfo *pk;
  int i = 0;
  for (pk = plist->first(); pk != 0; pk = plist->next()) {
    QString fname = pk->fetchFilename();
    if (!fname.isEmpty()) {
      doInstall(installFlags, fname, test);
      i++;
    }
  }
  return 0;
}
Exemplo n.º 2
0
RemoteInstaller::RemoteInstaller(const QString& username, const QString& hostname,
                                 const QString& source, QWidget* parent)
        : QObject(parent),
        m_widget(parent)
{
    //like fish://[email protected]
    m_execUrl.setUrl("fish://" + hostname);
    m_execUrl.setUserName(username);

    //this will be out temp directory. First we need to create a temporary file, and then find its
    //absolute path.
    //Q: Why don't we use the something like
    //const QString temporaryDirectory(KStandardDirs::locate("tmp", "") + "plasmaremoteinstaller/");
    //A: The following code is running in our system. That means that the temporary directory will be something
    //like /tmp/kde-$username. If my user is named foo and the other user is named bar
    //then there is no user foo on the other system. So the /tmp/kde-foo doesn't exist.
    QString temporaryDirectory = QDir::tempPath();
    temporaryDirectory.append("/plasmaremoteinstaller");

    QUrl tmpUrl;
    tmpUrl.setPath(m_execUrl.path() + temporaryDirectory);
    if (!KIO::NetAccess::exists(tmpUrl, KIO::NetAccess::DestinationSide, m_widget)) {
        const bool ok = KIO::NetAccess::mkdir(tmpUrl, m_widget);
        if (!ok) {
            QString text = i18n("Plasma Remote Installer was not able to create a temporary directory in "
                "%1, please check the permissions of %1", temporaryDirectory);
            KMessageBox::error(m_widget, text);
            return;
        }
    }

    //our destination path
    m_destinationPath = m_execUrl;
    m_destinationPath.setPath(temporaryDirectory);

    //we need our source path
    m_sourcePath = source;

    //we will need the dirname of the source
    QDir packageDir(source);

    m_plasmaPkgUrl.append("plasmapkg -u " + temporaryDirectory + packageDir.dirName() + '/');

    //now do the installation
    doInstall();
}
Exemplo n.º 3
0
void CupsAddSmb::slotProcessExited(TDEProcess*)
{
	kdDebug(500) << "PROCESS EXITED (" << m_state << ")" << endl;
	if (m_proc.normalExit() && m_state != Start && m_status)
	{
		// last process went OK. If it was smbclient, then switch to rpcclient
		if (tqstrncmp(m_proc.args().first(), "smbclient", 9) == 0)
		{
			doInstall();
			return;
		}
		else
		{
			m_doit->setEnabled(false);
			m_cancel->setEnabled(true);
			m_cancel->setText(i18n("&Close"));
			m_cancel->setDefault(true);
			m_cancel->setFocus();
			m_logined->setEnabled( true );
			m_servered->setEnabled( true );
			m_passwded->setEnabled( true );
			m_text->setText(i18n("Driver successfully exported."));
			m_bar->reset();
			m_textinfo->setText( TQString::null );
			return;
		}
	}

	if (m_proc.normalExit())
	{
		showError(
				i18n("Operation failed. Possible reasons are: permission denied "
				     "or invalid Samba configuration (see <a href=\"man:/cupsaddsmb\">"
					 "cupsaddsmb</a> manual page for detailed information, you need "
					 "<a href=\"http://www.cups.org\">CUPS</a> version 1.1.11 or higher). "
					 "You may want to try again with another login/password."));

	}
	else
	{
		showError(i18n("Operation aborted (process killed)."));
	}
}
Exemplo n.º 4
0
int doAction(const QString& command, const QString& argument, QStringList *options)
{
	if(command == "get") return doGet(argument, options);
	if(command == "update") return doUpdate(argument, options);
	if(command == "install") return doInstall(argument, options);
}
Exemplo n.º 5
0
int main(int argc, char *argv[]) {
	int ret = EXIT_SUCCESS;                     /* return value */

	/* check parameter */
	if (argc < 2) {
		fprintf(stderr, "ERROR: You need to give some command.\n");
		showHelp();
		return (EXIT_FAILURE);
	}

	initSystem();
	if (gSystem == SYSTEM_ERROR) {
		fprintf(stderr, "ERROR: No package-system found (yum, apt).\n");
		exit(EXIT_FAILURE);
	}

	initCommand(argv[1]);
	initList(argc - 2, (char **)argv + 2);

	switch (gCommand) {
		case COMMAND_HELP:
			showHelp();
			break;
		case COMMAND_VERSION:
			showVersion();
			break;
		case COMMAND_INSTALL:
			if (gList == NULL) {
				fprintf(stderr, "Error: Need to pass a list of pkgs to install.\n");
				showHelp();
				ret = EXIT_FAILURE;
				break;
			}
			doInstall();
			break;
		case COMMAND_REMOVE:
			if (gList == NULL) {
				fprintf(stderr, "Error: Need to pass a list of pkgs to remove.\n");
				showHelp();
				ret = EXIT_FAILURE;
				break;
			}
			doRemove();
			break;
		case COMMAND_SEARCH:
			if (gList == NULL) {
				fprintf(stderr, "Error: Need to pass a list of pkgs to search.\n");
				showHelp();
				ret = EXIT_FAILURE;
				break;
			}
			doSearch();
			break;
		case COMMAND_LIST:
			if (gList == NULL) {
				fprintf(stderr, "Error: Need to pass a list of pkgs to lisst.\n");
				showHelp();
				ret = EXIT_FAILURE;
				break;
			}
			doList();
			break;
		case COMMAND_UPDATE:
			if (gList == NULL) {
				fprintf(stderr, "Error: Need to pass a list of pkgs to update.\n");
				showHelp();
				ret = EXIT_FAILURE;
				break;
			}
			doUpdate();
			break;
		default:
			fprintf(stderr, "ERROR: No such command '%s'. Please use '%s --help'.\n", argv[1], PRG_NAME);
			ret = EXIT_FAILURE;
	}

	destroy();

	return (ret);
}
    void UpdaterDialog::initView()
    {
        /**
         * Set "sortFilterProxy" Model to View
         */
        ui->tableView_1->setModel(sortFilterProxyModel);

        /**
         * Set Item Delegates for "SoftwareComponent" and "Action" Columns
         */
        softwareDelegate = new Updater::SoftwareColumnItemDelegate;
        ui->tableView_1->setItemDelegateForColumn(Columns::SoftwareComponent, softwareDelegate);

        actionDelegate = new Updater::ActionColumnItemDelegate;
        ui->tableView_1->setItemDelegateForColumn(Columns::Action, actionDelegate);

        connect(actionDelegate, SIGNAL(downloadButtonClicked(QModelIndex)), this, SLOT(doDownload(QModelIndex)));
        connect(actionDelegate, SIGNAL(installButtonClicked(QModelIndex)), this, SLOT(doInstall(QModelIndex)));

        /**
         * Configure view
         */
        // enable mouse tracking to be able to bind the mouseover/hover event
        ui->tableView_1->setMouseTracking(true);
        // disable resizing of the columns
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::SoftwareComponent, QHeaderView::Stretch);
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::LatestVersion, QHeaderView::Fixed);
        ui->tableView_1->horizontalHeader()->setSectionResizeMode(Columns::YourVersion, QHeaderView::Fixed);
        // hide columns (1 and 3; both URLs)
        ui->tableView_1->setColumnHidden(Columns::WebsiteURL, true);
        ui->tableView_1->setColumnHidden(Columns::DownloadURL, true);
        // settings
        ui->tableView_1->setAutoScroll(true);
        ui->tableView_1->setAlternatingRowColors(true);
        // sort
        ui->tableView_1->setSortingEnabled(true);
        ui->tableView_1->sortByColumn(Columns::SoftwareComponent, Qt::AscendingOrder);
        // sizes
        ui->tableView_1->verticalHeader()->setDefaultSectionSize(28);
        ui->tableView_1->horizontalHeader()->setDefaultSectionSize(28);
        //ui->tableView_1->resizeRowsToContents();
        ui->tableView_1->resizeColumnsToContents();
        ui->tableView_1->setColumnWidth(Columns::SoftwareComponent, 150);
        ui->tableView_1->setColumnWidth(Columns::LatestVersion, 80);
        ui->tableView_1->setColumnWidth(Columns::YourVersion, 80);
        ui->tableView_1->setColumnWidth(Columns::Action, 200);
    }