Commit 290547db authored by Michael Reeves's avatar Michael Reeves

*use kf5 KPageDiaglog

*fix missing headers
*scrat obsolete since who knows when storage specifier
--finally being offically removed from specs
*fix warning about delete vs delete[]
*QDialog porting
parent 473ddc45
########### kdiff3 KPart ###############
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Parts CoreAddons)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Parts CoreAddons WidgetsAddons)
set(kdiff3part_PART_SRCS
kdiff3_part.cpp
......
......@@ -1414,7 +1414,7 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore )
++pos1;
}
}
delete buf;
delete[] buf;
}
}
}
......
......@@ -469,7 +469,7 @@ void GnuDiff::discard_confusing_lines (struct file_data filevec[])
for (f = 0; f < 2; f++)
{
lin end = filevec[f].buffered_lines;
register char *discards = discarded[f];
char *discards = discarded[f];
for (i = 0; i < end; i++)
{
......@@ -479,7 +479,7 @@ void GnuDiff::discard_confusing_lines (struct file_data filevec[])
else if (discards[i] != 0)
{
/* We have found a nonprovisional discard. */
register lin j;
lin j;
lin length;
lin provisional = 0;
......@@ -511,7 +511,7 @@ void GnuDiff::discard_confusing_lines (struct file_data filevec[])
}
else
{
register lin consec;
lin consec;
lin minimum = 1;
lin tem = length >> 2;
......
......@@ -47,6 +47,7 @@
#include <QDropEvent>
#include <QPaintEvent>
#include <QTextStream>
#include <QMimeData>
#include <klocale.h>
#include <kmessagebox.h>
......
......@@ -44,7 +44,7 @@
#include <kmessagebox.h>
#include <kmainwindow.h> //For ktoolbar.h
#include <ktoolbar.h>
#include <KHelpClient>
//#include <kkeydialog.h>
#include <map>
......@@ -490,22 +490,20 @@ OptionDialog::OptionDialog( bool bShowDirMergeSettings, QWidget *parent, char *n
{
setFaceType( List );
setWindowTitle( i18n("Configure") );
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Apply);
mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Apply);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
mainLayout->addWidget(buttonBox);
//WARNING mainLayout->addWidget(buttonBox) must be last item in layout.
mainLayout->addWidget(mButtonBox);
okButton->setDefault(true);
setObjectName( name );
setModal( true );
setHelp( "kdiff3/index.html", QString::null );
setupFontPage();
setupColorPage();
......@@ -524,10 +522,32 @@ OptionDialog::OptionDialog( bool bShowDirMergeSettings, QWidget *parent, char *n
// Initialize all values in the dialog
resetToDefaults();
slotApply();
connect(this, &OptionDialog::applyClicked, this, &OptionDialog::slotApply);
connect(this, &OptionDialog::okClicked, this, &OptionDialog::slotOk);
//helpClicked() is connected in KDiff3App::KDiff3App
connect(this, &OptionDialog::defaultClicked, this, &OptionDialog::slotDefault);
//connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(mButtonBox, &QDialogButtonBox::clicked, this, &OptionDialog::buttonClicked);
connect(mButtonBox, &QDialogButtonBox::helpRequested, this, &OptionDialog::helpRequested);
//connect(this, &OptionDialog::applyClicked, this, &OptionDialog::slotApply);
connect(mButtonBox, &QDialogButtonBox::accepted, this, &OptionDialog::slotOk);
//helpClicked() is connected in KDiff3App::KDiff3App -- Really where?
//connect(this, &OptionDialog::defaultClicked, this, &OptionDialog::slotDefault);
}
void OptionDialog::buttonClicked(QAbstractButton *button){
//for reasons beyond my comprehension QDialogButtonBox::standardButton() is non-static
switch(mButtonBox->standardButton(button)){
case QDialogButtonBox::Apply:
slotApply();
break;
case QDialogButtonBox::RestoreDefaults:
slotDefault();
break;
default:
break;
}
}
void OptionDialog::helpRequested() {
KHelpClient::invokeHelp( QStringLiteral("kdiff3/index.html"), QString::null );
}
OptionDialog::~OptionDialog( void )
......
......@@ -60,7 +60,9 @@ protected Q_SLOTS:
virtual void slotDefault( void );
virtual void slotOk( void );
virtual void slotApply( void );
virtual void buttonClicked( QAbstractButton* );
virtual void helpRequested();
void slotEncodingChanged();
void slotHistoryMergeRegExpTester();
void slotIntegrateWithClearCase();
......@@ -71,7 +73,8 @@ private:
void resetToDefaults();
std::list<OptionItem*> m_optionItemList;
QDialogButtonBox *mButtonBox;
OptionCheckBox* m_pSameEncoding;
OptionEncodingComboBox* m_pEncodingAComboBox;
OptionCheckBox* m_pAutoDetectUnicodeA;
......
......@@ -1415,7 +1415,7 @@ void KDiff3App::slotJoinDiffs()
void KDiff3App::slotConfigure()
{
m_pOptionDialog->setState();
m_pOptionDialog->incrementInitialSize ( QSize(0,40) );
m_pOptionDialog->setMinimumHeight(m_pOptionDialog->minimumHeight() + 40);
m_pOptionDialog->exec();
slotRefresh();
}
......
......@@ -33,6 +33,7 @@
#include <QDropEvent>
#include <QMenu>
#include <QPushButton>
#include <QMimeData>
#include <kfiledialog.h>
#include <klocale.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment