コード例 #1
0
ファイル: kgitview.cpp プロジェクト: fredollinger/kscope-kde4
/*!
    \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();
}
コード例 #2
0
ファイル: kgitview.cpp プロジェクト: fredollinger/kscope-kde4
/*!
    \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
			}
		}