]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Do not abort/exit when accessing the string out of bounds
[dolphin.git] / src / dolphinmainwindow.cpp
index 8706316d835a2963a3afbd6d2d93de48e32294d5..4fa3cef31a7df1dafab91b20d163e4a28cbfcb13 100644 (file)
@@ -86,17 +86,20 @@ DolphinMainWindow::DolphinMainWindow() :
     m_view[PrimaryIdx] = 0;
     m_view[SecondaryIdx] = 0;
 
-    m_fileGroupActions.setAutoDelete(true);
-
     // TODO: the following members are not used yet. See documentation
     // of DolphinMainWindow::linkGroupActions() and DolphinMainWindow::linkToDeviceActions()
     // in the header file for details.
-    //m_linkGroupActions.setAutoDelete(true);
-    //m_linkToDeviceActions.setAutoDelete(true);
 }
 
 DolphinMainWindow::~DolphinMainWindow()
 {
+    qDeleteAll(m_fileGroupActions);
+    //qDeleteAll(m_linkToDeviceActions);
+    //qDeleteAll(m_linkGroupActions);
+    m_fileGroupActions.clear();
+    //m_linkGroupActions.clear();
+    //m_linkToDeviceActions.clear();
+
     /*
      * bye, bye managed window
      */
@@ -356,14 +359,14 @@ void DolphinMainWindow::readProperties(KConfig* config)
 {
     config->setGroup("Primary view");
     m_view[PrimaryIdx]->setUrl(config->readEntry("Url"));
-    m_view[PrimaryIdx]->setUrlEditable(config->readBoolEntry("Editable Url"));
+    m_view[PrimaryIdx]->setUrlEditable(config->readEntry("Editable Url", false));
     if (config->hasGroup("Secondary view")) {
         config->setGroup("Secondary view");
         if (m_view[SecondaryIdx] == 0) {
             toggleSplitView();
         }
         m_view[SecondaryIdx]->setUrl(config->readEntry("Url"));
-        m_view[SecondaryIdx]->setUrlEditable(config->readBoolEntry("Editable Url"));
+        m_view[SecondaryIdx]->setUrlEditable(config->readEntry("Editable Url", false));
     }
     else if (m_view[SecondaryIdx] != 0) {
         toggleSplitView();
@@ -458,7 +461,7 @@ void DolphinMainWindow::createFile()
     bool found = false;
     CreateFileEntry entry;
     while (!found && (it != end)) {
-        if ((*it).index() == senderName) {
+        if ((*it).key() == senderName) {
             entry = (*it).value();
             found = true;
         }
@@ -475,7 +478,7 @@ void DolphinMainWindow::createFile()
 
     // Get the source path of the template which should be copied.
     // The source path is part of the Url entry of the desktop file.
-    const int pos = entry.templatePath.findRev('/');
+    const int pos = entry.templatePath.lastIndexOf('/');
     QString sourcePath(entry.templatePath.left(pos + 1));
     sourcePath += KDesktopFile(entry.templatePath, true).readPathEntry("Url");
 
@@ -485,7 +488,7 @@ void DolphinMainWindow::createFile()
     name.replace("...", QString::null);
 
     // add the file extension to the name
-    name.append(sourcePath.right(sourcePath.length() - sourcePath.findRev('.')));
+    name.append(sourcePath.right(sourcePath.length() - sourcePath.lastIndexOf('.')));
 
     // Check whether a file with the current name already exists. If yes suggest automatically
     // a unique file name (e. g. "HTML File" will be replaced by "HTML File_1").
@@ -720,7 +723,7 @@ void DolphinMainWindow::updatePasteAction()
 
     QString text(i18n("Paste"));
     QClipboard* clipboard = QApplication::clipboard();
-    QMimeSource* data = clipboard->data();
+    const QMimeData* data = clipboard->mimeData();
     /* KDE4-TODO:
     if (KUrlDrag::canDecode(data)) {
         pasteAction->setEnabled(true);
@@ -1056,7 +1059,7 @@ void DolphinMainWindow::addUndoOperation(KJob* job)
                 while (sourceIt != sourceEnd) {
                     QMap<QString, QString>::ConstIterator metaIt = metaData.find("trashUrl-" + (*sourceIt).path());
                     if (metaIt != metaData.end()) {
-                        newSourceUrls.append(KUrl(metaIt.data()));
+                        newSourceUrls.append(KUrl(metaIt.value()));
                     }
                     ++sourceIt;
                 }