~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to vcs/cvsservice/diffdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2003 by Mario Scalas                                    *
 
3
 *   mario.scalas@libero.it                                                *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 ***************************************************************************/
 
11
 
 
12
#include <qlineedit.h>
 
13
#include <qradiobutton.h>
 
14
 
 
15
#include "diffdialog.h"
 
16
#include <klocale.h>
 
17
#include <qbuttongroup.h>
 
18
 
 
19
///////////////////////////////////////////////////////////////////////////////
 
20
// class DiffDialog
 
21
///////////////////////////////////////////////////////////////////////////////
 
22
 
 
23
DiffDialog::DiffDialog( const CVSEntry &entry, QWidget *parent, const char *name, WFlags f )
 
24
    : DiffDialogBase( parent, name, true, f)
 
25
{
 
26
    m_entry = entry;
 
27
    QString currentRevision = entry.revision();
 
28
    revaEdit->setText(currentRevision);
 
29
    revbEdit->setText(currentRevision);
 
30
    revOtherEdit->setText(currentRevision);
 
31
    languageChange();
 
32
}
 
33
 
 
34
///////////////////////////////////////////////////////////////////////////////
 
35
 
 
36
DiffDialog::~DiffDialog()
 
37
{
 
38
}
 
39
 
 
40
///////////////////////////////////////////////////////////////////////////////
 
41
 
 
42
DiffDialog::DiffType DiffDialog::requestedDiff() const
 
43
{
 
44
    if (diffArbitraryRevRadio->isChecked())
 
45
        return diffArbitrary;
 
46
    else if (diffLocalOtherRadio->isChecked())
 
47
        return diffLocalOther;
 
48
    else if (diffLocalBaseRadio->isChecked())
 
49
        return diffLocalBASE;
 
50
    else
 
51
        return diffLocalHEAD;
 
52
}
 
53
 
 
54
///////////////////////////////////////////////////////////////////////////////
 
55
 
 
56
QString DiffDialog::revA() const
 
57
{
 
58
    if (requestedDiff() == diffArbitrary)
 
59
        return revaEdit->text();
 
60
    else  if (requestedDiff() == diffLocalOther)
 
61
        return revOtherEdit->text();
 
62
    else  if (requestedDiff() == diffLocalHEAD)
 
63
        return "HEAD";
 
64
    else
 
65
        return QString::null;
 
66
}
 
67
 
 
68
///////////////////////////////////////////////////////////////////////////////
 
69
 
 
70
QString DiffDialog::revB() const
 
71
{
 
72
    if (requestedDiff())
 
73
        return this->revbEdit->text();
 
74
    else
 
75
        return QString::null;
 
76
}
 
77
 
 
78
///////////////////////////////////////////////////////////////////////////////
 
79
 
 
80
void DiffDialog::languageChange() {
 
81
    DiffDialogBase::languageChange();
 
82
    //buttonGroup1->setTitle( tr2i18n( "Build Difference Between" ) );
 
83
    
 
84
    //FIXME:  We need a function in CVSEntry to return the latest revision there is in cvs
 
85
//    if(!m_entry.revision().isNull())
 
86
//      diffLocalHeadRadio->setText( tr2i18n( "Local copy and &HEAD (%1)" ).arg( m_entry.revision()) );
 
87
}
 
88
 
 
89
#include "diffdialog.moc"