summaryrefslogtreecommitdiff
path: root/src/tabwindow/rekonqwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-09-19 23:22:13 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commite315ff15daf26cbc70b6f2da50e6ca18081fc7c4 (patch)
tree6da0556f2c5c7efb13d8e8b03ba0092e7a5838d3 /src/tabwindow/rekonqwindow.cpp
parentImplement RekonqWindow (diff)
downloadrekonq-e315ff15daf26cbc70b6f2da50e6ca18081fc7c4.tar.xz
Integrated spell checking for rekonq2 (lindsay's work imported)
- inline spell highlighter. This requires WebKit 2.3 to work. - Addition of a suggested replacement word list to the context menu, for the word right clicked on - A standard modeless spell check dialog that works on the current editable text (or selection). Heavily cribbed from Dawit's work on kdewebkitpart. oops... also a codingstyle script round here... :)
Diffstat (limited to 'src/tabwindow/rekonqwindow.cpp')
-rw-r--r--src/tabwindow/rekonqwindow.cpp90
1 files changed, 49 insertions, 41 deletions
diff --git a/src/tabwindow/rekonqwindow.cpp b/src/tabwindow/rekonqwindow.cpp
index f3e321bb..970c73e5 100644
--- a/src/tabwindow/rekonqwindow.cpp
+++ b/src/tabwindow/rekonqwindow.cpp
@@ -53,33 +53,40 @@ public:
{
}
- bool dummyInit() { return true; }
+ bool dummyInit()
+ {
+ return true;
+ }
- bool saveState( QSessionManager& )
+ bool saveState(QSessionManager&)
{
KConfig* config = KApplication::kApplication()->sessionConfig();
int n = 0;
- Q_FOREACH (RekonqWindow* rw, RekonqWindow::windowList()) {
+ Q_FOREACH(RekonqWindow * rw, RekonqWindow::windowList())
+ {
n++;
rw->savePropertiesInternal(config, n);
}
- KConfigGroup group( config, "Number" );
- group.writeEntry("NumberOfWindows", n );
+ KConfigGroup group(config, "Number");
+ group.writeEntry("NumberOfWindows", n);
return true;
}
- bool commitData( QSessionManager& sm )
+ bool commitData(QSessionManager& sm)
{
// not really a fast method but the only compatible one
- if ( sm.allowsInteraction() ) {
+ if (sm.allowsInteraction())
+ {
bool canceled = false;
::s_no_query_exit = true;
- Q_FOREACH (RekonqWindow *window, RekonqWindow::windowList()) {
- if ( !window->testAttribute( Qt::WA_WState_Hidden ) ) {
+ Q_FOREACH(RekonqWindow * window, RekonqWindow::windowList())
+ {
+ if (!window->testAttribute(Qt::WA_WState_Hidden))
+ {
QCloseEvent e;
- QApplication::sendEvent( window, &e );
+ QApplication::sendEvent(window, &e);
canceled = !e.isAccepted();
if (canceled)
break;
@@ -87,7 +94,7 @@ public:
}
::s_no_query_exit = false;
if (canceled)
- return false;
+ return false;
return true;
}
@@ -123,7 +130,7 @@ RekonqWindow::RekonqWindow(QWidget* parent)
if (args && args->isSet("geometry"))
geometry = args->getOption("geometry");
- if ( geometry.isNull() ) // if there is no geometry, it doesn't matter
+ if (geometry.isNull()) // if there is no geometry, it doesn't matter
{
KSharedConfig::Ptr cf = KGlobal::config();
KConfigGroup cg(cf, QL1S("TabWindow"));
@@ -133,14 +140,14 @@ RekonqWindow::RekonqWindow(QWidget* parent)
{
parseGeometry();
}
-
- setWindowTitle( KGlobal::caption() );
+
+ setWindowTitle(KGlobal::caption());
}
RekonqWindow::~RekonqWindow()
{
- sWindowList->removeAll( this );
+ sWindowList->removeAll(this);
KSharedConfig::Ptr cf = KGlobal::config();
KConfigGroup cg(cf, QL1S("TabWindow"));
@@ -150,11 +157,11 @@ RekonqWindow::~RekonqWindow()
QList<RekonqWindow*> RekonqWindow::windowList()
{
- return *sWindowList;
+ return *sWindowList;
}
-void RekonqWindow::savePropertiesInternal( KConfig *config, int number )
+void RekonqWindow::savePropertiesInternal(KConfig *config, int number)
{
QString s;
s.setNum(number);
@@ -174,7 +181,7 @@ void RekonqWindow::savePropertiesInternal( KConfig *config, int number )
}
-bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
+bool RekonqWindow::readPropertiesInternal(KConfig *config, int number)
{
// in order they are in toolbar list
QString s;
@@ -184,8 +191,8 @@ bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
KConfigGroup cg(config, s);
// restore the object name (window role)
- if ( cg.hasKey(QL1S("ObjectName" )) )
- setObjectName( cg.readEntry("ObjectName").toLatin1()); // latin1 is right here
+ if (cg.hasKey(QL1S("ObjectName")))
+ setObjectName(cg.readEntry("ObjectName").toLatin1()); // latin1 is right here
restoreWindowSize(cg);
@@ -197,7 +204,7 @@ bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
}
-void RekonqWindow::restoreWindowSize( const KConfigGroup & _cg )
+void RekonqWindow::restoreWindowSize(const KConfigGroup & _cg)
{
int scnum = QApplication::desktop()->screenNumber(window());
QRect desktopRect = QApplication::desktop()->screenGeometry(scnum);
@@ -207,22 +214,22 @@ void RekonqWindow::restoreWindowSize( const KConfigGroup & _cg )
KConfigGroup cg(_cg);
QString widthString = QString::fromLatin1("Width %1").arg(desktopRect.width());
- int w = cg.readEntry(widthString, defaultSize.width() );
+ int w = cg.readEntry(widthString, defaultSize.width());
QString heightString = QString::fromLatin1("Height %1").arg(desktopRect.height());
- int h = cg.readEntry(heightString, defaultSize.height() );
+ int h = cg.readEntry(heightString, defaultSize.height());
resize(w, h);
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desktopRect.width()).arg(desktopRect.height());
- QByteArray geometry = cg.readEntry( geometryKey, QByteArray() );
+ QByteArray geometry = cg.readEntry(geometryKey, QByteArray());
// if first time run, center window
- if (!restoreGeometry( QByteArray::fromBase64(geometry) ))
- move( (desktopRect.width()-width())/2, (desktopRect.height()-height())/2 );
+ if (!restoreGeometry(QByteArray::fromBase64(geometry)))
+ move((desktopRect.width() - width()) / 2, (desktopRect.height() - height()) / 2);
}
-void RekonqWindow::saveWindowSize( const KConfigGroup & _cg ) const
+void RekonqWindow::saveWindowSize(const KConfigGroup & _cg) const
{
int scnum = QApplication::desktop()->screenNumber(window());
QRect desktopRect = QApplication::desktop()->screenGeometry(scnum);
@@ -242,15 +249,15 @@ void RekonqWindow::saveWindowSize( const KConfigGroup & _cg ) const
KConfigGroup cg(_cg);
QString widthString = QString::fromLatin1("Width %1").arg(desktopRect.width());
- cg.writeEntry(widthString, w );
+ cg.writeEntry(widthString, w);
QString heightString = QString::fromLatin1("Height %1").arg(desktopRect.height());
- cg.writeEntry(heightString, h );
+ cg.writeEntry(heightString, h);
// geometry is saved separately for each resolution
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desktopRect.width()).arg(desktopRect.height());
QByteArray geometry = saveGeometry();
- cg.writeEntry( geometryKey, geometry.toBase64() );
+ cg.writeEntry(geometryKey, geometry.toBase64());
}
@@ -261,7 +268,7 @@ void RekonqWindow::parseGeometry()
if (args->isSet("geometry"))
cmdlineGeometry = args->getOption("geometry");
- Q_ASSERT ( !cmdlineGeometry.isNull() );
+ Q_ASSERT(!cmdlineGeometry.isNull());
// #if defined Q_WS_X11
// int x, y;
@@ -288,7 +295,7 @@ void RekonqWindow::parseGeometry()
// y = KApplication::desktop()->height() + y - h;
// else if ( (m & YValue) )
// y = geometry().y();
-//
+//
// move(x, y);
// }
// #endif
@@ -312,27 +319,28 @@ void RekonqWindow::saveAutoSaveSettings()
}
-bool RekonqWindow::canBeRestored( int number )
+bool RekonqWindow::canBeRestored(int number)
{
- if ( !qApp->isSessionRestored() )
+ if (!qApp->isSessionRestored())
return false;
KConfig *config = kapp->sessionConfig();
- if ( !config )
+ if (!config)
return false;
- KConfigGroup group( config, "Number" );
- const int n = group.readEntry( "NumberOfWindows", 1 );
+ KConfigGroup group(config, "Number");
+ const int n = group.readEntry("NumberOfWindows", 1);
return number >= 1 && number <= n;
}
-bool RekonqWindow::restore( int number, bool show )
+bool RekonqWindow::restore(int number, bool show)
{
- if ( !canBeRestored( number ) )
+ if (!canBeRestored(number))
return false;
KConfig *config = kapp->sessionConfig();
- if ( readPropertiesInternal( config, number ) ){
- if ( show )
+ if (readPropertiesInternal(config, number))
+ {
+ if (show)
RekonqWindow::show();
return false;
}