Commit 2c26caa8 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Fix some connects

parent a2ea1817
......@@ -84,9 +84,9 @@ DocumentChangeTracker::DocumentChangeTracker( KTextEditor::Document* document )
}
}
connect(document, SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)), SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
connect(document, SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Cursor,QString)), SLOT(textInserted(KTextEditor::Document*,KTextEditor::Cursor,QString)));
connect(document, SIGNAL(textRemoved(KTextEditor::Document*,KTextEditor::Range,QString)), SLOT(textRemoved(KTextEditor::Document*,KTextEditor::Range,QString)));
connect(document, SIGNAL(textChanged(KTextEditor::Document*,KTextEditor::Range,QString,KTextEditor::Range)), SLOT(textChanged(KTextEditor::Document*,KTextEditor::Range,QString,KTextEditor::Range)));
connect(document, SIGNAL(textChanged(KTextEditor::Document*)), SLOT(textChanged(KTextEditor::Document*,KTextEditor::Range,QString,KTextEditor::Range)));
connect(document, SIGNAL(destroyed(QObject*)), SLOT(documentDestroyed(QObject*)));
connect(document, SIGNAL(documentSavedOrUploaded(KTextEditor::Document*,bool)), SLOT(documentSavedOrUploaded(KTextEditor::Document*,bool)));
......@@ -217,14 +217,20 @@ void DocumentChangeTracker::updateChangedRange( Range changed )
ICore::self()->languageController()->backgroundParser()->addDocument(m_url, TopDUContext::AllDeclarationsContextsAndUses);
}
void DocumentChangeTracker::textInserted( Document* document, Range range )
static Cursor cursorAdd(Cursor c, const QString& text)
{
QString text = document->text(range);
c.setLine(c.line()+text.count('\n'));
c.setColumn(c.column()+(text.count() - qMin(0, text.lastIndexOf('\n'))));
return c;
}
void DocumentChangeTracker::textInserted( Document* document, const Cursor& c, const QString& text )
{
if ( m_whitespaceSensitivity == ILanguageSupport::Sensitive ) {
m_needUpdate = true;
}
Range range(c, cursorAdd(c, text));
if ( ! m_needUpdate ) {
QString textWithoutWhitespace = text;
textWithoutWhitespace.remove(whiteSpaceRegExp);
......
......@@ -252,7 +252,7 @@ protected:
void updateChangedRange(KTextEditor::Range changed);
public slots:
virtual void textInserted( KTextEditor::Document*,KTextEditor::Range );
virtual void textInserted( KTextEditor::Document* document, const KTextEditor::Cursor& c, const QString& text );
virtual void textRemoved( KTextEditor::Document* document, KTextEditor::Range oldRange, QString oldText );
virtual void textChanged( KTextEditor::Document* document, KTextEditor::Range oldRange, QString oldText, KTextEditor::Range newRange );
void documentDestroyed( QObject* );
......
......@@ -233,10 +233,9 @@ Container::Container(QWidget *parent)
connect(d->tabBar, SIGNAL(currentChanged(int)), this, SLOT(widgetActivated(int)));
connect(d->tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(requestClose(int)));
connect(d->tabBar, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)));
connect(d->tabBar, SIGNAL(wheelDelta(int)), this, SLOT(wheelScroll(int)));
connect(d->tabBar, SIGNAL(contextMenu(int,QPoint)), this, SLOT(contextMenu(int,QPoint)));
connect(d->tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(requestClose(int)));
connect(d->tabBar, SIGNAL(mouseDoubleClick(int)), this, SLOT(doubleClickTriggered(int)));
connect(d->tabBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
connect(d->tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(requestClose(int))); //FIXME: should move this to the style, probably
connect(d->tabBar, SIGNAL(tabBarDoubleClicked(int)), this, SLOT(doubleClickTriggered(int)));
connect(d->documentListMenu, SIGNAL(triggered(QAction*)), this, SLOT(documentListActionTriggered(QAction*)));
KConfigGroup group = KSharedConfig::openConfig()->group("UiSettings");
......@@ -269,31 +268,6 @@ Container::~Container()
delete d;
}
void Container::wheelScroll(int delta)
{
int nextIndex = -1;
if( delta > 0 )
{
if( d->tabBar->currentIndex() == 0 )
{
nextIndex = d->tabBar->count() - 1;
} else
{
nextIndex = d->tabBar->currentIndex() -1;
}
} else
{
if( d->tabBar->currentIndex() == d->tabBar->count() - 1 )
{
nextIndex = 0;
} else
{
nextIndex = d->tabBar->currentIndex() + 1;
}
}
widgetActivated( nextIndex );
}
void Container::requestClose(int idx)
{
emit requestClose(widget(idx));
......@@ -504,8 +478,10 @@ void Container::tabMoved(int from, int to)
d->viewForWidget[w]->notifyPositionChanged(to);
}
void Container::contextMenu( int currentTab, const QPoint& pos )
void Container::contextMenu( const QPoint& pos )
{
int currentTab = d->tabBar->tabAt(pos);
QMenu menu;
emit tabContextMenuRequested(viewForWidget(widget(currentTab)), &menu);
......
......@@ -89,8 +89,7 @@ private Q_SLOTS:
void statusChanged(Sublime::View *view);
void requestClose(int idx);
void tabMoved(int from, int to);
void wheelScroll(int);
void contextMenu(int, const QPoint&);
void contextMenu(const QPoint&);
void doubleClickTriggered(int tab);
void documentListActionTriggered(QAction*);
......
......@@ -307,8 +307,8 @@ Area::WalkerMode MainWindowPrivate::ViewCreator::operator() (AreaIndex *index)
connect(container, SIGNAL(activateView(Sublime::View*)), d->m_mainWindow, SLOT(activateView(Sublime::View*)));
connect(container, SIGNAL(tabDoubleClicked(Sublime::View*)),
d->m_mainWindow, SLOT(tabDoubleClicked(Sublime::View*)));
connect(container, SIGNAL(tabContextMenuRequested(Sublime::View*,KMenu*)),
d->m_mainWindow, SLOT(tabContextMenuRequested(Sublime::View*,KMenu*)));
connect(container, SIGNAL(tabContextMenuRequested(Sublime::View*,QMenu*)),
d->m_mainWindow, SLOT(tabContextMenuRequested(Sublime::View*,QMenu*)));
connect(container, SIGNAL(tabToolTipRequested(Sublime::View*,Sublime::Container*,int)),
d->m_mainWindow, SLOT(tabToolTipRequested(Sublime::View*,Sublime::Container*,int)));
connect(container, SIGNAL(requestClose(QWidget*)),
......
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