~ubuntu-branches/ubuntu/trusty/kdevplatform/trusty-proposed

« back to all changes in this revision

Viewing changes to shell/textdocument.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2013-12-09 17:24:43 UTC
  • mfrom: (0.3.25)
  • Revision ID: package-import@ubuntu.com-20131209172443-rstb3roh6fj0c5vw
Tags: 1.6.0-0ubuntu1
* New upstream release (LP: #1259220)
* Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <QVBoxLayout>
25
25
#include <QWidget>
26
26
#include <QLabel>
 
27
#include <QLayout>
27
28
 
28
29
#include <klocale.h>
29
30
#include <kmessagebox.h>
294
295
    TextEditorWidgetPrivate()
295
296
    {
296
297
        widget = 0;
297
 
        statusBar = 0;
298
298
        widgetLayout = 0;
299
299
        view = 0;
300
300
        statusLabel = 0;
301
301
    }
 
302
 
 
303
    void viewEditModeChanged(KTextEditor::View* view, KTextEditor::View::EditMode mode)
 
304
    {
 
305
#ifdef KTEXTEDITOR_HAS_VIMODE
 
306
        if ( ! statusLabel ) {
 
307
            statusLabel = new QLabel();
 
308
            view->layout()->addWidget(statusLabel);
 
309
        }
 
310
        if ( mode == KTextEditor::View::EditViMode ) {
 
311
            statusLabel->setText(view->viewMode() + "    <i>" + view->document()->url().fileName() + "</i>");
 
312
            statusLabel->setHidden(false);
 
313
        }
 
314
        else {
 
315
            statusLabel->setHidden(true);
 
316
        }
 
317
#else
 
318
        Q_UNUSED(view);
 
319
        Q_UNUSED(mode);
 
320
#endif
 
321
    }
302
322
    QWidget* widget;
303
323
    QVBoxLayout* widgetLayout;
304
324
    QPointer<KTextEditor::View> view;
305
 
    KStatusBar *statusBar;
306
325
    QLabel* statusLabel;
307
326
    QString status;
308
327
    const TextView* textView;
362
381
 
363
382
        d->setStatus(d->document, false);
364
383
 
365
 
        /* It appears, that by default a part will be deleted the the
 
384
        /* It appears, that by default a part will be deleted the
366
385
           first view containing it is deleted.  Since we do want
367
386
           to have several views, disable that behaviour.  */
368
387
        d->document->setAutoDeletePart(false);
801
820
    
802
821
    viewStatusChanged(view, view->cursorPosition());
803
822
 
 
823
    connect(view, SIGNAL(viewEditModeChanged(KTextEditor::View*,KTextEditor::View::EditMode)),
 
824
            this, SLOT(viewEditModeChanged(KTextEditor::View*,KTextEditor::View::EditMode)));
 
825
 
804
826
    d->widgetLayout->insertWidget(0, d->view);
805
827
    setFocusProxy(view);
806
828
}