summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--[-rwxr-xr-x]scripts/codingstyle.sh0
-rw-r--r--scripts/download_i18n.sh83
-rw-r--r--[-rwxr-xr-x]scripts/i18n.sh0
-rw-r--r--src/application.cpp72
5 files changed, 117 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 558e7b49..5a22e2b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ PROJECT( rekonq )
# Informations to update before to release this package.
# rekonq info
-SET(REKONQ_VERSION "0.3.98" )
+SET(REKONQ_VERSION "0.4.0" )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h )
@@ -97,6 +97,7 @@ IF(REKONQ_CAN_BE_COMPILED)
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( icons )
ADD_SUBDIRECTORY( docs )
+# ADD_SUBDIRECTORY( i18n )
ENDIF(REKONQ_CAN_BE_COMPILED)
diff --git a/scripts/codingstyle.sh b/scripts/codingstyle.sh
index bb3add49..bb3add49 100755..100644
--- a/scripts/codingstyle.sh
+++ b/scripts/codingstyle.sh
diff --git a/scripts/download_i18n.sh b/scripts/download_i18n.sh
new file mode 100644
index 00000000..a70c11d8
--- /dev/null
+++ b/scripts/download_i18n.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+# use this stupid script to just prepare rekonq
+# dir with translations.
+#
+# 1. Update the lists of the ready (about 80%) translations
+# check the situation here: http://l10n.kde.org/stats/gui/trunk-kde4/po/rekonq.po/
+LIST="pt_BR en_GB ca zh_CN cs da nl fr gl de hu it nds pl pt ru sr es sv tr uk"
+
+# 2. run this script. It will create an i18n dir in rekonq sources ($RK_SRCS variable, set it to your source path)
+# dir with all the listed translations (eg: italian translation = rekonq_it.po file)
+# plus the CMakeLists.txt file needed to compile them.
+RK_SRCS=/DATI/KDE/SRC/rekonq
+
+# 3. Uncomment the "ADD_SUBDIRECTORY( i18n )" line in main CMakeLists.txt file.
+
+# 4. test a package creation (to see the translations installed)
+
+# THAT's ALL!!
+
+########################################################################################################
+
+# exit on most errors
+set -e
+
+# current dir
+CWD=$(pwd)
+
+# create the i18n dir
+cd $RK_SRCS
+mkdir -p i18n
+cd i18n
+
+# download the po files
+for lang in $LIST
+do
+ wget http://websvn.kde.org/*checkout*/trunk/l10n-kde4/$lang/messages/playground-network/rekonq.po;
+ mv rekonq.po rekonq_$lang.po;
+done
+
+# create the CMakeLists.txt file for the translations
+
+
+echo '
+
+FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
+
+IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
+ MESSAGE(
+"------
+ NOTE: msgfmt not found. Translations will *not* be installed
+------")
+ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
+
+ SET(catalogname rekonq)
+
+ ADD_CUSTOM_TARGET(translations ALL)
+
+ FILE(GLOB PO_FILES ${catalogname}*.po)
+
+ FOREACH(_poFile ${PO_FILES})
+ GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
+ STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
+ STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
+
+ IF( _langCode )
+ GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ ADD_CUSTOM_COMMAND(TARGET translations
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
+ DEPENDS ${_poFile})
+ INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
+ ENDIF( _langCode )
+
+ ENDFOREACH(_poFile ${PO_FILES})
+
+ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)
+
+' > CMakeLists.txt
+
+# done :)
+cd $CWD
+echo "Done. Yuppy!"
diff --git a/scripts/i18n.sh b/scripts/i18n.sh
index e9b5444d..e9b5444d 100755..100644
--- a/scripts/i18n.sh
+++ b/scripts/i18n.sh
diff --git a/src/application.cpp b/src/application.cpp
index efa7bc22..96254e07 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -108,14 +108,22 @@ int Application::newInstance()
{
KCmdLineArgs::setCwd( QDir::currentPath().toUtf8() );
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-
- // we share one process for several mainwindows,
- // so initialize only once
- static bool first = true;
+
+ bool isFirstLoad = m_mainWindows.isEmpty();
+
+ // is your app session restored? restore session...
+ // this mechanism also falls back to load usual plain rekonq
+ // if something goes wrong...
+ if (isFirstLoad && ReKonfig::recoverOnCrash() == 1 && sessionManager()->restoreSession())
+ {
+ QTimer::singleShot(0, this, SLOT(postLaunch()));
+ kDebug() << "session restored";
+ return 1;
+ }
if(args->count() == 0)
{
- if(first) // we are starting rekonq, for the first time with no args: use startup behaviour
+ if(isFirstLoad) // we are starting rekonq, for the first time with no args: use startup behaviour
{
switch(ReKonfig::startupBehaviour())
{
@@ -138,47 +146,31 @@ int Application::newInstance()
loadUrl( KUrl("about:home") , Rekonq::NewWindow );
}
}
-
- if (first)
+ else
{
- QTimer::singleShot(0, this, SLOT(postLaunch()));
- first = false;
-
- // is your app session restored? restore session...
- // this mechanism also falls back to load usual plain rekonq
- // if something goes wrong...
- if (ReKonfig::recoverOnCrash() == 1 && sessionManager()->restoreSession())
+ if(isFirstLoad)
{
- kDebug() << "session restored";
- return 1;
+ // No windows in the current desktop? No windows at all?
+ // Create a new one and load there sites...
+ loadUrl(args->arg(0), Rekonq::CurrentTab);
+ for (int i = 1; i < args->count(); ++i)
+ loadUrl(args->arg(i), Rekonq::SettingOpenTab);
}
- }
-
- // are there args? load them..
- if (args->count() > 0)
- {
- // are there any windows there? use it
- int index = m_mainWindows.size();
- if(index > 0)
+ else
{
- MainWindow *m = m_mainWindows.at(index - 1).data();
- m->activateWindow();
-
- for (int i = 0; i < args->count(); ++i)
- loadUrl(args->arg(i), Rekonq::NewCurrentTab);
-
- return 2;
+ // are there any windows there? use it
+ int index = m_mainWindows.size();
+ if(index > 0)
+ {
+ MainWindow *m = m_mainWindows.at(index - 1).data();
+ m->activateWindow();
+ for (int i = 0; i < args->count(); ++i)
+ loadUrl(args->arg(i), Rekonq::NewCurrentTab);
+ }
}
-
- // No windows in the current desktop? No windows at all?
- // Create a new one and load there sites...
- loadUrl(args->arg(0), Rekonq::CurrentTab);
- for (int i = 1; i < args->count(); ++i)
- loadUrl(args->arg(i), Rekonq::SettingOpenTab);
-
- return 3;
}
-
+
+ QTimer::singleShot(0, this, SLOT(postLaunch()));
return 0;
}