Fix QLatin1String issues.

This commit is contained in:
Klaas Freitag 2012-08-17 18:13:17 +03:00
parent a8296a6b6e
commit d733aac0e8
23 changed files with 280 additions and 262 deletions

View file

@ -58,7 +58,7 @@ namespace Mirall {
void mirallLogCatcher(QtMsgType type, const char *msg)
{
Q_UNUSED(type)
Logger::instance()->mirallLog( msg );
Logger::instance()->mirallLog( QString::fromUtf8(msg) );
}
void csyncLogCatcher(const char *msg)
@ -87,27 +87,27 @@ Application::Application(int &argc, char **argv) :
setApplicationName( _theme->appName() );
setWindowIcon( _theme->applicationIcon() );
if( arguments().contains("--help")) {
if( arguments().contains(QLatin1String("--help"))) {
showHelp();
}
setupLogBrowser();
processEvents();
QTranslator *qtTranslator = new QTranslator(this);
qtTranslator->load("qt_" + QLocale::system().name(),
qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
installTranslator(qtTranslator);
QTranslator *mirallTranslator = new QTranslator(this);
#ifdef Q_OS_LINUX
// FIXME - proper path!
mirallTranslator->load("mirall_" + QLocale::system().name(), QLatin1String("/usr/share/mirall/i18n/"));
mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), QLatin1String("/usr/share/mirall/i18n/"));
#endif
#ifdef Q_OS_MAC
mirallTranslator->load("mirall_" + QLocale::system().name(), applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir.
mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name(), applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir.
#endif
#ifdef Q_OS_WIN32
mirallTranslator->load("mirall_" + QLocale::system().name()); // path defaults to app dir.
mirallTranslator->load(QLatin1String("mirall_") + QLocale::system().name()); // path defaults to app dir.
#endif
installTranslator(mirallTranslator);
@ -232,7 +232,7 @@ void Application::slotNoOwnCloudFound( QNetworkReply* reply )
QString msg;
if( reply ) {
QString url( reply->url().toString() );
url.remove( "/status.php" );
url.remove( QLatin1String("/status.php") );
msg = tr("<p>The ownCloud at %1 could not be reached.</p>").arg( url );
msg += tr("<p>The detailed error message is<br/><tt>%1</tt></p>").arg( reply->errorString() );
}
@ -257,7 +257,7 @@ void Application::slotNoOwnCloudFound( QNetworkReply* reply )
void Application::slotCheckAuthentication()
{
qDebug() << "# checking for authentication settings.";
ownCloudInfo::instance()->getRequest("/", true ); // this call needs to be authenticated.
ownCloudInfo::instance()->getRequest(QLatin1String("/"), true ); // this call needs to be authenticated.
// simply GET the webdav root, will fail if credentials are wrong.
// continue in slotAuthCheck here :-)
}
@ -372,24 +372,25 @@ void Application::setupLogBrowser()
qInstallMsgHandler( mirallLogCatcher );
csync_set_log_callback( csyncLogCatcher );
if( arguments().contains("--logwindow") || arguments().contains("-l")) {
if( arguments().contains(QLatin1String("--logwindow"))
|| arguments().contains(QLatin1String("-l"))) {
slotOpenLogBrowser();
}
// check for command line option for a log file.
int lf = arguments().indexOf("--logfile");
int lf = arguments().indexOf(QLatin1String("--logfile"));
if( lf > -1 && lf+1 < arguments().count() ) {
QString logfile = arguments().at( lf+1 );
bool flush = false;
if( arguments().contains("--logflush")) flush = true;
if( arguments().contains(QLatin1String("--logflush"))) flush = true;
qDebug() << "Logging into logfile: " << logfile << " with flush " << flush;
_logBrowser->setLogFile( logfile, flush );
}
qDebug() << QString( "################## %1 %2 %3 ").arg(_theme->appName())
qDebug() << QString::fromLatin1( "################## %1 %2 %3 ").arg(_theme->appName())
.arg( QLocale::system().name() )
.arg(_theme->version());
}
@ -433,13 +434,13 @@ void Application::slotFolderOpenAction( const QString& alias )
qDebug() << "opening local url " << f->path();
if( f ) {
QUrl url(f->path(), QUrl::TolerantMode);
url.setScheme( "file" );
url.setScheme( QLatin1String("file") );
#ifdef Q_OS_WIN32
// work around a bug in QDesktopServices on Win32, see i-net
QString filePath = f->path();
if (filePath.startsWith("\\\\") || filePath.startsWith("//"))
if (filePath.startsWith(QLatin1String("\\\\")) || filePath.startsWith(QLatin1String("//")))
url.setUrl(QDir::toNativeSeparators(filePath));
else
url = QUrl::fromLocalFile(filePath);
@ -482,25 +483,25 @@ void Application::slotAddFolder()
bool goodData = true;
QString alias = _folderWizard->field("alias").toString();
QString sourceFolder = _folderWizard->field("sourceFolder").toString();
QString alias = _folderWizard->field(QLatin1String("alias")).toString();
QString sourceFolder = _folderWizard->field(QLatin1String("sourceFolder")).toString();
QString backend = QLatin1String("csync");
QString targetPath;
bool onlyThisLAN = false;
bool onlyOnline = false;
if (_folderWizard->field("local?").toBool()) {
if (_folderWizard->field(QLatin1String("local?")).toBool()) {
// setup a local csync folder
targetPath = _folderWizard->field("targetLocalFolder").toString();
} else if (_folderWizard->field("remote?").toBool()) {
targetPath = _folderWizard->field(QLatin1String("targetLocalFolder")).toString();
} else if (_folderWizard->field(QLatin1String("remote?")).toBool()) {
// setup a remote csync folder
targetPath = _folderWizard->field("targetURLFolder").toString();
onlyOnline = _folderWizard->field("onlyOnline?").toBool();
onlyThisLAN = _folderWizard->field("onlyThisLAN?").toBool();
} else if( _folderWizard->field("OC?").toBool()) {
targetPath = _folderWizard->field(QLatin1String("targetURLFolder")).toString();
onlyOnline = _folderWizard->field(QLatin1String("onlyOnline?")).toBool();
onlyThisLAN = _folderWizard->field(QLatin1String("onlyThisLAN?")).toBool();
} else if( _folderWizard->field(QLatin1String("OC?")).toBool()) {
// setup a ownCloud folder
backend = QLatin1String("owncloud");
targetPath = _folderWizard->field("targetOCFolder").toString();
targetPath = _folderWizard->field(QLatin1String("targetOCFolder")).toString();
} else {
qWarning() << "* Folder not local and note remote?";
goodData = false;
@ -574,7 +575,8 @@ void Application::slotOpenLogBrowser()
*/
void Application::slotRemoveFolder( const QString& alias )
{
int ret = QMessageBox::question( 0, tr("Confirm Folder Remove"), tr("Do you really want to remove upload folder <i>%1</i>?").arg(alias),
int ret = QMessageBox::question( 0, tr("Confirm Folder Remove"),
tr("Do you really want to remove upload folder <i>%1</i>?").arg(alias),
QMessageBox::Yes|QMessageBox::No );
if( ret == QMessageBox::No ) {
@ -633,7 +635,7 @@ void Application::slotInfoFolder( const QString& alias )
QMessageBox infoBox( QMessageBox::Information, tr( "Folder information" ), alias, QMessageBox::Ok );
QStringList li = folderResult.errorStrings();
foreach( const QString& l, li ) {
folderMessage += QString("<p>%1</p>").arg( l );
folderMessage += QString::fromLatin1("<p>%1</p>").arg( l );
}
infoBox.setText( folderMessage );
@ -646,18 +648,18 @@ void Application::slotInfoFolder( const QString& alias )
QHash< QString, QStringList >::const_iterator change_it = changes.constBegin();
for(; change_it != changes.constEnd(); ++change_it ) {
QString changeType = tr( "Unknown" );
if ( change_it.key() == "changed" ) {
if ( change_it.key() == QLatin1String("changed") ) {
changeType = tr( "Changed files:\n" );
} else if ( change_it.key() == "added" ) {
} else if ( change_it.key() == QLatin1String("added") ) {
changeType = tr( "Added files:\n" );
} else if ( change_it.key() == "deleted" ) {
} else if ( change_it.key() == QLatin1String("deleted") ) {
changeType = tr( "New files in the server, or files deleted locally:\n");
}
QStringList files = change_it.value();
QString fileList;
foreach( const QString& file, files) {
fileList += file + QChar('\n');
fileList += file + QLatin1Char('\n');
}
details += changeType + fileList;
}
@ -777,7 +779,7 @@ void Application::computeOverallSyncStatus()
}
}
qDebug() << "Folder in overallStatus Message: " << syncedFolder << " with name " << syncedFolder->alias();
QString msg = QString("Folder %1: %2").arg(syncedFolder->alias()).arg(folderMessage);
QString msg = QString::fromLatin1("Folder %1: %2").arg(syncedFolder->alias()).arg(folderMessage);
if( msg != _overallStatusStrings[syncedFolder->alias()] ) {
_overallStatusStrings[syncedFolder->alias()] = msg;
}
@ -787,7 +789,7 @@ void Application::computeOverallSyncStatus()
if( overallResult.status() != SyncResult::Undefined ) {
QStringList allStatusStrings = _overallStatusStrings.values();
if( ! allStatusStrings.isEmpty() )
trayMessage = allStatusStrings.join("\n");
trayMessage = allStatusStrings.join(QLatin1String("\n"));
else
trayMessage = tr("No sync folders configured.");

View file

@ -83,7 +83,7 @@ void CSyncFolder::slotCSyncFinished()
SyncResult res(SyncResult::Success);
if( _csyncError ) {
res.setStatus( SyncResult::Error );
res.setErrorString( _errors.join("\\n"));
res.setErrorString( _errors.join(QLatin1String("\\n")));
}
emit syncFinished( res );
}

View file

@ -99,8 +99,8 @@ struct ProxyInfo {
}
if( file ) {
QString source(wStats->sourcePath);
source.append(file->path);
QString source = QString::fromLocal8Bit(wStats->sourcePath);
source.append(QString::fromLocal8Bit(file->path));
QFileInfo fi(source);
if( fi.isDir()) { // File type directory.
@ -126,7 +126,7 @@ CSyncThread::CSyncThread(const QString &source, const QString &target, bool loca
{
_mutex.lock();
if( ! _source.endsWith('/')) _source.append('/');
if( ! _source.endsWith(QLatin1Char('/'))) _source.append(QLatin1Char('/'));
_mutex.unlock();
}
@ -375,10 +375,10 @@ int CSyncThread::getauth(const char *prompt,
QString qPrompt = QString::fromLocal8Bit( prompt ).trimmed();
_mutex.lock();
if( qPrompt == QString::fromLocal8Bit("Enter your username:") ) {
if( qPrompt == QLatin1String("Enter your username:") ) {
// qDebug() << "OOO Username requested!";
qstrncpy( buf, _user.toUtf8().constData(), len );
} else if( qPrompt == QString::fromLocal8Bit("Enter your password:") ) {
} else if( qPrompt == QLatin1String("Enter your password:") ) {
// qDebug() << "OOO Password requested!";
qstrncpy( buf, _passwd.toUtf8().constData(), len );
} else {

View file

@ -31,8 +31,8 @@ FolderMan::FolderMan(QObject *parent) :
// if QDir::mkpath would not be so stupid, I would not need to have this
// duplication of folderConfigPath() here
QDir storageDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
storageDir.mkpath("folders");
_folderConfigPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/folders";
storageDir.mkpath(QLatin1String("folders"));
_folderConfigPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/folders");
_folderChangeSignalMapper = new QSignalMapper(this);
connect(_folderChangeSignalMapper, SIGNAL(mapped(const QString &)),
@ -98,12 +98,12 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
Folder *folder = 0L;
qDebug() << " ` -> setting up:" << file;
QSettings settings( _folderConfigPath + QChar('/') + file, QSettings::IniFormat);
qDebug() << " -> file path: " + settings.fileName();
QSettings settings( _folderConfigPath + QLatin1Char('/') + file, QSettings::IniFormat);
qDebug() << " -> file path: " << settings.fileName();
settings.beginGroup( file ); // read the group with the same name as the file which is the folder alias
QString path = settings.value("localpath").toString();
QString path = settings.value(QLatin1String("localpath")).toString();
if ( path.isNull() || !QFileInfo( path ).isDir() ) {
qWarning() << " `->" << path << "does not exist. Skipping folder" << file;
// _tray->showMessage(tr("Unknown folder"),
@ -112,30 +112,31 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
return folder;
}
QString backend = settings.value("backend").toString();
QString targetPath = settings.value( "targetPath" ).toString();
QString connection = settings.value( "connection" ).toString();
QString backend = settings.value(QLatin1String("backend")).toString();
QString targetPath = settings.value( QLatin1String("targetPath") ).toString();
QString connection = settings.value( QLatin1String("connection") ).toString();
if (!backend.isEmpty()) {
if (backend == "unison") {
if (backend == QLatin1String("unison")) {
folder = new UnisonFolder(file, path, targetPath, this );
} else if (backend == "csync") {
} else if (backend == QLatin1String("csync")) {
#ifdef WITH_CSYNC
folder = new CSyncFolder(file, path, targetPath, this );
#else
qCritical() << "* csync support not enabled!! ignoring:" << file;
#endif
} else if( backend == "owncloud" ) {
} else if( backend == QLatin1String("owncloud") ) {
#ifdef WITH_CSYNC
MirallConfigFile cfgFile;
// assemble the owncloud url to pass to csync, incl. webdav
QString oCUrl = cfgFile.ownCloudUrl( QString(), true );
QString oCUrl = cfgFile.ownCloudUrl( QString::null, true );
// cut off the leading slash, oCUrl always has a trailing.
if( targetPath.startsWith('/') ) {
if( targetPath.startsWith(QLatin1Char('/')) ) {
targetPath.remove(0,1);
}
@ -150,7 +151,7 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
}
folder->setBackend( backend );
// folder->setOnlyOnlineEnabled(settings.value("folder/onlyOnline", false).toBool());
folder->setOnlyThisLANEnabled(settings.value("folder/onlyThisLAN", false).toBool());
folder->setOnlyThisLANEnabled(settings.value(QLatin1String("folder/onlyThisLAN"), false).toBool());
_folderMap[file] = folder;
@ -305,13 +306,13 @@ void FolderMan::addFolderDefinition( const QString& backend, const QString& alia
bool onlyThisLAN )
{
// Create a settings file named after the alias
QSettings settings( _folderConfigPath + QChar('/') + alias, QSettings::IniFormat);
QSettings settings( _folderConfigPath + QLatin1Char('/') + alias, QSettings::IniFormat);
settings.setValue(QString("%1/localPath").arg(alias), sourceFolder );
settings.setValue(QString("%1/targetPath").arg(alias), targetPath );
settings.setValue(QString("%1/backend").arg(alias), backend );
settings.setValue(QString("%1/connection").arg(alias), QString::fromLocal8Bit("ownCloud"));
settings.setValue(QString("%1/onlyThisLAN").arg(alias), onlyThisLAN );
settings.setValue(QString::fromLatin1("%1/localPath").arg(alias), sourceFolder );
settings.setValue(QString::fromLatin1("%1/targetPath").arg(alias), targetPath );
settings.setValue(QString::fromLatin1("%1/backend").arg(alias), backend );
settings.setValue(QString::fromLatin1("%1/connection").arg(alias), QLatin1String("ownCloud"));
settings.setValue(QString::fromLatin1("%1/onlyThisLAN").arg(alias), onlyThisLAN );
settings.sync();
}
@ -349,7 +350,7 @@ void FolderMan::removeFolder( const QString& alias )
qDebug() << "!! Can not remove " << alias << ", not in folderMap.";
}
QFile file( _folderConfigPath + QChar('/') + alias );
QFile file( _folderConfigPath + QLatin1Char('/') + alias );
if( file.exists() ) {
qDebug() << "Remove folder config file " << file.fileName();
file.remove();

View file

@ -87,7 +87,7 @@ void FolderWatcher::setIgnoreListFile( const QString& file )
while (!infile.atEnd()) {
QString line = QString::fromLocal8Bit( infile.readLine() ).trimmed();
if( !line.startsWith( '#' )) {
if( !line.startsWith( QLatin1Char('#') )) {
addIgnore(line);
}
}
@ -281,7 +281,11 @@ void FolderWatcher::slotProcessTimerTimeout()
void FolderWatcher::setProcessTimer()
{
if (!_processTimer->isActive()) {
qDebug() << "* Pending events for" << root() << "will be processed after events stop for" << eventInterval() << "seconds (" << QTime::currentTime().addSecs(eventInterval()).toString("HH:mm:ss") << ")." << _pendingPathes.size() << "events until now )";
qDebug() << "* Pending events for" << root()
<< "will be processed after events stop for"
<< eventInterval() << "seconds ("
<< QTime::currentTime().addSecs(eventInterval()).toString(QLatin1String("HH:mm:ss"))
<< ")." << _pendingPathes.size() << "events until now )";
}
_processTimer->start(eventInterval());
}

View file

@ -35,9 +35,9 @@ FolderWizardSourcePage::FolderWizardSourcePage()
:_folderMap(0)
{
_ui.setupUi(this);
registerField("sourceFolder*", _ui.localFolderLineEdit);
_ui.localFolderLineEdit->setText( QString( "%1/%2").arg( QDir::homePath() ).arg("ownCloud" ) );
registerField("alias*", _ui.aliasLineEdit);
registerField(QLatin1String("sourceFolder*"), _ui.localFolderLineEdit);
_ui.localFolderLineEdit->setText( QString::fromLatin1( "%1/%2").arg( QDir::homePath() ).arg(QLatin1String("ownCloud") ) );
registerField(QLatin1String("alias*"), _ui.aliasLineEdit);
_ui.aliasLineEdit->setText( QString::fromLatin1("ownCloud") );
_ui.warnLabel->hide();
@ -82,7 +82,7 @@ bool FolderWizardSourcePage::isComplete() const
while( isOk && i != map->constEnd() ) {
Folder *f = static_cast<Folder*>(i.value());
QString folderDir = QDir( f->path() ).canonicalPath();
if( ! folderDir.endsWith('/') ) folderDir.append('/');
if( ! folderDir.endsWith(QLatin1Char('/')) ) folderDir.append(QLatin1Char('/'));
qDebug() << "Checking local path: " << folderDir << " <-> " << userInput;
if( QFileInfo( f->path() ) == userInput ) {
@ -127,7 +127,7 @@ bool FolderWizardSourcePage::isComplete() const
if( isOk ) {
_ui.warnLabel->hide();
_ui.warnLabel->setText( QString() );
_ui.warnLabel->setText( QString::null );
} else {
_ui.warnLabel->show();
_ui.warnLabel->setText( warnString );
@ -159,12 +159,12 @@ FolderWizardTargetPage::FolderWizardTargetPage()
_ui.setupUi(this);
_ui.warnFrame->hide();
registerField("local?", _ui.localFolderRadioBtn);
registerField("remote?", _ui.urlFolderRadioBtn);
registerField("OC?", _ui.OCRadioBtn);
registerField("targetLocalFolder", _ui.localFolder2LineEdit);
registerField("targetURLFolder", _ui.urlFolderLineEdit);
registerField("targetOCFolder", _ui.OCFolderLineEdit);
registerField(QLatin1String("local?"), _ui.localFolderRadioBtn);
registerField(QLatin1String("remote?"), _ui.urlFolderRadioBtn);
registerField(QLatin1String("OC?"), _ui.OCRadioBtn);
registerField(QLatin1String("targetLocalFolder"), _ui.localFolder2LineEdit);
registerField(QLatin1String("targetURLFolder"), _ui.urlFolderLineEdit);
registerField(QLatin1String("targetOCFolder"), _ui.OCFolderLineEdit);
connect( _ui.OCFolderLineEdit, SIGNAL(textChanged(QString)),
SLOT(slotFolderTextChanged(QString)));
@ -255,7 +255,8 @@ bool FolderWizardTargetPage::isComplete() const
return QFileInfo(_ui.localFolder2LineEdit->text()).isDir();
} else if (_ui.urlFolderRadioBtn->isChecked()) {
QUrl url(_ui.urlFolderLineEdit->text());
return url.isValid() && (url.scheme() == "sftp" || url.scheme() == "smb");
return url.isValid() && (url.scheme() == QLatin1String("sftp")
|| url.scheme() == QLatin1String("smb"));
} else if( _ui.OCRadioBtn->isChecked()) {
/* owncloud selected */
QString dir = _ui.OCFolderLineEdit->text();
@ -399,8 +400,8 @@ void FolderWizardTargetPage::on_localFolder2ChooseBtn_clicked()
FolderWizardNetworkPage::FolderWizardNetworkPage()
{
_ui.setupUi(this);
registerField("onlyNetwork*", _ui.checkBoxOnlyOnline);
registerField("onlyLocalNetwork*", _ui.checkBoxOnlyThisLAN );
registerField(QLatin1String("onlyNetwork*"), _ui.checkBoxOnlyOnline);
registerField(QLatin1String("onlyLocalNetwork*"), _ui.checkBoxOnlyThisLAN );
}
FolderWizardNetworkPage::~FolderWizardNetworkPage()
@ -415,10 +416,10 @@ bool FolderWizardNetworkPage::isComplete() const
FolderWizardOwncloudPage::FolderWizardOwncloudPage()
{
_ui.setupUi(this);
registerField("OCUrl*", _ui.lineEditOCUrl);
registerField("OCUser*", _ui.lineEditOCUser );
registerField("OCPasswd", _ui.lineEditOCPasswd);
registerField("OCSiteAlias*", _ui.lineEditOCAlias);
registerField(QLatin1String("OCUrl*"), _ui.lineEditOCUrl);
registerField(QLatin1String("OCUser*"), _ui.lineEditOCUser );
registerField(QLatin1String("OCPasswd"), _ui.lineEditOCPasswd);
registerField(QLatin1String("OCSiteAlias*"), _ui.lineEditOCAlias);
}
FolderWizardOwncloudPage::~FolderWizardOwncloudPage()
@ -427,9 +428,9 @@ FolderWizardOwncloudPage::~FolderWizardOwncloudPage()
void FolderWizardOwncloudPage::initializePage()
{
_ui.lineEditOCAlias->setText( "ownCloud" );
_ui.lineEditOCUrl->setText( "http://localhost/owncloud" );
QString user( qgetenv("USER"));
_ui.lineEditOCAlias->setText( QLatin1String("ownCloud") );
_ui.lineEditOCUrl->setText( QLatin1String("http://localhost/owncloud") );
QString user = QString::fromLocal8Bit(qgetenv("USER"));
_ui.lineEditOCUser->setText( user );
}
@ -456,7 +457,9 @@ FolderWizard::FolderWizard( QWidget *parent, Theme *theme )
setPage(Page_Target, new FolderWizardTargetPage());
// setPage(Page_Network, new FolderWizardNetworkPage());
// setPage(Page_Owncloud, new FolderWizardOwncloudPage());
setWindowTitle( tr( "%1 Folder Wizard").arg( theme ? theme->appName() : "Mirall" ) );
setWindowTitle( tr( "%1 Folder Wizard")
.arg( theme ? theme->appName()
: QLatin1String("Mirall") ) );
#ifdef Q_WS_MAC
setWizardStyle( QWizard::ModernStyle );
#endif

View file

@ -60,7 +60,7 @@ void Logger::log(Log log)
{
QString msg;
if( _showTime ) {
msg = log.timeStamp.toString("MM-dd hh:mm:ss:zzz") + " ";
msg = log.timeStamp.toString(QLatin1String("MM-dd hh:mm:ss:zzz")) + QLatin1Char(' ');
}
if( log.source == Log::CSync ) {
@ -102,7 +102,7 @@ LogWidget::LogWidget(QWidget *parent)
setReadOnly( true );
setLineWrapMode( QTextEdit::NoWrap );
QFont font;
font.setFamily("Courier New");
font.setFamily(QLatin1String("Courier New"));
font.setFixedPitch(true);
document()->setDefaultFont( font );
@ -240,7 +240,7 @@ void LogBrowser::search( const QString& str )
extraSelections.append(extra);
}
QString stat = QString("Search term %1 with %2 search results.").arg(str).arg(extraSelections.count());
QString stat = QString::fromLatin1("Search term %1 with %2 search results.").arg(str).arg(extraSelections.count());
_statusLabel->setText(stat);
_logWidget->setExtraSelections(extraSelections);

View file

@ -42,13 +42,13 @@ MirallConfigFile::MirallConfigFile( const QString& appendix )
QString MirallConfigFile::configPath() const
{
QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
if( !dir.endsWith('/') ) dir.append('/');
if( !dir.endsWith(QLatin1Char('/')) ) dir.append(QLatin1Char('/'));
return dir;
}
QString MirallConfigFile::excludeFile() const
{
const QString exclFile("exclude.lst");
const QString exclFile(QLatin1String("exclude.lst"));
QString dir = configPath();
dir += exclFile;
@ -74,7 +74,7 @@ QString MirallConfigFile::excludeFile() const
return fi.absoluteFilePath();
}
qDebug() << "EMPTY exclude file path!";
return QString();
return QString::null;
}
QString MirallConfigFile::configFile() const
@ -89,7 +89,7 @@ QString MirallConfigFile::configFile() const
}
QString dir = configPath() + theme.configFileName();
if( !_customHandle.isEmpty() ) {
dir.append( QChar('_'));
dir.append( QLatin1Char('_'));
dir.append( _customHandle );
qDebug() << " OO Custom config file in use: " << dir;
}
@ -104,7 +104,7 @@ bool MirallConfigFile::exists()
QString MirallConfigFile::defaultConnection() const
{
return QString::fromLocal8Bit("ownCloud");
return QLatin1String("ownCloud");
}
bool MirallConfigFile::connectionExists( const QString& conn )
@ -115,7 +115,7 @@ bool MirallConfigFile::connectionExists( const QString& conn )
QSettings settings( configFile(), QSettings::IniFormat);
settings.setIniCodec( "UTF-8" );
return settings.contains( QString("%1/url").arg( conn ) );
return settings.contains( QString::fromLatin1("%1/url").arg( conn ) );
}
@ -137,15 +137,15 @@ void MirallConfigFile::writeOwncloudConfig( const QString& connection,
cloudsUrl.prepend(QLatin1String("http://"));
settings.beginGroup( connection );
settings.setValue("url", cloudsUrl );
settings.setValue("user", user );
settings.setValue( QLatin1String("url"), cloudsUrl );
settings.setValue( QLatin1String("user"), user );
if( skipPwd ) {
pwd.clear();
}
QByteArray pwdba = pwd.toUtf8();
settings.setValue( "passwd", QVariant(pwdba.toBase64()) );
settings.setValue( "nostoredpassword", QVariant(skipPwd) );
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
settings.setValue( QLatin1String("nostoredpassword"), QVariant(skipPwd) );
settings.sync();
// check the perms, only read-write for the owner.
@ -161,7 +161,7 @@ void MirallConfigFile::setOwnCloudUrl( const QString& connection, const QString
QSettings settings( file, QSettings::IniFormat);
settings.setIniCodec( "UTF-8" );
settings.beginGroup( connection );
settings.setValue("url", url );
settings.setValue( QLatin1String("url"), url );
settings.sync();
}
@ -199,7 +199,7 @@ void MirallConfigFile::removeConnection( const QString& connection )
QSettings settings( configFile(), QSettings::IniFormat);
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
settings.remove(""); // removes all content from the group
settings.remove(QString::null); // removes all content from the group
settings.sync();
}
@ -225,10 +225,10 @@ QString MirallConfigFile::ownCloudUrl( const QString& connection, bool webdav )
qDebug() << "###################### THIS SHOULD NOT HAPPEN! ########################";
}
QString url = settings.value( "url" ).toString();
QString url = settings.value( QLatin1String("url") ).toString();
if( ! url.isEmpty() ) {
if( ! url.endsWith('/')) url.append('/');
if( webdav ) url.append(QLatin1String("files/webdav.php/"));
if( ! url.endsWith(QLatin1Char('/'))) url.append(QLatin1String("/"));
if( webdav ) url.append( QLatin1String("files/webdav.php/") );
}
// qDebug() << "Returning configured owncloud url: " << url;
@ -245,7 +245,7 @@ QString MirallConfigFile::ownCloudUser( const QString& connection ) const
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
QString user = settings.value( "user" ).toString();
QString user = settings.value( QLatin1String("user") ).toString();
// qDebug() << "Returning configured owncloud user: " << user;
return user;
@ -260,8 +260,8 @@ int MirallConfigFile::remotePollInterval( const QString& connection ) const
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
int remoteInterval = settings.value( "remotePollInterval", DEFAULT_REMOTE_POLL_INTERVAL ).toInt();
int localInterval = settings.value("localPollInterval", DEFAULT_LOCAL_POLL_INTERVAL ).toInt();
int remoteInterval = settings.value( QLatin1String("remotePollInterval"), DEFAULT_REMOTE_POLL_INTERVAL ).toInt();
int localInterval = settings.value(QLatin1String("localPollInterval"), DEFAULT_LOCAL_POLL_INTERVAL ).toInt();
if( remoteInterval < 2*localInterval ) {
qDebug() << "WARN: remote poll Interval should at least be twice as local poll interval!";
}
@ -281,8 +281,8 @@ int MirallConfigFile::localPollInterval( const QString& connection ) const
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
int remoteInterval = settings.value( "remotePollInterval", DEFAULT_REMOTE_POLL_INTERVAL ).toInt();
int localInterval = settings.value("localPollInterval", DEFAULT_LOCAL_POLL_INTERVAL ).toInt();
int remoteInterval = settings.value( QLatin1String("remotePollInterval"), DEFAULT_REMOTE_POLL_INTERVAL ).toInt();
int localInterval = settings.value(QLatin1String("localPollInterval"), DEFAULT_LOCAL_POLL_INTERVAL ).toInt();
if( remoteInterval < 2*localInterval ) {
qDebug() << "WARN: remote poll Interval should at least be twice as local poll interval!";
}
@ -302,7 +302,7 @@ int MirallConfigFile::pollTimerExceedFactor( const QString& connection ) const
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
int pte = settings.value( "pollTimerExeedFactor", DEFAULT_POLL_TIMER_EXEED).toInt();
int pte = settings.value( QLatin1String("pollTimerExeedFactor"), DEFAULT_POLL_TIMER_EXEED).toInt();
if( pte < 1 ) pte = DEFAULT_POLL_TIMER_EXEED;
@ -320,14 +320,14 @@ QString MirallConfigFile::ownCloudPasswd( const QString& connection ) const
QString pwd;
bool boolfalse( false );
bool skipPwd = settings.value( "nostoredpassword", QVariant(boolfalse) ).toBool();
bool skipPwd = settings.value( QLatin1String("nostoredpassword"), false ).toBool();
if( skipPwd ) {
if( ! _askedUser ) {
bool ok;
QString text = QInputDialog::getText(0, QObject::tr("ownCloud Password Required"),
QObject::tr("Please enter your ownCloud password:"), QLineEdit::Password,
QString(), &ok);
QString text = QInputDialog::getText(0, QApplication::translate("MirallConfigFile","ownCloud Password Required"),
QApplication::translate("MirallConfigFile","Please enter your ownCloud password:"),
QLineEdit::Password,
QString::null, &ok);
if( ok && !text.isEmpty() ) { // empty password is not allowed on ownCloud
_passwd = text;
_askedUser = true;
@ -335,18 +335,18 @@ QString MirallConfigFile::ownCloudPasswd( const QString& connection ) const
}
pwd = _passwd;
} else {
QByteArray pwdba = settings.value("passwd").toByteArray();
QByteArray pwdba = settings.value(QLatin1String("passwd")).toByteArray();
if( pwdba.isEmpty() ) {
// check the password entry, cleartext from before
// read it and convert to base64, delete the cleartext entry.
QString p = settings.value("password").toString();
QString p = settings.value(QLatin1String("password")).toString();
if( ! p.isEmpty() ) {
// its there, save base64-encoded and delete.
pwdba = p.toUtf8();
settings.setValue( "passwd", QVariant(pwdba.toBase64()) );
settings.remove( "password" );
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
settings.remove( QLatin1String("password") );
settings.sync();
}
}
@ -377,7 +377,7 @@ bool MirallConfigFile::ownCloudSkipUpdateCheck( const QString& connection ) cons
settings.setIniCodec( "UTF-8" );
settings.beginGroup( con );
bool skipIt = settings.value( "skipUpdateCheck", false ).toBool();
bool skipIt = settings.value( QLatin1String("skipUpdateCheck"), false ).toBool();
return skipIt;
}
@ -386,15 +386,15 @@ int MirallConfigFile::maxLogLines() const
{
QSettings settings( configFile(), QSettings::IniFormat );
settings.setIniCodec( "UTF-8" );
settings.beginGroup("Logging");
int logLines = settings.value( "maxLogLines", 20000 ).toInt();
settings.beginGroup(QLatin1String("Logging"));
int logLines = settings.value( QLatin1String("maxLogLines"), 20000 ).toInt();
return logLines;
}
QByteArray MirallConfigFile::basicAuthHeader() const
{
QString concatenated = ownCloudUser() + QChar(':') + ownCloudPasswd();
const QString b("Basic ");
QString concatenated = ownCloudUser() + QLatin1Char(':') + ownCloudPasswd();
const QString b(QLatin1String("Basic "));
QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64();
return data;
@ -470,7 +470,7 @@ QVariant MirallConfigFile::customMedia( customMediaType type )
settings.setIniCodec( "UTF-8" );
settings.beginGroup(QLatin1String("GUICustomize"));
QString val = settings.value( key, QString() ).toString();
QString val = settings.value( key ).toString();
if( !val.isEmpty() ) {
QPixmap pix( val );
@ -493,13 +493,13 @@ void MirallConfigFile::setProxyType(int proxyType,
{
QSettings settings( configFile(), QSettings::IniFormat );
settings.setIniCodec( "UTF-8" );
settings.beginGroup("proxy");
settings.beginGroup(QLatin1String("proxy"));
settings.setValue("type", proxyType);
settings.setValue("host", host);
settings.setValue("port", port);
settings.setValue("user", user);
settings.setValue("pass", pass);
settings.setValue(QLatin1String("type"), proxyType);
settings.setValue(QLatin1String("host"), host);
settings.setValue(QLatin1String("port"), port);
settings.setValue(QLatin1String("user"), user);
settings.setValue(QLatin1String("pass"), pass);
settings.sync();
}
@ -515,27 +515,27 @@ QVariant MirallConfigFile::getValue(const QString& param, const QString& group)
int MirallConfigFile::proxyType() const
{
return getValue("type", "proxy").toInt();
return getValue(QLatin1String("type"), QLatin1String("proxy")).toInt();
}
QString MirallConfigFile::proxyHostName() const
{
return getValue("host", "proxy").toString();
return getValue(QLatin1String("host"), QLatin1String("proxy")).toString();
}
int MirallConfigFile::proxyPort() const
{
return getValue("port", "proxy").toInt();
return getValue(QLatin1String("port"), QLatin1String("proxy")).toInt();
}
QString MirallConfigFile::proxyUser() const
{
return getValue("user", "proxy").toString();
return getValue(QLatin1String("user"), QLatin1String("proxy")).toString();
}
QString MirallConfigFile::proxyPassword() const
{
QByteArray pass = getValue("pass", "proxy").toByteArray();
QByteArray pass = getValue(QLatin1String("pass"), QLatin1String("proxy")).toByteArray();
return QString::fromUtf8(QByteArray::fromBase64(pass));
}

View file

@ -28,17 +28,17 @@ mirallTheme::mirallTheme()
QString mirallTheme::appName() const
{
return QString::fromLocal8Bit("Mirall");
return QLatin1String("Mirall");
}
QString mirallTheme::configFileName() const
{
return QString::fromLocal8Bit("mirall.cfg");
return QLatin1String("mirall.cfg");
}
QPixmap mirallTheme::splashScreen() const
{
return QPixmap(":/mirall/resources/owncloud_splash.png"); // FIXME: mirall splash!
return QPixmap(QLatin1String(":/mirall/resources/owncloud_splash.png")); // FIXME: mirall splash!
}
QIcon mirallTheme::folderIcon( const QString& backend ) const
@ -46,16 +46,16 @@ QIcon mirallTheme::folderIcon( const QString& backend ) const
QString name;
if( backend == QString::fromLatin1("owncloud")) {
name = QString( "mirall" );
name = QLatin1String( "mirall" );
}
if( backend == QString::fromLatin1("unison" )) {
name = QString( "folder-sync" );
name = QLatin1String( "folder-sync" );
}
if( backend == QString::fromLatin1("csync" )) {
name = QString( "folder-remote" );
name = QLatin1String( "folder-remote" );
}
if( backend.isEmpty() || backend == QString::fromLatin1("none") ) {
name = QString("folder-grey.png");
name = QLatin1String("folder-grey.png");
}
qDebug() << "==> load folder icon " << name;
@ -68,25 +68,25 @@ QIcon mirallTheme::syncStateIcon( SyncResult::Status status ) const
switch( status ) {
case SyncResult::Undefined:
statusIcon = "dialog-close";
statusIcon = QLatin1String("dialog-close");
break;
case SyncResult::NotYetStarted:
statusIcon = "task-ongoing";
statusIcon = QLatin1String("task-ongoing");
break;
case SyncResult::SyncRunning:
statusIcon = "view-refresh";
statusIcon = QLatin1String("view-refresh");
break;
case SyncResult::Success:
statusIcon = "dialog-ok";
statusIcon = QLatin1String("dialog-ok");
break;
case SyncResult::Error:
statusIcon = "dialog-close";
statusIcon = QLatin1String("dialog-close");
break;
case SyncResult::SetupError:
statusIcon = "dialog-cancel";
statusIcon = QLatin1String("dialog-cancel");
break;
default:
statusIcon = "dialog-close";
statusIcon = QLatin1String("dialog-close");
}
return themeIcon( statusIcon );
}
@ -95,12 +95,12 @@ QIcon mirallTheme::syncStateIcon( SyncResult::Status status ) const
QIcon mirallTheme::folderDisabledIcon() const
{
// Fixme: Do we really want the dialog-canel from theme here?
return themeIcon( "dialog-cancel" );
return themeIcon( QLatin1String("dialog-cancel") );
}
QIcon mirallTheme::applicationIcon( ) const
{
return themeIcon( "mirall");
return themeIcon( QLatin1String("mirall"));
}
}

View file

@ -38,7 +38,7 @@ NetworkLocation::~NetworkLocation()
NetworkLocation NetworkLocation::currentLocation()
{
QProcess ip;
ip.start("/sbin/ip", QStringList() << "route");
ip.start(QLatin1String("/sbin/ip"), QStringList() << QLatin1String("route"));
if (!ip.waitForStarted())
return NetworkLocation();
@ -59,7 +59,7 @@ NetworkLocation NetworkLocation::currentLocation()
return NetworkLocation();
QProcess arp;
arp.start("/sbin/arp", QStringList() << "-a");
arp.start(QLatin1String("/sbin/arp"), QStringList() << QLatin1String("-a"));
if (!arp.waitForStarted())
return NetworkLocation();
@ -79,7 +79,7 @@ NetworkLocation NetworkLocation::currentLocation()
if (gwMAC.isEmpty())
return NetworkLocation();
return NetworkLocation(gwMAC);
return NetworkLocation(QString::fromLatin1(gwMAC));
}

View file

@ -41,7 +41,7 @@ QString Owncloudclient::web() const
Owncloudclient Owncloudclient::parseElement( const QDomElement &element, bool *ok )
{
if ( element.tagName() != "owncloudclient" ) {
if ( element.tagName() != QLatin1String("owncloudclient") ) {
qCritical() << "Expected 'owncloudclient', got '" << element.tagName() << "'.";
if ( ok ) *ok = false;
return Owncloudclient();
@ -52,13 +52,13 @@ Owncloudclient Owncloudclient::parseElement( const QDomElement &element, bool *o
QDomNode n;
for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
QDomElement e = n.toElement();
if ( e.tagName() == "version" ) {
if ( e.tagName() == QLatin1String("version") ) {
result.setVersion( e.text() );
}
else if ( e.tagName() == "versionstring" ) {
else if ( e.tagName() == QLatin1String("versionstring") ) {
result.setVersionstring( e.text() );
}
else if ( e.tagName() == "web" ) {
else if ( e.tagName() == QLatin1String("web") ) {
result.setWeb( e.text() );
}
}
@ -70,15 +70,15 @@ Owncloudclient Owncloudclient::parseElement( const QDomElement &element, bool *o
void Owncloudclient::writeElement( QXmlStreamWriter &xml )
{
xml.writeStartElement( "owncloudclient" );
xml.writeStartElement( QLatin1String("owncloudclient") );
if ( !version().isEmpty() ) {
xml.writeTextElement( "version", version() );
xml.writeTextElement( QLatin1String("version"), version() );
}
if ( !versionstring().isEmpty() ) {
xml.writeTextElement( "versionstring", versionstring() );
xml.writeTextElement( QLatin1String("versionstring"), versionstring() );
}
if ( !web().isEmpty() ) {
xml.writeTextElement( "web", web() );
xml.writeTextElement( QLatin1String("web"), web() );
}
xml.writeEndElement();
}
@ -139,7 +139,7 @@ bool Owncloudclient::writeFile( const QString &filename )
QXmlStreamWriter xml( &file );
xml.setAutoFormatting( true );
xml.setAutoFormattingIndent( 2 );
xml.writeStartDocument( "1.0" );
xml.writeStartDocument( QLatin1String("1.0") );
writeElement( xml );
xml.writeEndDocument();
file.close();

View file

@ -89,7 +89,7 @@ QString ownCloudFolder::secondPath() const
{
QString re(_secondPath);
MirallConfigFile cfg;
const QString ocUrl = cfg.ownCloudUrl(QString(), true);
const QString ocUrl = cfg.ownCloudUrl(QString::null, true);
// qDebug() << "**** " << ocUrl << " <-> " << re;
if( re.startsWith( ocUrl ) ) {
re.remove( ocUrl );
@ -118,10 +118,10 @@ void ownCloudFolder::startSync(const QStringList &pathList)
QUrl url( _secondPath );
if( url.scheme() == QLatin1String("http") ) {
url.setScheme( "owncloud" );
url.setScheme( QLatin1String("owncloud") );
} else {
// connect SSL!
url.setScheme( "ownclouds" );
url.setScheme( QLatin1String("ownclouds") );
}
#ifdef USE_INOTIFY
@ -335,7 +335,7 @@ void ownCloudFolder::wipe()
qDebug() << "WRN: statedb is empty, can not remove.";
}
// Check if the tmp database file also exists
QString ctmpName = _csyncStateDbFile + ".ctmp";
QString ctmpName = _csyncStateDbFile + QLatin1String(".ctmp");
QFile ctmpFile( ctmpName );
if( ctmpFile.exists() ) {
ctmpFile.remove();

View file

@ -192,7 +192,7 @@ void ownCloudInfo::mkdirRequest( const QString& dir )
MirallConfigFile cfgFile( _configHandle );
QNetworkRequest req;
req.setUrl( QUrl( cfgFile.ownCloudUrl( _connection, true ) + dir ) );
QNetworkReply *reply = davRequest("MKCOL", req, 0);
QNetworkReply *reply = davRequest(QLatin1String("MKCOL"), req, 0);
// remember the confighandle used for this request
if( ! _configHandle.isEmpty() )
@ -368,7 +368,8 @@ void ownCloudInfo::slotReplyFinished()
}
_urlRedirectedTo.clear();
const QString version( reply->readAll() );
// TODO: check if this is always the correct encoding
const QString version = QString::fromUtf8( reply->readAll() );
const QString url = reply->url().toString();
QString plainUrl(url);
plainUrl.remove( QLatin1String("/status.php"));
@ -387,21 +388,23 @@ void ownCloudInfo::slotReplyFinished()
return;
}
qDebug() << "status.php returns: " << info << " " << reply->error() << " Reply: " << reply;
if( info.contains("installed") && info.contains("version") && info.contains("versionstring") ) {
if( info.contains(QLatin1String("installed"))
&& info.contains(QLatin1String("version"))
&& info.contains(QLatin1String("versionstring")) ) {
info.remove(0,1); // remove first char which is a "{"
info.remove(-1,1); // remove the last char which is a "}"
QStringList li = info.split( QChar(',') );
QStringList li = info.split( QLatin1Char(',') );
QString versionStr;
QString version;
QString edition;
foreach ( const QString& infoString, li ) {
QStringList touple = infoString.split( QChar(':'));
QStringList touple = infoString.split( QLatin1Char(':'));
QString key = touple[0];
key.remove(QChar('"'));
key.remove(QLatin1Char('"'));
QString val = touple[1];
val.remove(QChar('"'));
val.remove(QLatin1Char('"'));
if( key == QLatin1String("versionstring") ) {
// get the versionstring out.
@ -424,7 +427,7 @@ void ownCloudInfo::slotReplyFinished()
}
} else {
// it was a general GET request.
QString dir("unknown");
QString dir(QLatin1String("unknown"));
if( _directories.contains(reply) ) {
dir = _directories[reply];
_directories.remove(reply);
@ -453,15 +456,16 @@ void ownCloudInfo::setupHeaders( QNetworkRequest & req, quint64 size )
{
MirallConfigFile cfgFile(_configHandle );
QUrl url( cfgFile.ownCloudUrl( QString(), false ) );
QUrl url( cfgFile.ownCloudUrl( QString::null, false ) );
qDebug() << "Setting up host header: " << url.host();
req.setRawHeader( QByteArray("Host"), url.host().toUtf8() );
req.setRawHeader( QByteArray("User-Agent"), QString("mirall-%1").arg(MIRALL_STRINGIFY(MIRALL_VERSION)).toAscii());
req.setRawHeader( QByteArray("User-Agent"), QString::fromLatin1("mirall-%1")
.arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION))).toAscii());
req.setRawHeader( QByteArray("Authorization"), cfgFile.basicAuthHeader() );
if (size) {
req.setHeader( QNetworkRequest::ContentLengthHeader, QVariant(size));
req.setHeader( QNetworkRequest::ContentTypeHeader, QVariant("text/xml; charset=utf-8"));
req.setHeader( QNetworkRequest::ContentLengthHeader, size);
req.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String("text/xml; charset=utf-8"));
}
}

View file

@ -67,7 +67,7 @@ OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, Theme *theme, QO
// in case of cancel, terminate the owncloud-admin script.
connect( _ocWizard, SIGNAL(rejected()), _process, SLOT(terminate()));
_ocWizard->setWindowTitle( tr("%1 Connection Wizard").arg( theme ? theme->appName() : "Mirall" ) );
_ocWizard->setWindowTitle( tr("%1 Connection Wizard").arg( theme ? theme->appName() : QLatin1String("Mirall") ) );
}
@ -108,7 +108,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
// clear the custom config handle
_configHandle.clear();
ownCloudInfo::instance()->setCustomConfigHandle( QString() );
ownCloudInfo::instance()->setCustomConfigHandle( QString::null );
// disconnect the ocInfo object
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
@ -125,7 +125,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url )
{
qDebug() << "Connect to url: " << url;
_ocWizard->setField("OCUrl", url );
_ocWizard->setField(QLatin1String("OCUrl"), url );
_ocWizard->appendToResultWidget(tr("Trying to connect to ownCloud at %1...").arg(url ));
testOwnCloudConnect();
}
@ -134,15 +134,15 @@ void OwncloudSetupWizard::testOwnCloudConnect()
{
// write a temporary config.
QDateTime now = QDateTime::currentDateTime();
_configHandle = now.toString("MMddyyhhmmss");
_configHandle = now.toString(QLatin1String("MMddyyhhmmss"));
MirallConfigFile cfgFile( _configHandle );
cfgFile.writeOwncloudConfig( QLatin1String("ownCloud"),
_ocWizard->field("OCUrl").toString(),
_ocWizard->field("OCUser").toString(),
_ocWizard->field("OCPasswd").toString(),
_ocWizard->field("PwdNoLocalStore").toBool() );
_ocWizard->field(QLatin1String("OCUrl")).toString(),
_ocWizard->field(QLatin1String("OCUser")).toString(),
_ocWizard->field(QLatin1String("OCPasswd")).toString(),
_ocWizard->field(QLatin1String("PwdNoLocalStore")).toBool() );
// now start ownCloudInfo to check the connection.
ownCloudInfo::instance()->setCustomConfigHandle( _configHandle );
@ -198,20 +198,20 @@ void OwncloudSetupWizard::slotCreateOCLocalhost()
QStringList args;
args << "install";
args << "--server-type" << "local";
args << "--root_helper" << "kdesu -c";
args << QLatin1String("install");
args << QLatin1String("--server-type") << QLatin1String("local");
args << QLatin1String("--root_helper") << QLatin1String("kdesu -c");
const QString adminUser = _ocWizard->field("OCUser").toString();
const QString adminPwd = _ocWizard->field("OCPasswd").toString();
const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
const QString adminPwd = _ocWizard->field(QLatin1String("OCPasswd")).toString();
args << "--admin-user" << adminUser;
args << "--admin-password" << adminPwd;
args << QLatin1String("--admin-user") << adminUser;
args << QLatin1String("--admin-password") << adminPwd;
runOwncloudAdmin( args );
// define
_ocWizard->setField( "OCUrl", QString( "http://localhost/owncloud/") );
_ocWizard->setField( QLatin1String("OCUrl"), QLatin1String( "http://localhost/owncloud/") );
}
void OwncloudSetupWizard::slotInstallOCServer()
@ -221,32 +221,33 @@ void OwncloudSetupWizard::slotInstallOCServer()
return;
}
const QString server = _ocWizard->field("ftpUrl").toString();
const QString user = _ocWizard->field("ftpUser").toString();
const QString passwd = _ocWizard->field("ftpPasswd").toString();
const QString adminUser = _ocWizard->field("OCUser").toString();
const QString adminPwd = _ocWizard->field("OCPasswd").toString();
const QString server = _ocWizard->field(QLatin1String("ftpUrl")).toString();
const QString user = _ocWizard->field(QLatin1String("ftpUser")).toString();
const QString passwd = _ocWizard->field(QLatin1String("ftpPasswd")).toString();
const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
const QString adminPwd = _ocWizard->field(QLatin1String("OCPasswd")).toString();
qDebug() << "Install OC on " << server << " as user " << user;
QStringList args;
args << "install";
args << "--server-type" << "ftp";
args << "--server" << server;
args << "--ftp-user" << user;
args << QLatin1String("install");
args << QLatin1String("--server-type") << QLatin1String("ftp");
args << QLatin1String("--server") << server;
args << QLatin1String("--ftp-user") << user;
if( ! passwd.isEmpty() ) {
args << "--ftp-password" << passwd;
args << QLatin1String("--ftp-password") << passwd;
}
args << "--admin-user" << adminUser;
args << "--admin-password" << adminPwd;
args << QLatin1String("--admin-user") << adminUser;
args << QLatin1String("--admin-password") << adminPwd;
runOwncloudAdmin( args );
_ocWizard->setField( "OCUrl", QString( "%1/owncloud/").arg(_ocWizard->field("myOCDomain").toString() ));
_ocWizard->setField( QLatin1String("OCUrl"), QString::fromLatin1( "%1/owncloud/")
.arg(_ocWizard->field(QLatin1String("myOCDomain")).toString() ));
}
void OwncloudSetupWizard::runOwncloudAdmin( const QStringList& args )
{
const QString bin("/usr/bin/owncloud-admin");
const QString bin(QLatin1String("/usr/bin/owncloud-admin"));
qDebug() << "starting " << bin << " with args. " << args;
if( _process->state() != QProcess::NotRunning ) {
qDebug() << "Owncloud admin is still running, skip!";
@ -351,7 +352,7 @@ bool OwncloudSetupWizard::checkOwncloudAdmin( const QString& bin )
void OwncloudSetupWizard::setupLocalSyncFolder()
{
_localFolder = QDir::homePath() + QString::fromLocal8Bit("/ownCloud");
_localFolder = QDir::homePath() + QLatin1String("/ownCloud");
if( ! _folderMan ) return;

View file

@ -69,7 +69,7 @@ QIcon ownCloudTheme::folderIcon( const QString& backend ) const
QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
{
return themeIcon( "owncloud-icon" );
return themeIcon( QLatin1String("owncloud-icon") );
}
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status ) const

View file

@ -56,12 +56,12 @@ void setupCustomMedia( QVariant variant, QLabel *label )
OwncloudSetupPage::OwncloudSetupPage()
{
_ui.setupUi(this);
registerField( "OCUrl", _ui.leUrl );
registerField( "OCUser", _ui.leUsername );
registerField( "OCPasswd", _ui.lePassword);
registerField( "connectMyOC", _ui.cbConnectOC );
registerField( "secureConnect", _ui.cbSecureConnect );
registerField( "PwdNoLocalStore", _ui.cbNoPasswordStore );
registerField( QLatin1String("OCUrl"), _ui.leUrl );
registerField( QLatin1String("OCUser"), _ui.leUsername );
registerField( QLatin1String("OCPasswd"), _ui.lePassword);
registerField( QLatin1String("connectMyOC"), _ui.cbConnectOC );
registerField( QLatin1String("secureConnect"), _ui.cbSecureConnect );
registerField( QLatin1String("PwdNoLocalStore"), _ui.cbNoPasswordStore );
connect( _ui.lePassword, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
@ -156,7 +156,7 @@ bool OwncloudSetupPage::isComplete() const
void OwncloudSetupPage::initializePage()
{
QString user = qgetenv( "USER" );
QString user = QString::fromLocal8Bit(qgetenv( "USER" ));
_ui.leUsername->setText( user );
}
@ -170,9 +170,9 @@ int OwncloudSetupPage::nextId() const
OwncloudWizardSelectTypePage::OwncloudWizardSelectTypePage()
{
_ui.setupUi(this);
registerField( "connectMyOC", _ui.connectMyOCRadioBtn );
registerField( "createNewOC", _ui.createNewOCRadioBtn );
registerField( "OCUrl", _ui.OCUrlLineEdit );
registerField( QLatin1String("connectMyOC"), _ui.connectMyOCRadioBtn );
registerField( QLatin1String("createNewOC"), _ui.createNewOCRadioBtn );
registerField( QLatin1String("OCUrl"), _ui.OCUrlLineEdit );
connect( _ui.connectMyOCRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
connect( _ui.createNewOCRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
@ -230,9 +230,9 @@ void OwncloudWizardSelectTypePage::setOCUrl( const QString& url )
OwncloudCredentialsPage::OwncloudCredentialsPage()
{
_ui.setupUi(this);
registerField( "OCUser", _ui.OCUserEdit );
registerField( "OCPasswd", _ui.OCPasswdEdit );
registerField( "PwdNoLocalStore", _ui.cbPwdNoLocalStore );
registerField( QLatin1String("OCUser"), _ui.OCUserEdit );
registerField( QLatin1String("OCPasswd"), _ui.OCPasswdEdit );
registerField( QLatin1String("PwdNoLocalStore"), _ui.cbPwdNoLocalStore );
connect( _ui.OCPasswdEdit, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
@ -264,7 +264,7 @@ bool OwncloudCredentialsPage::isComplete() const
void OwncloudCredentialsPage::initializePage()
{
QString user = qgetenv( "USER" );
QString user = QString::fromLocal8Bit(qgetenv( "USER" ));
_ui.OCUserEdit->setText( user );
}
@ -279,10 +279,10 @@ int OwncloudCredentialsPage::nextId() const
OwncloudFTPAccessPage::OwncloudFTPAccessPage()
{
_ui.setupUi(this);
registerField( "ftpUrl", _ui.ftpUrlEdit );
registerField( "ftpUser", _ui.ftpUserEdit );
registerField( "ftpPasswd", _ui.ftpPasswdEdit );
// registerField( "ftpDir", _ui.ftpDir );
registerField( QLatin1String("ftpUrl"), _ui.ftpUrlEdit );
registerField( QLatin1String("ftpUser"), _ui.ftpUserEdit );
registerField( QLatin1String("ftpPasswd"), _ui.ftpPasswdEdit );
// registerField( QLatin1String("ftpDir"), _ui.ftpDir );
#if QT_VERSION >= 0x040700
_ui.ftpUrlEdit->setPlaceholderText(tr("ftp.mydomain.org"));
@ -320,9 +320,9 @@ bool OwncloudFTPAccessPage::isComplete() const
CreateAnOwncloudPage::CreateAnOwncloudPage()
{
_ui.setupUi(this);
registerField("createLocalOC", _ui.createLocalRadioBtn );
registerField("createOnDomain", _ui.createPerFTPRadioBtn );
registerField("myOCDomain", _ui.myDomainEdit );
registerField(QLatin1String("createLocalOC"), _ui.createLocalRadioBtn );
registerField(QLatin1String("createOnDomain"), _ui.createPerFTPRadioBtn );
registerField(QLatin1String("myOCDomain"), _ui.myDomainEdit );
connect( _ui.createLocalRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
connect( _ui.createPerFTPRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
@ -357,8 +357,8 @@ bool CreateAnOwncloudPage::isComplete() const
if( _ui.createPerFTPRadioBtn->isChecked() ) {
QString dom = _ui.myDomainEdit->text();
qDebug() << "check is Complete with " << dom;
return (!dom.isEmpty() && dom.contains( QChar('.'))
&& dom.lastIndexOf('.') < dom.length()-2 );
return (!dom.isEmpty() && dom.contains( QLatin1Char('.'))
&& dom.lastIndexOf(QLatin1Char('.')) < dom.length()-2 );
}
return true;
}
@ -423,7 +423,7 @@ void OwncloudWizardResultPage::showOCUrlLabel( const QString& url, bool show )
void OwncloudWizardResultPage::setupCustomization()
{
// set defaults for the customize labels.
_ui.topLabel->setText( QString() );
_ui.topLabel->setText( QString::null );
_ui.topLabel->hide();
MirallConfigFile cfg;
@ -454,7 +454,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
#ifdef Q_WS_MAC
setWizardStyle( QWizard::ModernStyle );
#endif
setField("connectMyOC", true);
setField(QLatin1String("connectMyOC"), true);
connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int)));
@ -488,21 +488,21 @@ void OwncloudWizard::slotCurrentPageChanged( int id )
domain = domain.right( domain.length()-8 );
}
QString host = "ftp." +domain;
QString host = QLatin1String("ftp.") +domain;
OwncloudFTPAccessPage *p1 = static_cast<OwncloudFTPAccessPage*> (page( Page_FTP ));
p1->setFTPUrl( host );
}
if( id == Page_Install ) {
appendToResultWidget( QString() );
appendToResultWidget( QString::null );
showOCUrlLabel( false );
if( field("connectMyOC").toBool() ) {
if( field(QLatin1String("connectMyOC")).toBool() ) {
// check the url and connect.
_oCUrl = ocUrl();
emit connectToOCUrl( _oCUrl);
} else if( field("createLocalOC").toBool() ) {
} else if( field(QLatin1String("createLocalOC")).toBool() ) {
qDebug() << "Connect to local!";
emit installOCLocalhost();
} else if( field("createNewOC").toBool() ) {
} else if( field(QLatin1String("createNewOC")).toBool() ) {
// call in installation mode and install to ftp site.
emit installOCServer();
} else {

View file

@ -71,11 +71,13 @@ void Mirall::ProxyDialog::saveSettings()
{
QString user = userLineEdit->text();
QString pass = passwordLineEdit->text();
cfgFile.setProxyType(QNetworkProxy::Socks5Proxy, hostLineEdit->text(), portSpinBox->value(), user, pass);
cfgFile.setProxyType(QNetworkProxy::Socks5Proxy, hostLineEdit->text(),
portSpinBox->value(), user, pass);
}
else
{
cfgFile.setProxyType(QNetworkProxy::Socks5Proxy, hostLineEdit->text(), portSpinBox->value(), QString(), QString());
cfgFile.setProxyType(QNetworkProxy::Socks5Proxy, hostLineEdit->text(),
portSpinBox->value(), QString::null, QString::null);
}
}

View file

@ -93,7 +93,7 @@ bool SslErrorDialog::setErrorList( QList<QSslError> errors )
// add the errors for this cert
foreach( QSslError err, errors ) {
if( err.certificate() == cert ) {
msg += "<p>" + err.errorString() + "</p>";
msg += QL("<p>") + err.errorString() + QL("</p>");
}
}
msg += QL("</div>");
@ -109,7 +109,7 @@ bool SslErrorDialog::setErrorList( QList<QSslError> errors )
QTextDocument *doc = new QTextDocument(0);
QString style = styleSheet();
qDebug() << "Style: " << style;
doc->addResource( QTextDocument::StyleSheetResource, QUrl( "format.css" ), style);
doc->addResource( QTextDocument::StyleSheetResource, QUrl( QL("format.css") ), style);
doc->setHtml( msg );
_tbErrors->setDocument( doc );
@ -129,7 +129,7 @@ QString SslErrorDialog::certDiv( QSslCertificate cert ) const
li << tr("Organization: %1").arg( cert.subjectInfo( QSslCertificate::Organization) );
li << tr("Unit: %1").arg( cert.subjectInfo( QSslCertificate::OrganizationalUnitName) );
li << tr("Country: %1").arg(cert.subjectInfo( QSslCertificate::CountryName));
msg += QL("<p>") + li.join("<br/>") + QL("</p>");
msg += QL("<p>") + li.join(QL("<br/>")) + QL("</p>");
msg += QL("<p>");
msg += tr("Effective Date: %1").arg( cert.effectiveDate().toString()) + QL("<br/>");
@ -138,12 +138,12 @@ QString SslErrorDialog::certDiv( QSslCertificate cert ) const
msg += QL("</div>" );
msg += QL("<h3>") + tr("Issuer: %1").arg( cert.issuerInfo( QSslCertificate::CommonName )) + QL("</h3>");
msg += "<div id=\"issuer\">";
msg += QL("<div id=\"issuer\">");
li.clear();
li << tr("Organization: %1").arg( cert.issuerInfo( QSslCertificate::Organization) );
li << tr("Unit: %1").arg( cert.issuerInfo( QSslCertificate::OrganizationalUnitName) );
li << tr("Country: %1").arg(cert.issuerInfo( QSslCertificate::CountryName));
msg += QL("<p>") + li.join("<br/>") + QL("</p>");
msg += QL("<p>") + li.join(QL("<br/>")) + QL("</p>");
msg += QL("</div>" );
msg += QL("</div>" );

View file

@ -298,7 +298,7 @@ void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
SyncResult res = f->syncResult();
SyncResult::Status status = res.status();
QString errors = res.errorStrings().join("<br/>");
QString errors = res.errorStrings().join(QLatin1String("<br/>"));
item->setData( _theme->statusHeaderText( status ), Qt::ToolTipRole );
if( f->syncEnabled() ) {

View file

@ -84,7 +84,7 @@ void SyncResult::setErrorString( const QString& err )
QString SyncResult::errorString() const
{
if( _errors.isEmpty() ) return QString();
if( _errors.isEmpty() ) return QString::null;
return _errors.first();
}

View file

@ -78,7 +78,7 @@ QIcon Theme::themeIcon( const QString& name ) const
QList<int> sizes;
sizes <<16 << 24 << 32 << 48 << 64 << 128;
foreach (int size, sizes) {
QString pixmapName = QString(":/mirall/resources/%1-%2.png").arg(name).arg(size);
QString pixmapName = QString::fromLatin1(":/mirall/resources/%1-%2.png").arg(name).arg(size);
if (QFile::exists(pixmapName)) {
icon.addFile(pixmapName, QSize(size, size));
}

View file

@ -64,12 +64,12 @@ void UnisonFolder::startSync(const QStringList &pathList)
emit syncStarted();
QString program = "unison";
QString program = QLatin1String("unison");
QStringList args;
args << "-ui" << "text";
args << "-auto" << "-batch";
args << QLatin1String("-ui") << QLatin1String("text");
args << QLatin1String("-auto") << QLatin1String("-batch");
args << "-confirmbigdel=false";
args << QLatin1String("-confirmbigdel=false");
// only use -path in after a full synchronization
// already happened, which we do only on the first
@ -78,7 +78,7 @@ void UnisonFolder::startSync(const QStringList &pathList)
// may be we should use a QDir in the API itself?
QDir root(path());
foreach( const QString& changedPath, pathList) {
args << "-path" << root.relativeFilePath(changedPath);
args << QLatin1String("-path") << root.relativeFilePath(changedPath);
}
}

View file

@ -35,8 +35,8 @@ void UpdateDetector::versionCheck( Theme *theme )
_accessManager = new QNetworkAccessManager(this);
connect(_accessManager, SIGNAL(finished(QNetworkReply*)), this,
SLOT(slotVersionInfoArrived(QNetworkReply*)) );
QUrl url("http://download.owncloud.com/clientupdater.php");
QString ver = QString("%1.%2.%3").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QUrl url(QLatin1String("http://download.owncloud.com/clientupdater.php"));
QString ver = QString::fromLatin1("%1.%2.%3").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QString platform = QLatin1String("stranger");
#ifdef Q_OS_LINUX
@ -52,10 +52,10 @@ void UpdateDetector::versionCheck( Theme *theme )
QString sysInfo = getSystemInfo();
if( !sysInfo.isEmpty() ) {
url.addQueryItem("client", sysInfo );
url.addQueryItem(QLatin1String("client"), sysInfo );
}
url.addQueryItem( "version", ver );
url.addQueryItem( "platform", platform );
url.addQueryItem( QLatin1String("version"), ver );
url.addQueryItem( QLatin1String("platform"), platform );
_accessManager->get( QNetworkRequest( url ));
}
@ -64,7 +64,7 @@ QString UpdateDetector::getSystemInfo()
{
#ifdef Q_OS_LINUX
QProcess process;
process.start( "lsb_release -a" );
process.start( QLatin1String("lsb_release -a") );
process.waitForFinished();
QByteArray output = process.readAllStandardOutput();
qDebug() << "Sys Info size: " << output.length();
@ -72,7 +72,7 @@ QString UpdateDetector::getSystemInfo()
return QString::fromLocal8Bit( output.toBase64() );
#else
return QString();
return QString::null;
#endif
}
@ -108,7 +108,8 @@ void UpdateDetector::slotVersionInfoArrived( QNetworkReply* reply )
qDebug() << "Client is on latest version!";
} else {
// if the version tag is set, there is a newer version.
QString ver = QString("%1.%2.%3").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QString ver = QString::fromLatin1("%1.%2.%3")
.arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QMessageBox msgBox;
msgBox.setTextFormat( Qt::RichText );
msgBox.setWindowTitle(tr("Client Version Check"));