[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkdevplatform/1=2E2=5D_plugins/patchreview=3A_Move_u?=
From: Andrey Batyiev <batyiev () gmail ! com>
Date: 2011-04-02 12:17:03
Message-ID: 20110402121703.4B7CAA609B () git ! kde ! org
[Download RAW message or body]
Git commit 241e40832300fa910c75ad68d4ab1f450f08206e by Andrey Batyiev.
Committed on 02/04/2011 at 14:13.
Pushed by abatyiev into branch '1.2'.
Move urlForFileModel from PatchReviewToolView to PatchReviewPlugin and
remove code duplication.
REVIEW: 100978
M +16 -31 plugins/patchreview/patchreview.cpp
M +4 -3 plugins/patchreview/patchreview.h
http://commits.kde.org/kdevplatform/241e40832300fa910c75ad68d4ab1f450f08206e
diff --git a/plugins/patchreview/patchreview.cpp b/plugins/patchreview/patchreview.cpp
index 794f5fb..f3cfae4 100644
--- a/plugins/patchreview/patchreview.cpp
+++ b/plugins/patchreview/patchreview.cpp
@@ -294,11 +294,8 @@ void PatchReviewPlugin::seekHunk( bool forwards, const KUrl& fileName ) {
if ( !model || !model->differences() )
continue;
- KUrl file = m_patch->baseDir();
-
- file.addPath( model->destinationPath() );
- file.addPath( model->destinationFile() );
-
+ KUrl file = urlForFileModel( model );
+
if ( !fileName.isEmpty() && fileName != file )
continue;
@@ -360,10 +357,7 @@ void PatchReviewPlugin::addHighlighting(const KUrl& highlightFile, IDocument* do
if ( !model )
continue;
- KUrl file = m_patch->baseDir();
-
- file.addPath( model->destinationPath() );
- file.addPath( model->destinationFile() );
+ KUrl file = urlForFileModel( model );
if (file != highlightFile)
continue;
@@ -401,10 +395,7 @@ void PatchReviewPlugin::highlightPatch() {
if ( !model )
continue;
- KUrl file = m_patch->baseDir();
-
- file.addPath( model->destinationPath() );
- file.addPath( model->destinationFile() );
+ KUrl file = urlForFileModel( model );
addHighlighting(file);
}
@@ -430,11 +421,8 @@ void PatchReviewToolView::finishReview()
}else if ( v.canConvert<const Diff2::DiffModel*>() ) {
const Diff2::DiffModel* model = v.value<const Diff2::DiffModel*>();
- KUrl file = m_plugin->patch()->baseDir();
-
- file.addPath( model->destinationPath() );
- file.addPath( model->destinationFile() );
-
+ KUrl file = m_plugin->urlForFileModel( model );
+
selectedUrls << file;
}
}
@@ -462,10 +450,7 @@ void PatchReviewToolView::fileDoubleClicked( const QModelIndex& i ) {
if ( !model )
throw "bad model-value";
- KUrl file = m_plugin->patch()->baseDir();
-
- file.addPath( model->destinationPath() );
- file.addPath( model->destinationFile() );
+ KUrl file = m_plugin->urlForFileModel( model );
kDebug() << "opening" << file.toLocalFile();
@@ -479,13 +464,13 @@ void PatchReviewToolView::fileDoubleClicked( const QModelIndex& i ) {
}
}
-KUrl PatchReviewToolView::urlForFileModel(const Diff2::DiffModel* model)
+KUrl PatchReviewPlugin::urlForFileModel(const Diff2::DiffModel* model)
{
- KUrl file = m_plugin->patch()->baseDir();
-
+ KUrl file = m_patch->baseDir();
+
file.addPath( model->destinationPath() );
file.addPath( model->destinationFile() );
-
+
return file;
}
@@ -553,7 +538,7 @@ void PatchReviewToolView::kompareModelChanged()
if ( diffs )
cnt = diffs->count();
- KUrl file = urlForFileModel(*it);
+ KUrl file = m_plugin->urlForFileModel(*it);
haveUrls.insert(file);
if(!QFileInfo(file.toLocalFile()).isReadable())
@@ -651,9 +636,9 @@ void PatchReviewToolView::documentActivated(IDocument* doc)
QVariant v = item->data( 0, Qt::UserRole );
if ( v.canConvert<const Diff2::DiffModel*>() ) {
const Diff2::DiffModel * model = v.value<const Diff2::DiffModel*>();
-
- KUrl file = urlForFileModel(model);
-
+
+ KUrl file = m_plugin->urlForFileModel(model);
+
if(file == doc->url()) {
m_editPatch.filesList->setCurrentItem(item);
return;
@@ -1128,7 +1113,7 @@ void PatchHighlighter::clear()
markIface->removeMark(line, KTextEditor::MarkInterface::markType26);
markIface->removeMark(line, KTextEditor::MarkInterface::markType27);
}
-
+
qDeleteAll(m_ranges);
m_ranges.clear();
m_differencesForRanges.clear();
diff --git a/plugins/patchreview/patchreview.h b/plugins/patchreview/patchreview.h
index c517f34..153e12f 100644
--- a/plugins/patchreview/patchreview.h
+++ b/plugins/patchreview/patchreview.h
@@ -132,8 +132,7 @@ private:
bool m_reversed;
- KUrl urlForFileModel(const Diff2::DiffModel* model);
-
+
PatchReviewPlugin* m_plugin;
QPointer<QWidget> m_customWidget;
@@ -176,7 +175,9 @@ public:
virtual void startReview(KDevelop::IPatchSource* patch, ReviewMode mode);
void finishReview(QList<KUrl> selection);
-
+
+ KUrl urlForFileModel(const Diff2::DiffModel* model);
+
Q_SIGNALS:
void patchChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic