def __init__(self, frame, locationBar, dirView, logEdit, siteButton): QObject.__init__(self) self.frame = frame self.dirView = dirView self.locationBar = locationBar self.logEdit = logEdit self.siteButton = siteButton self.settingsWidget = SettingsWidget(self.frame) self.settingsWidget.setVisible(False) self.progressWidget = ProgressWidget(self.frame) self.progressWidget.setVisible(False) self.dirModel = DirModel() self.dirView.setModel(self.dirModel) # enable sorting self.connect(self.dirView.header(), SIGNAL("sectionClicked(int)"), self.dirView.sortByColumn) # set filename & ascending to default self.dirView.header().setSortIndicator(DirModel.FILENAME, Qt.AscendingOrder) self.connect(self.locationBar, SIGNAL("returnPressed()"), self.slotReturnPressed) self.connect(self.dirView, SIGNAL("doubleClicked(const QModelIndex&)"), self.slotDoubleClicked) self.connect(self.siteButton, SIGNAL("clicked()"), self.slotSiteClicked) self.connect(self.locationBar.configureButton, SIGNAL("clicked()"), self.slotConfigureButtonClicked) # connect drop signal self.connect(self.dirView, SIGNAL("drop(QByteArray*)"), self.slotDrop) # default to home directory kurl = KUrl() kurl.setProtocol("file"); kurl.setPath(QDir.homePath()); self.attemptKurl = kurl; self.listDir(self.attemptKurl);
def slotReturnPressed(self): kurl = KUrl() if (self.locationBar.getUrlString() != None): kurl.setProtocol("ftps") kurl.setHost(self.locationBar.getUrlString()) else: kurl.setProtocol("file") kurl.setUser(self.settingsWidget.userEdit.text()) kurl.setPass(self.settingsWidget.passEdit.text()) kurl.setPort(int(self.settingsWidget.portEdit.text())) kurl.addPath(self.locationBar.getPathString()) kurl.cleanPath() self.attemptKurl = kurl # print self.attemptKurl self.listDir(self.attemptKurl)