aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-23 11:24:16 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-23 11:24:16 (GMT)
commit08010e22c0fc5e685e869e95463daa4130192dfd (patch)
treebd43e2265c7fe3c1862872b87c3c929d9077c127
parente6a42c64dd60ce15d6a9eb36ab6ae0d07eb1cea5 (diff)
small cleanups
-rw-r--r--kate/app/kateviewmanager.cpp69
1 files changed, 33 insertions, 36 deletions
diff --git a/kate/app/kateviewmanager.cpp b/kate/app/kateviewmanager.cpp
index 4b449fb..86df415 100644
--- a/kate/app/kateviewmanager.cpp
+++ b/kate/app/kateviewmanager.cpp
@@ -24,14 +24,14 @@
#include "katemainwindow.h"
#include "katedocmanager.h"
#include "kateviewspace.h"
+#include "katedebug.h"
-#include <ktexteditor/view.h>
-#include <ktexteditor/document.h>
-#include <ktexteditor/attribute.h>
-#include <ktexteditor/highlightinterface.h>
+#include <KTextEditor/View>
+#include <KTextEditor/Document>
+#include <KTextEditor/Attribute>
+#include <KTextEditor/HighlightInterface>
#include <KActionCollection>
-#include "katedebug.h"
#include <KEncodingFileDialog>
#include <KIconLoader>
#include <KToolBar>
@@ -103,18 +103,16 @@ KateViewManager::KateViewManager (QWidget *parentW, KateMainWindow *parent)
KateViewManager::~KateViewManager ()
{
// make sure all xml gui clients are removed to avoid warnings on exit
- foreach (KTextEditor::View* view, m_viewList)
+ Q_FOREACH (KTextEditor::View* view, m_viewList)
mainWindow()->guiFactory()->removeClient(view);
}
void KateViewManager::setupActions ()
{
- QAction *a;
-
/**
* view splitting
*/
- a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_vert"));
+ QAction *a = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_vert"));
a->setIcon( QIcon::fromTheme(QStringLiteral("view-split-left-right")) );
a->setText( i18n("Split Ve&rtical") );
a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_L );
@@ -205,43 +203,42 @@ void KateViewManager::slotDocumentNew ()
void KateViewManager::slotDocumentOpen ()
{
KTextEditor::View *cv = activeView();
+ if (!cv)
+ return;
- if (cv)
- {
- KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(
- KTextEditor::Editor::instance()->defaultEncoding(),
- cv->document()->url(),
- QString(), m_mainWindow, i18n("Open File"));
-
- KateDocumentInfo docInfo;
- docInfo.openedByUser = true;
+ KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(
+ KTextEditor::Editor::instance()->defaultEncoding(),
+ cv->document()->url(),
+ QString(), m_mainWindow, i18n("Open File"));
- QString fileList;
+ KateDocumentInfo docInfo;
+ docInfo.openedByUser = true;
- foreach ( const QUrl &url, r.URLs )
- {
- qint64 size = QFile( url.toLocalFile() ).size();
+ QString fileList;
- if ( size > FileSizeAboveToAskUserIfProceedWithOpen )
- {
- fileList += QString::fromLatin1("<li>%1 (%2MB)</li>").arg( url.fileName() ).arg( size / 1024 / 1024 );
- }
- }
+ foreach ( const QUrl &url, r.URLs )
+ {
+ qint64 size = QFile( url.toLocalFile() ).size();
- if ( !fileList.isEmpty() )
+ if ( size > FileSizeAboveToAskUserIfProceedWithOpen )
{
- QString text = i18n( "<p>You are attempting to open one or more large files:</p><ul>%1</ul><p>Do you want to proceed?</p><p><strong>Beware that kate may stop responding for some time when opening large files.</strong></p>" );
-
- int ret = KMessageBox::warningYesNo( this, text.arg( fileList ), i18n("Opening Large File"), KStandardGuiItem::cont(), KStandardGuiItem::stop() );
- if ( ret == KMessageBox::No )
- return;
+ fileList += QString::fromLatin1("<li>%1 (%2MB)</li>").arg( url.fileName() ).arg( size / 1024 / 1024 );
}
+ }
- KTextEditor::Document *lastID = openUrls(r.URLs, r.encoding, false, docInfo);
+ if ( !fileList.isEmpty() )
+ {
+ QString text = i18n( "<p>You are attempting to open one or more large files:</p><ul>%1</ul><p>Do you want to proceed?</p><p><strong>Beware that kate may stop responding for some time when opening large files.</strong></p>" );
- if (lastID)
- activateView (lastID);
+ int ret = KMessageBox::warningYesNo( this, text.arg( fileList ), i18n("Opening Large File"), KStandardGuiItem::cont(), KStandardGuiItem::stop() );
+ if ( ret == KMessageBox::No )
+ return;
}
+
+ KTextEditor::Document *lastID = openUrls(r.URLs, r.encoding, false, docInfo);
+
+ if (lastID)
+ activateView (lastID);
}
void KateViewManager::slotDocumentClose(KTextEditor::Document *document) {