~ubuntu-branches/ubuntu/oneiric/ubuntuone-control-panel/oneiric

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/addfolder.py

* New upstream release:
  [ Alejandro J. Cura <alecu@canonical.com>]
    - Do not throw a webclient error when closing
      (LP: #845105).
  [ Natalia B. Bidart <natalia.bidart@canonical.com> ]
    - Removed all code related to Bookmarks (LP: #850142).
    - Replaces references to "Evolution" by "Thunderbird" (LP: #849494).
  [ Rodney Dawes <rodney.dawes@canonical.com> ]
    - Don't install a .desktop file for control panel
      (part of LP: #838778).
    - Point the indicator/Unity API at the installer .desktop file
      (part of LP: #838778).
    - Set the WMCLASS so Unity will fall back properly
      (part of LP: #838778).
    - Fix a few grammar mistakes (LP: #835093).
    - Don't show the "Get NGB free!" label on "Join now" button at all
      (LP: #819955).
* debian/control:
  - ubuntuone-control-panel-gtk depends now on ubuntuone-installer >= 2.0.0.
  - require ubuntuone-client >= 2.0.0.
  - require ubuntu-sso-client >= 1.4.0.
  - no longer install a .desktop file (will be installed by ubuntuone-installer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from PyQt4 import QtGui, QtCore
26
26
from twisted.internet import defer
27
27
 
28
 
from ubuntuone.controlpanel import backend
 
28
from ubuntuone.controlpanel import cache
29
29
from ubuntuone.controlpanel.logger import setup_logging
30
 
from ubuntuone.controlpanel.gui import (
31
 
    FOLDER_INVALID_PATH,
32
 
)
 
30
from ubuntuone.controlpanel.gui import FOLDER_INVALID_PATH
 
31
from ubuntuone.controlpanel.gui.qt import handle_errors
33
32
 
34
33
 
35
34
logger = setup_logging('qt.addfolder')
37
36
CLOSE = QtGui.QMessageBox.Close
38
37
 
39
38
 
40
 
class AddFolderButton(QtGui.QPushButton):
 
39
class AddFolderButton(cache.Cache, QtGui.QPushButton):
41
40
    """The AddFolderButton widget"""
42
41
 
 
42
    logger = logger
 
43
 
43
44
    folderCreated = QtCore.pyqtSignal(unicode)
44
45
    folderCreationCanceled = QtCore.pyqtSignal()
45
46
 
47
48
        """Initialize the UI of the widget."""
48
49
        super(AddFolderButton, self).__init__(*args, **kwargs)
49
50
        self.cloud_folders = []
50
 
        self.backend = backend.ControlBackend()
51
51
        self.clicked.connect(self.on_clicked)
52
 
        logger.debug('%s: started.', self.__class__.__name__)
53
52
 
54
53
    @QtCore.pyqtSlot()
 
54
    @handle_errors(logger=logger)
55
55
    @defer.inlineCallbacks
56
56
    def on_clicked(self):
57
57
        """The 'Sync another folder' button was clicked."""
58
 
        folder = QtGui.QFileDialog.getExistingDirectory(parent=self)
59
 
        folder = unicode(folder)
 
58
        # The options argument is because of LP: #835013
 
59
        folder = QtGui.QFileDialog.getExistingDirectory(
 
60
            parent=self, options=QtGui.QFileDialog.DontUseNativeDialog)
 
61
        folder = unicode(QtCore.QDir.toNativeSeparators(folder))
60
62
        logger.debug('on_add_folder_button_clicked: user requested folder '
61
63
                     'creation for path %r', folder)
62
64
        if folder == '':