summaryrefslogtreecommitdiffstats
path: root/vcs/cvsservice/cvslogdialog.cpp
blob: 6d192f387a8901397a2fc58b269bc25c5a27d095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/***************************************************************************
 *   Copyright (C) 200?-2003 by KDevelop Authors                           *
 *   www.tdevelop.org                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <tqvbox.h>
#include <tqregexp.h>
#include <tqdir.h>
#include <tqstringlist.h>

#include <kmessagebox.h>
#include <kcursor.h>
#include <klocale.h>
#include <kdebug.h>

#include <cvsjob_stub.h>
#include <cvsservice_stub.h>

#include "cvsoptions.h"
#include "cvslogpage.h"
#include "cvsdiffpage.h"

#include "cvslogdialog.h"

///////////////////////////////////////////////////////////////////////////////
// class CVSLogDialog
///////////////////////////////////////////////////////////////////////////////

CVSLogDialog::CVSLogDialog( CvsService_stub *cvsService, TQWidget *parent, const char *name, int )
    : KDialogBase( Tabbed, i18n("CVS Log & Diff Dialog"), Close, Close,
    parent, name? name : "logformdialog", false /*modal*/, true /*separator*/ ),
    m_cvsLogPage( 0 ), m_cvsService( cvsService )
{
    setWFlags( getWFlags() | WDestructiveClose );

    TQVBox *vbox = addVBoxPage( i18n("Log From CVS") );
    m_cvsLogPage = new CVSLogPage( m_cvsService, vbox );

    connect( m_cvsLogPage, TQT_SIGNAL(diffRequested(const TQString&, const TQString&, const TQString&)),
        this, TQT_SLOT(slotDiffRequested(const TQString&, const TQString&, const TQString&)) );
}

///////////////////////////////////////////////////////////////////////////////

CVSLogDialog::~CVSLogDialog()
{
    kdDebug(9006) << "CVSLogDialog::~CVSLogDialog()" << endl;
}

///////////////////////////////////////////////////////////////////////////////

void CVSLogDialog::startLog( const TQString &workDir, const TQString &pathName )
{
    kdDebug(9006) << "CVSLogDialog::start() here! workDir = " << workDir <<
        ", pathName = " << pathName << endl;

//    displayActionFeedback( true );
/*
    TQVBox *vbox = addVBoxPage( i18n("Log From CVS: ") + pathName );
    m_cvsLogPage = new CVSLogPage( m_cvsService, vbox );
    this->resize( m_cvsLogPage->size() );

    connect( m_cvsLogPage, TQT_SIGNAL(linkClicked(const TQString&, const TQString&)),
        this, TQT_SLOT(slotDiffRequested(const TQString&, const TQString&)) );
*/
    m_cvsLogPage->startLog( workDir, pathName );
}

///////////////////////////////////////////////////////////////////////////////

void CVSLogDialog::slotDiffRequested( const TQString &pathName, const TQString &revA, const TQString &revB )
{
    kdDebug(9006) << "CVSLogDialog::slotDiffRequested()" << endl;

    // Create a new CVSDiffPage and start diffing process
    TQString diffTitle =  i18n("Diff between %1 and %2").arg( revA ).arg( revB );
    TQVBox *vbox = addVBoxPage( diffTitle );
    CVSDiffPage *diffPage = new CVSDiffPage( m_cvsService, vbox );
    diffPage->startDiff( pathName, revA, revB );
}

///////////////////////////////////////////////////////////////////////////////

void CVSLogDialog::slotCancel()
{
    // Hmmm ...

    KDialogBase::slotCancel();
}

///////////////////////////////////////////////////////////////////////////////

void CVSLogDialog::displayActionFeedback( bool working )
{
    if (working)
    {
        setCursor( KCursor::waitCursor() );
    }
    else
    {
        setCursor( KCursor::arrowCursor() );
    }
}

#include "cvslogdialog.moc"