Commit 4096a6f3 authored by armin's avatar armin
Browse files

Merge branch 'winDesktopSupport' into 'master'

fixed bottlenck in fileobject creation

See merge request !114
parents 926c1cac 344e9908
......@@ -1059,9 +1059,6 @@ QList<QHash<QString, QString>> PersistanceLayer::getFiles()
{
QList<QHash<QString, QString> > returnList;
QSqlQuery queryGetFileCacheEntry;
queryGetFileCacheEntry.prepare( QStringLiteral( "SELECT path FROM file_cache WHERE url=:url" ) );
QSqlQuery getFilesQuery;
getFilesQuery.prepare( "SELECT path,url FROM file_cache " );
......
......@@ -27,7 +27,6 @@ Emoji::Emoji( QString name, QString extension, QString category ): mCategory( st
mName = std::move( name );
this->mIdentifier = ':' + mName + ':';
mExtension = std::move( extension );
this->mType = QStringLiteral( "emoji" );
}
Emoji::Emoji( QString name, QString category, QString filePath, QString html ): mCategory( std::move( category ) )
......
......@@ -30,9 +30,6 @@ TempFile::TempFile( const QString &path, const QString &url )
QFileInfo fileInfo( path );
mFileInfo = fileInfo;
mFileName = fileInfo.fileName();
QMimeDatabase dataBase;
QMimeType type = dataBase.mimeTypeForFile( fileInfo );
mType = type.name();
}
const QFileInfo &TempFile::getFileInfo() const
......
......@@ -53,7 +53,6 @@ class TempFile
QUrl mUrl;
QString mFileName;
QString mFilePath;
QString mType;
QFileInfo mFileInfo;
};
......
......@@ -566,6 +566,8 @@ void RocketChatServerData::onUsersLoaded( const QString &pChannelId, const QVect
void RocketChatServerData::onUnreadCountChanged()
{
static int lastUnreadCount = -1;
uint number = 0;
qDebug() << "on Unread count changed";
......@@ -574,8 +576,12 @@ void RocketChatServerData::onUnreadCountChanged()
number += channel->getUnreadMessages();
}
}
if ( lastUnreadCount != number ) {
lastUnreadCount = number;
emit unreadCountChanged( QStringLiteral( "default" ), number );
}
emit unreadCountChanged( QStringLiteral( "default" ), number );
}
bool RocketChatServerData::handlesMessage( const QJsonObject &message )
......
......@@ -52,6 +52,7 @@ FileService::FileService( RocketChatServerData *server )
}
mServer = server;
getFilesFromDb();
}
}
......@@ -165,6 +166,10 @@ QSharedPointer<TempFile> FileService::getFileFromCache( const QSharedPointer< Fi
QString fullUrl = baseUrl + pRequest->url ;
qDebug() << "file from cache requested" << fullUrl;
if(fullUrl.contains("ras")){
qDebug()<<"ras found";
}
if ( repo->contains( fullUrl ) ) {
auto storageEntry = repo->get( fullUrl );
......@@ -174,11 +179,16 @@ QSharedPointer<TempFile> FileService::getFileFromCache( const QSharedPointer< Fi
return QSharedPointer<TempFile>( nullptr );
}
QFile cacheHit( storageEntry->getFilePath() );
if ( cacheHit.exists() ) {
if (storageEntry->getFileChecked() ) {
return storageEntry;
}
}else{
QFile cacheHit( storageEntry->getFilePath() );
if(cacheHit.exists()){
storageEntry->setFileChecked(true);
return storageEntry;
}
}
mStorage->removeFileCacheEntry( pRequest->url, storageEntry->getFilePath() );
repo->remove( fullUrl );
......
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