Revision fe62b7f4

b/trunk/Pithos.Client.WPF/PithosAccount.cs
87 87
            //TODO:Force logout here to take care of existing cookies
88 88

  
89 89

  
90
            var listenerUrl = String.Format("http://127.0.0.1:{0}/", port);
90
            var listenerUrl = String.Format("http://127.0.0.1:{0}", port);
91 91

  
92 92
            
93 93

  
......
97 97
            var logoutProcess=Process.Start(logoutUrl);            
98 98
            TaskEx.Delay(2000).Wait();
99 99
            var uriBuilder=new UriBuilder(loginUrl);                       
100
            uriBuilder.Query="next=" + listenerUrl;
100
            uriBuilder.Query=String.Format("next={0}&force=", listenerUrl);
101 101

  
102 102
            var retrieveUri = uriBuilder.Uri;
103 103
            Log.InfoFormat("[RETRIEVE] Open Browser at {0}", retrieveUri);
b/trunk/Pithos.Client.WPF/Preferences/AddAccountView.xaml
14 14
                                   Title="Add new Pithos Account"
15 15
                                   Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token" 
16 16
                               BackButtonVisibility="Collapsed"
17
                               FinishButtonVisibility="Collapsed"/>
17
                               FinishButtonVisibility="Collapsed"
18
                               />
18 19
        <extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
19 20
                                   Title="Where do you want to connect?"
20 21
                                   Description="You can connect to the production or development server, or enter your own server URL"                               
21 22
                               FinishButtonVisibility="Collapsed"
22 23
                                    CanSelectNextPage="{Binding IsValidServer}"
24
                               
23 25
                                    >
24 26
            <StackPanel >
25 27
                <Label Content="Pithos Server" Target="{Binding ElementName=Servers}"  />
......
40 42
                                   Title="How do you want to add the account?"
41 43
                                   Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"                               
42 44
                               FinishButtonVisibility="Collapsed"
43
                                    CanSelectNextPage="False">
45
                                    CanSelectNextPage="False"
46
                               >
44 47
            <StackPanel >
45 48
                <RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
46 49
                <RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
......
53 56
                               FinishButtonVisibility="Collapsed"
54 57
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}" 
55 58
                               TargetUpdated="OnTargetUpdated"
59
                               
56 60
                               >
57 61
            <extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
58 62
                <extToolkit:BusyIndicator.BusyContent>
......
86 90
                               FinishButtonVisibility="Collapsed"
87 91
                               CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"                               
88 92
                               TargetUpdated="OnTargetUpdated"
93
                               
89 94
                               >
90 95
            <extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
91 96
                <extToolkit:BusyIndicator.BusyContent>
......
115 120
            <StackPanel>
116 121
                <Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
117 122
                <Grid HorizontalAlignment="Stretch">
123
                    <Grid.RowDefinitions>
124
                        <RowDefinition Height="Auto"/>
125
                        <RowDefinition/>
126
                    </Grid.RowDefinitions>
118 127
                    <Grid.ColumnDefinitions>
119 128
                        <ColumnDefinition />
120 129
                        <ColumnDefinition Width="Auto" />
121 130
                    </Grid.ColumnDefinitions>
122
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" >
131
                    <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
123 132
                        <TextBox.Text>
124 133
                            <Binding Path="AccountPath" Mode="TwoWay">
125 134
                                <Binding.ValidationRules>
......
136 145
                            </ControlTemplate>
137 146
                        </Validation.ErrorTemplate>
138 147
                    </TextBox>
139
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/>
148
                    <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"/>
149
                    <CheckBox x:Name="ShouldCreateOkeanosFolder"  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
150
                        <CheckBox.Content>
151
                            <TextBlock TextWrapping="Wrap">
152
                               Create an Okeanos folder below the selected folder
153
                                <LineBreak/>
154
                               Clear this setting to use the currently selected folder and synchronize its contents
155
                            </TextBlock>
156
                        </CheckBox.Content>
157
                    </CheckBox>
140 158
                </Grid>
141 159
            </StackPanel>
142 160
        </extToolkit:WizardPage>
143 161
        <extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
144 162
                                   Title="Finish"
145 163
                                   Description="Press finish to create the account"
146
                                   CanFinish="True">
164
                                   CanFinish="True"
165
                               >
147 166
            <Grid>
148 167
                <Grid.RowDefinitions>
149 168
                    <RowDefinition Height="Auto"/>
b/trunk/Pithos.Client.WPF/Preferences/AddAccountViewModel.cs
42 42
using System;
43 43
using System.Collections.Generic;
44 44
using System.ComponentModel.Composition;
45
using System.IO;
46
using System.Linq;
45 47
using System.Threading.Tasks;
46 48
using System.Windows;
47 49
using System.Windows.Forms;
......
168 170
            }
169 171
        }
170 172

  
173

  
174
        private bool _shouldCreateOkeanosFolder;
175
        public bool ShouldCreateOkeanosFolder
176
        {
177
            get { return _shouldCreateOkeanosFolder; }
178
            set
179
            {
180
                _shouldCreateOkeanosFolder = value;
181
                NotifyOfPropertyChange(()=>ShouldCreateOkeanosFolder);
182
            }
183
        }
184

  
171 185
        public void SelectAccount()
172 186
        {
173 187
            using (var dlg = new FolderBrowserDialog{Description=Resources.AddAccountViewModel_SelectAccount_Please_select_a_folder})
......
179 193
                    return;
180 194

  
181 195
                AccountPath= dlg.SelectedPath;
196

  
197
                ShouldCreateOkeanosFolder=Directory.EnumerateFileSystemEntries(AccountPath).Any();                
182 198
            }
183 199
        }
184 200

  
b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
302 302
            foreach (var account in _accountsToRemove)
303 303
            {
304 304
                Shell.RemoveMonitor(account.AccountName);
305
                Shell.RemoveAccountFromDatabase(account);
305 306
            }
306 307

  
307 308
            foreach (var account in Settings.Accounts)
......
345 346
           if (_windowManager.ShowDialog(wizard) == true)
346 347
           {
347 348
               string selectedPath = wizard.AccountPath;
348
               var initialRootPath = Path.Combine(selectedPath, "Okeanos");
349
               var initialRootPath = wizard.ShouldCreateOkeanosFolder?
350
                   Path.Combine(selectedPath, "Okeanos")
351
                   :selectedPath;
349 352
               var actualRootPath= initialRootPath;
350
               int attempt = 1;
351
               while (Directory.Exists(actualRootPath) || File.Exists(actualRootPath))
353
               if (wizard.ShouldCreateOkeanosFolder)
352 354
               {
353
                   actualRootPath = String.Format("{0} {1}", initialRootPath,attempt++);
355
                   int attempt = 1;
356
                   while (Directory.Exists(actualRootPath) || File.Exists(actualRootPath))
357
                   {
358
                       actualRootPath = String.Format("{0} {1}", initialRootPath, attempt++);
359
                   }
354 360
               }
355 361

  
356 362
               var newAccount = new AccountSettings
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
989 989
			var status=statusKeeper.GetFileStatus(localFileName);
990 990
			return status;
991 991
		}
992

  
993
	    public void RemoveAccountFromDatabase(AccountSettings account)
994
	    {
995
            var statusKeeper = IoC.Get<IStatusKeeper>();
996
            statusKeeper.ClearFolderStatus(account.RootPath);	        
997
	    }
992 998
	}
993 999
}
b/trunk/Pithos.Core/Agents/StatusAgent.cs
803 803
                    
804 804
                    using (var connection = GetConnection())
805 805
                    {
806
                        var command = new SQLiteCommand("delete from FileState where FilePath = :path or FilePath like :path + '/%'  COLLATE NOCASE",
806
                        var command = new SQLiteCommand(@"delete from FileState where FilePath = :path or FilePath like :path || '\%'  COLLATE NOCASE",
807 807
                                                        connection);
808 808

  
809 809
                        command.Parameters.AddWithValue("path", filePath);

Also available in: Unified diff