Mac Overlays: handle filenames with slashes properly.

There are filenames with slashes on MacOSX, they can be created
in Finder. Internally they are converted to colons.
This commit is contained in:
Klaas Freitag 2014-09-25 12:23:17 +02:00
parent 31bf844452
commit 8915f94931
3 changed files with 20 additions and 2 deletions

View File

@ -139,7 +139,14 @@ static RequestManager* sharedInstance = nil;
if( [chunks count] > 0 && tag == READ_TAG ) {
if( [[chunks objectAtIndex:0] isEqualToString:@"STATUS"] ) {
[contentman setResultForPath:[chunks objectAtIndex:2] result:[chunks objectAtIndex:1]];
NSString *path = [chunks objectAtIndex:2];
if( [chunks count] > 3 ) {
for( int i = 2; i < [chunks count]-1; i++ ) {
path = [NSString stringWithFormat:@"%@:%@",
path, [chunks objectAtIndex:i+1] ];
}
}
[contentman setResultForPath:path result:[chunks objectAtIndex:1]];
} else if( [[chunks objectAtIndex:0] isEqualToString:@"UPDATE_VIEW"] ) {
NSString *path = [chunks objectAtIndex:1];
[contentman reFetchFileNameCacheForPath:path];

View File

@ -183,6 +183,15 @@ void ProtocolWidget::slotOpenFile( QTreeWidgetItem *item, int )
}
}
QString ProtocolWidget::fixupFilename( const QString& name )
{
if( Utility::isMac() ) {
QString n(name);
return n.replace(QChar(':'), QChar('/'));
}
return name;
}
QTreeWidgetItem* ProtocolWidget::createCompletedTreewidgetItem(const QString& folder, const SyncFileItem& item)
{
QStringList columns;
@ -193,7 +202,7 @@ QTreeWidgetItem* ProtocolWidget::createCompletedTreewidgetItem(const QString& fo
QString message;
columns << timeStr;
columns << item._file;
columns << fixupFilename(item._file);
columns << folder;
if (Progress::isWarningKind(item._status)) {
message= item._errorString;

View File

@ -56,6 +56,8 @@ private:
void setSyncResultStatus(const SyncResult& result );
void cleanIgnoreItems( const QString& folder );
void computeResyncButtonEnabled();
QString fixupFilename( const QString& name );
QTreeWidgetItem* createCompletedTreewidgetItem(const QString &folder, const SyncFileItem &item );