You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/vcs/cvsservice/diffwidget.h

106 lines
2.7 KiB

/***************************************************************************
* Copyright (C) 2001 by Harald Fernengel *
* harry@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. *
* *
***************************************************************************/
#ifndef _DIFFWIDGET_H_
#define _DIFFWIDGET_H_
#include <tqwidget.h>
#include <tqtextedit.h>
#include <tqstringlist.h>
#include <kurl.h>
class KTempFile;
namespace KIO {
class Job;
}
namespace KParts {
class ReadOnlyPart;
}
// Helper class that displays a modified RMB popup menu
class KDiffTextEdit: public TQTextEdit
{
Q_OBJECT
TQ_OBJECT
public:
KDiffTextEdit( TQWidget* parent = 0, const char* name = 0 );
virtual ~KDiffTextEdit();
void applySyntaxHighlight();
void clearSyntaxHighlight();
signals:
void externalPartRequested( const TQString& partName );
protected:
virtual TQPopupMenu* createPopupMenu( const TQPoint& );
virtual TQPopupMenu* createPopupMenu();
private slots:
void popupActivated( int );
void toggleSyntaxHighlight();
void saveAs();
private:
static void searchExtParts();
static TQStringList extParts;
static TQStringList extPartsTranslated;
bool _highlight;
};
class DiffWidget : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
DiffWidget( TQWidget *parent = 0, const char *name = 0, WFlags f = 0 );
virtual ~DiffWidget();
public slots:
/** The URL has to point to a diff file */
void openURL( const KURL& url );
/** Pass a diff file in here */
void setDiff( const TQString& diff );
/** clears the difference viewer */
void slotClear();
private slots:
/** appends a piece of "diff" */
void slotAppend( const TQString& str );
/** overloaded for convenience */
void slotAppend( KIO::Job*, const TQByteArray& ba );
/** call this when the whole "diff" has been sent.
* Don't call slotAppend afterwards!
*/
void slotFinished();
void showExtPart();
void showTextEdit();
void loadExtPart( const TQString& partName );
protected:
void contextMenuEvent( TQContextMenuEvent* e );
private:
void setExtPartVisible( bool visible );
void populateExtPart();
private:
KDiffTextEdit* te;
KIO::Job* job;
KParts::ReadOnlyPart* extPart;
KTempFile* tempFile;
};
#endif