Example #1
0
/*!
    \fn kgitView::slotRefreshGitRepo()
 */
void kgitView::slotRefreshGitRepo()
{
    KProcIO *newProc = new KProcIO;
    *newProc << "git-diff-files";
    *newProc << "--name-only";
    newProc->setWorkingDirectory(c_url.path());
    connect(newProc,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitTree(KProcess *)));
    newProc->start();
    MainDoc->clear();
    KProcIO *newProc2 = new KProcIO;
    *newProc2 << "git";
    *newProc2 << "diff";
    newProc2->setWorkingDirectory(c_url.path());
    connect(newProc2,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitDiff(KProcess *)));
    newProc2->start();

    KProcIO *newProc3 = new KProcIO;
    *newProc3 << "git";
    *newProc3 << "branch";
    newProc3->setWorkingDirectory(c_url.path());
    connect(newProc3,SIGNAL( processExited(KProcess *)),this,SLOT(slotGotGitBranches(KProcess *)));
    newProc3->start();

    ShortLogList->clear();
    KProcIO *newProc4 = new KProcIO;
    *newProc4 << "git";
    *newProc4 << "log";
    newProc4->setWorkingDirectory(c_url.path());
    connect(newProc4,SIGNAL( readReady(KProcIO *)),this,SLOT(slotGitGotLogSummary(KProcIO *)));
    newProc4->start();	
    setBusy();
}
Example #2
0
static int
get_date( const char *str )
{
	KProcIO prc;
	prc << "/bin/date" << "+%s" << "-d" << str;
	prc.start( TDEProcess::Block, false );
	TQString dstr;
	if (prc.readln( dstr, false, 0 ) < 0)
		return -1;
	return dstr.toInt();
}
Example #3
0
/*!
    \fn kgitView::slotCommitCurrent()
 */
void kgitView::slotCommitCurrent()
{
    QString Message;
   
    Message += "Committing Following files\n";
    for ( QStringList::Iterator it = commit_files->begin(); it != commit_files->end(); ++it ) {				Message += "\n\t";
		Message += *it;
    }
 
    Message += "\n\nContinue ?";
    

    QMessageBox mb( "kgit",
	Message,
        QMessageBox::Information,
        QMessageBox::Yes | QMessageBox::Default,
        QMessageBox::Cancel | QMessageBox::Escape,
	0);
    mb.setButtonText( QMessageBox::Yes, "Commit" );
    mb.setButtonText( QMessageBox::No, "Cancel" );
    switch( mb.exec() ) {
	case QMessageBox::Yes:
		{
			bool ok;	
			QString log = KInputDialog::getMultiLineText("KGit", "Please enter commit log message:",QString::null, &ok, this );
			if (ok && !log.isEmpty() ) {
				
				KProcIO *newProc = new KProcIO;
				*newProc << "git-commit";
				
				*newProc << "-m" <<  log;
				
				for ( QStringList::Iterator it = commit_files->begin(); it != commit_files->end(); ++it ) {
						*newProc << *it;
				}
				
				newProc->setWorkingDirectory(c_url.path());
				connect(newProc,SIGNAL( processExited(KProcess *)),this,SLOT(slotRefreshGitRepo()));
				newProc->start();
			} else {
					// user entered nothing or pressed Cancel
			}
		}
Example #4
0
void KFileShare::readShareList()
{
    KFileSharePrivate::self();
    if(!s_shareList)
        sdShareList.setObject(s_shareList, new QStringList);
    else
        s_shareList->clear();

    // /usr/sbin on Mandrake, $PATH allows flexibility for other distributions
    QString exe = findExe("filesharelist");
    if(exe.isEmpty())
    {
        s_authorization = ErrorNotFound;
        return;
    }
    KProcIO proc;
    proc << exe;
    if(!proc.start(KProcess::Block))
    {
        kdError() << "Can't run " << exe << endl;
        s_authorization = ErrorNotFound;
        return;
    }

    // Reading code shamelessly stolen from khostname.cpp ;)
    QString line;
    int length;
    do
    {
        length = proc.readln(line, true);
        if(length > 0)
        {
            if(line[length - 1] != '/')
                line += '/';
            s_shareList->append(line);
            kdDebug(7000) << "Shared dir:" << line << endl;
        }
    } while(length > -1);
}