Skip to content

Commit

Permalink
Fix Error if new collection's directory doesn't exist
Browse files Browse the repository at this point in the history
- When the user entered the new collection's folder manually, the path wasn't checked and created if necessary.
- Now the path will be created on first use.

Fix When changing collections the displayed blog's collection combo box lost its display value
- When the settings dialog was closed after a collection has been added/deleted, the displayed blog's collection combo box lost its display value and a red border was shown.
  • Loading branch information
thomas694 committed Jul 14, 2022
1 parent f87c01c commit 0e6766f
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Linq;
using System.Reflection;
using System.Waf.Applications.Services;
using System.Windows;
using TumblThree.Applications.Properties;
using TumblThree.Applications.Services;
using TumblThree.Applications.ViewModels;
Expand Down Expand Up @@ -153,6 +152,8 @@ public bool ChangeCollection(IBlog blog, Collection oldItem, Collection newItem)
var newFilenameIndex = Path.Combine(newRootFolder, blog.Name) + "." + blog.OriginalBlogType;
var newFilenameChild = Path.Combine(newRootFolder, Path.GetFileName(oldFilenameChild));

Directory.CreateDirectory(newRootFolder);

if (File.Exists(newFilenameIndex) || File.Exists(newFilenameChild))
{
_messageService.ShowWarning(Resources.CannotChangeCollectionDestFileExists);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ public void UpdateCollectionsList(bool isInit)
_collections.Add(item);
}

var ecv = (IEditableCollectionView)Collections;
if (ecv.IsAddingNew) ecv.CancelNew();
Collections.Refresh();
//var ecv = (IEditableCollectionView)Collections;
//if (ecv.IsAddingNew) ecv.CancelNew();
//Collections.Refresh();
Collection current = _collections.FirstOrDefault(x => x.Id == _shellService.Settings.ActiveCollectionId) ?? _collections.FirstOrDefault(x => x.Id == 0);
Collections.MoveCurrentTo(current);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTumblrBlogViewModel([Import("TumblrBlogView", typeof(IDetailsView)
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTumblrHiddenBlogViewModel([Import("TumblrHiddenBlogView", typeof(I
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTumblrLikedByViewModel([Import("TumblrLikedByView", typeof(IDetail
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTumblrSearchViewModel([Import("TumblrSearchView", typeof(IDetailsV
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTumblrTagSearchViewModel([Import("TumblrTagSearchView", typeof(IDe
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public DetailsTwitterBlogViewModel([Import("TwitterBlogView", typeof(IDetailsVie
_copyUrlCommand = new DelegateCommand(CopyUrlToClipboard);
_browseFileDownloadLocationCommand = new DelegateCommand(BrowseFileDownloadLocation);
Collections = CollectionViewSource.GetDefaultView(crawlerService.Collections);
crawlerService.Collections.CollectionChanged += CrawlerService_Collections_CollectionChanged;
}

private void CrawlerService_Collections_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
RaisePropertyChanged(nameof(CollectionId));
}

public ICommand CopyUrlCommand => _copyUrlCommand;
Expand Down

0 comments on commit 0e6766f

Please sign in to comment.