Changeset 2940
- Timestamp:
- 10/28/08 08:25:53 (17 months ago)
- Location:
- pcbsd
- Files:
-
- 2 added
- 12 modified
-
branches/7.0/SystemUpdater/SystemUpdater.cpp (modified) (4 diffs)
-
branches/7.0/SystemUpdater/SystemUpdater.h (modified) (4 diffs)
-
branches/7.0/SystemUpdater/SystemUpdater.qrc (modified) (1 diff)
-
branches/7.0/SystemUpdater/SystemUpdater.ui (modified) (12 diffs)
-
branches/7.0/SystemUpdater/UpdaterTray.cpp (modified) (46 diffs)
-
branches/7.0/SystemUpdater/UpdaterTray.h (modified) (2 diffs)
-
branches/7.0/SystemUpdater/folder.png (added)
-
trunk/SystemUpdater/SystemUpdater.cpp (modified) (4 diffs)
-
trunk/SystemUpdater/SystemUpdater.h (modified) (4 diffs)
-
trunk/SystemUpdater/SystemUpdater.qrc (modified) (1 diff)
-
trunk/SystemUpdater/SystemUpdater.ui (modified) (12 diffs)
-
trunk/SystemUpdater/UpdaterTray.cpp (modified) (46 diffs)
-
trunk/SystemUpdater/UpdaterTray.h (modified) (2 diffs)
-
trunk/SystemUpdater/folder.png (added)
Legend:
- Unmodified
- Added
- Removed
-
pcbsd/branches/7.0/SystemUpdater/SystemUpdater.cpp
r2780 r2940 24 24 listViewSysUpdates->hideColumn( 1 ); 25 25 26 disableConfUpdates = false; 27 26 28 27 29 … … 36 38 connect( listViewSysUpdates, SIGNAL(doubleClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysDoubleClicked( Q3ListViewItem *, const QPoint &, int) ) ); 37 39 // Connect to a right-clicked slot as well 38 connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) ); 39 40 connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) ); 41 42 // Connect the pushViewDetails button 43 connect( pushDetails, SIGNAL( clicked() ), this, SLOT( slotViewDetailsClicked() ) ); 44 45 // Connect the Custom Tmpdir Checkbox 46 connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) ); 47 connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) ); 48 connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) ); 49 connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) ); 50 51 // Connect slots to emit signal when settings change 52 connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 53 connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 54 connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 55 56 } 57 58 59 void systemUpdater::slotViewDetailsClicked() 60 { 61 if ( listViewSysUpdates->currentItem() != 0 ) 62 { 63 bool ok; 64 int idnum = listViewSysUpdates->currentItem()->text(1).toInt(&ok); 65 emit signalOpenSysDetails(idnum); 66 } 40 67 } 41 68 … … 94 121 void systemUpdater::slotConfigChanged() 95 122 { 96 emit signalConfigChanged(); 123 if (! disableConfUpdates ) 124 { 125 emit signalConfigChanged(); 126 } 97 127 } 98 128 … … 405 435 emit signalCheckPBIUpdatesClicked(); 406 436 } 437 438 // Set if we are using a custom TmpDir 439 void systemUpdater::setUseCustomTmp( bool enabled ) 440 { 441 checkTMPDIR->setChecked(enabled); 442 lineTMPDIR->setEnabled(enabled); 443 pushTMPDIR->setEnabled(enabled); 444 } 445 446 // Set the custom Tmpdir being used 447 void systemUpdater::setUseCustomDirName( QString tmpdir ) 448 { 449 lineTMPDIR->setText(tmpdir); 450 } 451 452 // Set Proxy Usage 453 void systemUpdater::setUseProxy( bool enabled ) 454 { 455 checkProxy->setChecked(enabled); 456 groupProxySettings->setEnabled(enabled); 457 } 458 459 // Set the Proxy being used 460 void systemUpdater::setUseProxySettings( QString proxyURL, int portnum ) 461 { 462 lineProxyServer->setText(proxyURL); 463 spinProxyPort->setValue(portnum); 464 } 465 466 467 bool systemUpdater::getCustomTmpEnabled() 468 { 469 return checkTMPDIR->isChecked(); 470 } 471 472 473 QString systemUpdater::getCustomTmpDir() 474 { 475 return lineTMPDIR->text(); 476 } 477 478 bool systemUpdater::getProxyEnabled() 479 { 480 return checkProxy->isChecked(); 481 } 482 483 484 QString systemUpdater::getProxyUrl() 485 { 486 return lineProxyServer->text(); 487 } 488 489 int systemUpdater::getProxyPort() 490 { 491 return spinProxyPort->value(); 492 } 493 494 495 void systemUpdater::slotCustomTmpClicked() 496 { 497 if ( checkTMPDIR->isChecked() ) 498 { 499 lineTMPDIR->setEnabled(true); 500 pushTMPDIR->setEnabled(true); 501 } else { 502 lineTMPDIR->setEnabled(false); 503 pushTMPDIR->setEnabled(false); 504 } 505 506 slotConfigChanged(); 507 } 508 509 void systemUpdater::slotProxyClicked() 510 { 511 if ( checkProxy->isChecked() ) 512 { 513 groupProxySettings->setEnabled(true); 514 } else { 515 groupProxySettings->setEnabled(false); 516 } 517 518 slotConfigChanged(); 519 } 520 521 void systemUpdater::slotSelectCustomTmp() 522 { 523 524 QString newDir = QFileDialog::getExistingDirectory( 525 "/", 526 this, 527 tr("Select Temp directory"), 528 tr("Select Temp directory"), 529 TRUE ); 530 531 // Check if the user just hit cancel 532 if ( newDir.isEmpty() ) 533 { 534 return; 535 } 536 537 lineTMPDIR->setText(newDir); 538 539 } 540 541 void systemUpdater::slotDisableConfUpdates(bool status) 542 { 543 // Set if we need to ignore updating the conf file, because a conf load is taking place 544 disableConfUpdates = status; 545 } 546 547 548 // Launches the kcmshell4 proxy command to allow the user to modify proxy settings 549 void systemUpdater::slotConfigKDEProxy() 550 { 551 emit signalLaunchKDEProxy(); 552 } -
pcbsd/branches/7.0/SystemUpdater/SystemUpdater.h
r2780 r2940 30 30 public slots: 31 31 void programInit(); 32 void slotViewDetailsClicked(); 32 33 void slotClose(); 33 34 void slotUserClickedCheckSysUpdates(); … … 53 54 void clearPBIList(); 54 55 void setRunAtStartupConfig( bool enabled ); 56 void setUseCustomTmp( bool enabled ); 57 void setUseCustomDirName( QString tmpdir ); 58 void setUseProxy( bool enabled ); 59 void setUseProxySettings( QString proxyURL, int portnum ); 55 60 bool getStartupConfig(); 61 bool getCustomTmpEnabled(); 62 QString getCustomTmpDir(); 63 bool getProxyEnabled(); 64 QString getProxyUrl(); 65 int getProxyPort(); 56 66 void slotRescanPBIUpdatesClicked(); 57 58 67 void slotDisableConfUpdates(bool status); 59 68 60 69 private slots: 70 void slotCustomTmpClicked(); 71 void slotProxyClicked(); 72 void slotSelectCustomTmp(); 73 void slotConfigKDEProxy(); 61 74 62 75 private: … … 65 78 QString standAlone[150]; 66 79 QString reboot[150]; 80 bool disableConfUpdates; 67 81 68 82 … … 75 89 void signalUpdatePBI(); 76 90 void signalCheckPBIUpdatesClicked(); 91 void signalLaunchKDEProxy(); 77 92 } ; 78 93 #endif // SYSTEMUPDATER_H -
pcbsd/branches/7.0/SystemUpdater/SystemUpdater.qrc
r2131 r2940 1 1 <RCC> 2 2 <qresource> 3 <file>folder.png</file> 3 4 <file>sysupdater.png</file> 4 5 </qresource> 5 6 </RCC> 6 -
pcbsd/branches/7.0/SystemUpdater/SystemUpdater.ui
r2131 r2940 6 6 <x>0</x> 7 7 <y>0</y> 8 <width>5 42</width>9 <height> 353</height>8 <width>596</width> 9 <height>508</height> 10 10 </rect> 11 11 </property> … … 75 75 </property> 76 76 <widget class="QWidget" name="Widget8" > 77 <property name="geometry" >78 <rect>79 <x>0</x>80 <y>0</y>81 <width>524</width>82 <height>275</height>83 </rect>84 </property>85 77 <attribute name="title" > 86 78 <string>System Updates</string> … … 107 99 <item> 108 100 <layout class="QGridLayout" > 109 <item row="1" column="0" colspan=" 2" >101 <item row="1" column="0" colspan="3" > 110 102 <widget class="Q3ListView" name="listViewSysUpdates" > 111 103 <property name="sizePolicy" > … … 151 143 </widget> 152 144 </item> 153 <item row="0" column="0" colspan=" 2" >145 <item row="0" column="0" colspan="3" > 154 146 <widget class="QLabel" name="textLabel6" > 155 147 <property name="sizePolicy" > … … 170 162 </widget> 171 163 </item> 172 <item row="2" column=" 1" >164 <item row="2" column="2" > 173 165 <spacer name="spacer2" > 174 166 <property name="orientation" > … … 190 182 <property name="text" > 191 183 <string>Select All</string> 184 </property> 185 </widget> 186 </item> 187 <item row="2" column="1" > 188 <widget class="QPushButton" name="pushDetails" > 189 <property name="text" > 190 <string>View Details</string> 192 191 </property> 193 192 </widget> … … 329 328 </widget> 330 329 <widget class="QWidget" name="Widget9" > 331 <property name="geometry" >332 <rect>333 <x>0</x>334 <y>0</y>335 <width>524</width>336 <height>275</height>337 </rect>338 </property>339 330 <attribute name="title" > 340 331 <string>PBI Updates</string> … … 577 568 </widget> 578 569 <widget class="QWidget" name="TabPage" > 579 <property name="geometry" >580 <rect>581 <x>0</x>582 <y>0</y>583 <width>524</width>584 <height>275</height>585 </rect>586 </property>587 570 <attribute name="title" > 588 571 <string>Configuration</string> 589 572 </attribute> 590 <layout class="Q VBoxLayout" >591 <item >573 <layout class="QGridLayout" name="gridLayout_2" > 574 <item row="0" column="0" > 592 575 <widget class="QCheckBox" name="checkSystemUpdatesConfig" > 593 576 <property name="text" > … … 596 579 </widget> 597 580 </item> 598 <item >581 <item row="1" column="0" > 599 582 <widget class="QCheckBox" name="checkPBIUpdatesConfig" > 600 583 <property name="text" > … … 603 586 </widget> 604 587 </item> 605 <item >588 <item row="2" column="0" > 606 589 <widget class="QCheckBox" name="checkRunAtStartup" > 607 590 <property name="text" > … … 610 593 </widget> 611 594 </item> 612 <item> 595 <item row="3" column="0" > 596 <layout class="QHBoxLayout" name="horizontalLayout" > 597 <item> 598 <widget class="QCheckBox" name="checkTMPDIR" > 599 <property name="text" > 600 <string>Specify custom temporary directory</string> 601 </property> 602 </widget> 603 </item> 604 <item> 605 <spacer name="horizontalSpacer" > 606 <property name="orientation" > 607 <enum>Qt::Horizontal</enum> 608 </property> 609 <property name="sizeType" > 610 <enum>QSizePolicy::Minimum</enum> 611 </property> 612 <property name="sizeHint" stdset="0" > 613 <size> 614 <width>40</width> 615 <height>20</height> 616 </size> 617 </property> 618 </spacer> 619 </item> 620 <item> 621 <widget class="QLineEdit" name="lineTMPDIR" > 622 <property name="readOnly" > 623 <bool>true</bool> 624 </property> 625 </widget> 626 </item> 627 <item> 628 <widget class="QPushButton" name="pushTMPDIR" > 629 <property name="sizePolicy" > 630 <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > 631 <horstretch>0</horstretch> 632 <verstretch>0</verstretch> 633 </sizepolicy> 634 </property> 635 <property name="minimumSize" > 636 <size> 637 <width>28</width> 638 <height>28</height> 639 </size> 640 </property> 641 <property name="maximumSize" > 642 <size> 643 <width>28</width> 644 <height>28</height> 645 </size> 646 </property> 647 <property name="text" > 648 <string/> 649 </property> 650 <property name="icon" > 651 <iconset resource="SystemUpdater.qrc" > 652 <normaloff>:/folder.png</normaloff>:/folder.png</iconset> 653 </property> 654 <property name="iconSize" > 655 <size> 656 <width>20</width> 657 <height>20</height> 658 </size> 659 </property> 660 </widget> 661 </item> 662 </layout> 663 </item> 664 <item row="4" column="0" > 665 <widget class="QCheckBox" name="checkProxy" > 666 <property name="text" > 667 <string>Specify proxy for update check</string> 668 </property> 669 </widget> 670 </item> 671 <item row="5" column="0" > 672 <widget class="QGroupBox" name="groupProxySettings" > 673 <property name="title" > 674 <string>Proxy Settings</string> 675 </property> 676 <layout class="QGridLayout" name="gridLayout" > 677 <item row="0" column="0" > 678 <layout class="QHBoxLayout" name="horizontalLayout_2" > 679 <item> 680 <widget class="QLabel" name="label" > 681 <property name="text" > 682 <string>Proxy Server</string> 683 </property> 684 </widget> 685 </item> 686 <item> 687 <widget class="QLineEdit" name="lineProxyServer" /> 688 </item> 689 <item> 690 <widget class="QLabel" name="label_2" > 691 <property name="text" > 692 <string>Port</string> 693 </property> 694 </widget> 695 </item> 696 <item> 697 <widget class="QSpinBox" name="spinProxyPort" > 698 <property name="maximum" > 699 <number>9999</number> 700 </property> 701 <property name="value" > 702 <number>8080</number> 703 </property> 704 </widget> 705 </item> 706 </layout> 707 </item> 708 </layout> 709 </widget> 710 </item> 711 <item row="6" column="0" > 712 <layout class="QHBoxLayout" name="horizontalLayout_3" > 713 <item> 714 <spacer name="horizontalSpacer_2" > 715 <property name="orientation" > 716 <enum>Qt::Horizontal</enum> 717 </property> 718 <property name="sizeHint" stdset="0" > 719 <size> 720 <width>40</width> 721 <height>20</height> 722 </size> 723 </property> 724 </spacer> 725 </item> 726 <item> 727 <widget class="QPushButton" name="pushConfigProxy" > 728 <property name="text" > 729 <string>Configure Download Proxy</string> 730 </property> 731 </widget> 732 </item> 733 <item> 734 <spacer name="horizontalSpacer_3" > 735 <property name="orientation" > 736 <enum>Qt::Horizontal</enum> 737 </property> 738 <property name="sizeHint" stdset="0" > 739 <size> 740 <width>40</width> 741 <height>20</height> 742 </size> 743 </property> 744 </spacer> 745 </item> 746 </layout> 747 </item> 748 <item row="7" column="0" > 613 749 <spacer name="spacer8" > 614 750 <property name="orientation" > … … 626 762 </spacer> 627 763 </item> 628 <item >764 <item row="8" column="0" > 629 765 <spacer name="spacer9" > 630 766 <property name="orientation" > -
pcbsd/branches/7.0/SystemUpdater/UpdaterTray.cpp
r2908 r2940 34 34 #define UPDATE_MSEC 1000 * 60 * 60 * 12 35 35 36 36 /* Change this to switch the default patch tmpdir */ 37 #define PATCHTMPDIR_DEFAULT "/usr/local/tmp" 37 38 38 39 … … 137 138 // If the user wants to view details about a particular update 138 139 connect( SystemUpdaterDialog, SIGNAL(signalOpenSysDetails(int)), this, SLOT(slotOpenSysDetails(int) ) ); 140 connect( SystemUpdaterDialog, SIGNAL(signalLaunchKDEProxy()), this, SLOT(slotLaunchKDEProxyConfig() ) ); 139 141 140 142 // Signal if the user wants to start a system update … … 154 156 155 157 156 // Get the username of the person running X158 // Get the username of the person running X 157 159 username = getlogin(); 158 159 160 160 161 // Set the tray icon that we are checking for updates … … 247 248 getUpdatesDir->addArgument( "sh"); 248 249 getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh"); 250 if ( useProxyServer ) 251 { 252 QString proxyArgPort; 253 proxyArgPort.setNum(proxyServerPort); 254 255 QString proxyArgUrl = proxyServerUrl; 256 257 // Check if we need to remove a http:// 258 if ( proxyServerUrl.indexOf("http://") == 0 ) 259 { 260 proxyArgUrl.remove(0, 7); 261 } 262 263 getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort ); 264 265 } else { 266 getUpdatesDir->addArgument( "DISABLE" ); 267 } 249 268 250 269 // Connect the exited signal and start the process … … 252 271 //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) ); 253 272 if ( ! getUpdatesDir->start() ) { 254 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );273 QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok ); 255 274 } 256 275 … … 269 288 if ( getUpdatesDir->exitStatus() != 0 ) 270 289 { 271 QMessageBox::warning( this->contextMenu(), tr("Update Error!"), tr("Could not contact the PC-BSD update server!"), QMessageBox::Ok );290 QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok ); 272 291 } 273 292 … … 280 299 connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) ); 281 300 if ( ! readSysUpdates->start() ) { 282 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );301 QMessageBox::information( 0, tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok ); 283 302 } 284 303 … … 644 663 645 664 646 647 648 649 650 651 665 // Check if the user wants to check for PBI updates and save it 652 666 bool enablePBICheck = SystemUpdaterDialog->getPBIUpdateConfig(); … … 662 676 checkPBIUpdatesFrequently = enablePBICheck; 663 677 664 } 665 666 667 668 669 670 678 679 // Check if the user has enabled a custom tmpdir 680 useCustomTmpDir = SystemUpdaterDialog->getCustomTmpEnabled(); 681 settings.writeEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", useCustomTmpDir ); 682 683 // Load the custom tmpdir string 684 customTmpDir = SystemUpdaterDialog->getCustomTmpDir(); 685 settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir ); 686 687 useProxyServer = SystemUpdaterDialog->getProxyEnabled(); 688 settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer ); 689 690 proxyServerUrl = SystemUpdaterDialog->getProxyUrl(); 691 settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl ); 692 693 proxyServerPort = SystemUpdaterDialog->getProxyPort(); 694 settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort ); 695 696 697 } 671 698 672 699 void UpdaterTray::loadUpdaterPrefs() { 673 700 // Load the user preferences for the System Updater 701 bool ok; 674 702 QSettings settings; 675 //settings.setPath( "PC-BSD", "SystemUpdater" ); 703 704 // Disable updating the conf file until we are done loading it 705 SystemUpdaterDialog->slotDisableConfUpdates(true); 676 706 677 707 bool enableSysCheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckSysUpdatesConfig", TRUE ); … … 679 709 checkSysUpdatesFrequently = enableSysCheck; 680 710 681 682 711 bool enablePBICheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", TRUE ); 683 712 SystemUpdaterDialog->setPBIUpdateConfig(enablePBICheck); … … 688 717 contextMenu()->setItemChecked ( 6, enableStartup ); 689 718 690 } 691 692 693 694 695 719 // Check if we are using a custom tmpdir 720 useCustomTmpDir = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", false ); 721 SystemUpdaterDialog->setUseCustomTmp( useCustomTmpDir ); 722 723 // Load a custom tmpdir 724 customTmpDir= PATCHTMPDIR_DEFAULT; 725 customTmpDir = settings.value("/PC-BSD/SystemUpdater/customTmpDir", customTmpDir).toString(); 726 SystemUpdaterDialog->setUseCustomDirName( customTmpDir ); 727 728 // Load if the user wants to use a proxy server 729 useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false ); 730 SystemUpdaterDialog->setUseProxy( useProxyServer ); 731 732 // Load Proxy Server Settings 733 proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString(); 734 735 settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 736 if ( ok ) { 737 proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 738 } else { 739 proxyServerPort = 8080; 740 } 741 SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort ); 742 743 SystemUpdaterDialog->slotDisableConfUpdates(false); 744 745 } 696 746 697 747 … … 700 750 slotStartUpdateCheck(); 701 751 } 702 703 704 705 706 752 707 753 … … 794 840 bool ok; 795 841 842 // Lets set the patch tmpdir variable now 843 if ( useCustomTmpDir ) 844 { 845 patchTmpDir = customTmpDir; 846 } else { 847 patchTmpDir = PATCHTMPDIR_DEFAULT; 848 } 849 850 // Make sure this tmpdir exists 851 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 852 853 796 854 797 855 // Get the output of the .df command 798 command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' / tmp' > /PCBSD/tmp/.dfoutput";856 command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /proc' | grep -v ' /tmp' > '" + patchTmpDir + "/.dfoutput'"; 799 857 FILE *filecmd = popen(command,"r"); 800 858 pclose(filecmd); … … 816 874 i = 0; 817 875 // Open our df file, and read it line-by-line 818 QFile file( "/PCBSD/tmp/.dfoutput" );876 QFile file( patchTmpDir + "/.dfoutput" ); 819 877 if ( file.open( IO_ReadOnly ) ) { 820 878 QTextStream stream( &file ); … … 823 881 CheckDFParts[i] = tmp.simplifyWhiteSpace(); 824 882 825 //QMessageBox::critical( this->contextMenu(), tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);883 //QMessageBox::critical( 0, tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok); 826 884 i++; 827 885 } 828 886 // Make sure the last in our array is empty 829 887 CheckDFParts[i]=""; 888 file.close(); 889 file.remove(); 830 890 } 831 891 832 892 833 installLoc = "/PCBSD/tmp"; 893 if ( useCustomTmpDir ) 894 { 895 installLoc = customTmpDir; 896 } else { 897 installLoc = PATCHTMPDIR_DEFAULT; 898 } 834 899 835 900 // Now determine which partition we have selected … … 864 929 { 865 930 // Not enough room, warn the user how much they will need 866 QMessageBox::critical( this->contextMenu(), tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates"), QMessageBox::Ok );931 QMessageBox::critical( 0, tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates. Please select a different partition or free up some space to continue."), QMessageBox::Ok ); 867 932 return; 868 933 } else { … … 872 937 873 938 } else { 874 QMessageBox::critical( this->contextMenu(), tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);939 QMessageBox::critical( 0, tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok); 875 940 } 876 941 … … 890 955 void UpdaterTray::slotStartSystemUpdate() 891 956 { 892 // The user is ready to start some system updates 957 // The user is ready to start some system updates 958 959 960 // Lets set the patch tmpdir variable now 961 if ( useCustomTmpDir ) 962 { 963 patchTmpDir = customTmpDir; 964 } else { 965 patchTmpDir = PATCHTMPDIR_DEFAULT; 966 } 967 968 // Make sure this tmpdir exists 969 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 893 970 894 971 // Change the program status and update the tray icon … … 945 1022 UpdaterStatusDialog->show(); 946 1023 947 QMessageBox::warning( this->contextMenu(), tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );1024 QMessageBox::warning( 0, tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok ); 948 1025 requiresSysReboot = 1; 949 1026 } … … 965 1042 void UpdaterTray::slotDownloadSysUpdate() 966 1043 { 967 QString status, id, tmp ;1044 QString status, id, tmp, command; 968 1045 bool startNewDownload = false, ok; 969 1046 int getNextItem = 0; … … 1054 1131 UpdaterStatusDialog->setLabelSysUpdateStatus(status); 1055 1132 1056 UpdaterStatusDialog->setProgressTotalSteps(100); 1133 UpdaterStatusDialog->setProgressTotalSteps(100); 1134 1135 command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'"; 1136 FILE *file = popen(command,"r"); 1137 pclose(file); 1057 1138 1058 1139 // Make sure that any old patch is removed first 1059 QFile tmpfile( "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");1140 QFile tmpfile( patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma"); 1060 1141 if ( tmpfile.exists() ) 1061 1142 { 1062 1143 tmpfile.remove(); 1063 1144 } 1064 1065 copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 1145 1146 1147 copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 1066 1148 1067 1149 connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); … … 1079 1161 QString tmp; 1080 1162 1081 // This function starts the internal checksum to ensure the PBIis intact1163 // This function starts the internal checksum to ensure the update is intact 1082 1164 1083 1165 tmp = tr("Checking data integrity..."); … … 1085 1167 1086 1168 // Make the checksum.sh script now 1087 QFile file4( "/PCBSD/tmp/.syschecksum.sh" );1169 QFile file4( patchTmpDir + "/.syschecksum.sh" ); 1088 1170 if ( file4.open( IO_WriteOnly ) ) { 1089 1171 QTextStream stream4( &file4 ); 1090 stream4 << "cat /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma| md5 >&1";1172 stream4 << "cat '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | md5 >&1"; 1091 1173 file4.close(); 1092 1174 } … … 1094 1176 checksumProc = new Q3Process( this ); 1095 1177 checksumProc->addArgument( "sh" ); 1096 checksumProc->addArgument( "/PCBSD/tmp/.syschecksum.sh" );1178 checksumProc->addArgument( patchTmpDir + "/.syschecksum.sh" ); 1097 1179 //connect( checksumProc, SIGNAL(processExited()), this, SLOT( slotChecksumFinished() ) ); 1098 1180 connect( checksumProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadSysMD5() ) ); 1099 1181 if ( !checksumProc->start() ) { 1100 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );1182 QMessageBox::information( 0, tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok ); 1101 1183 } 1102 1184 … … 1124 1206 1125 1207 // Remove the bad patch 1126 command = "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma";1208 command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'"; 1127 1209 FILE *file = popen(command,"r"); 1128 1210 pclose(file); … … 1134 1216 UpdaterStatusDialog->show(); 1135 1217 1136 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );1218 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok ); 1137 1219 1138 1220 if ( UpdaterStatusDialog->isShown() ) … … 1216 1298 if ( requiresSysReboot == 1) 1217 1299 { 1218 QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);1300 QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok); 1219 1301 } else { 1220 1302 QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed!"), QMessageBox::Ok ); … … 1249 1331 1250 1332 1251 // Make the checksum.shscript now1252 QFile file4( "/PCBSD/tmp/.extractsys.sh" );1333 // Make the extract script now 1334 QFile file4( patchTmpDir + "/.extractsys.sh" ); 1253 1335 if ( file4.open( IO_WriteOnly ) ) { 1254 1336 QTextStream stream4( &file4 ); 1255 1337 stream4 << "#!/bin/sh\n"; 1256 stream4 << "mkdir -p /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);1257 stream4 << " \necho \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile\n";1258 stream4 << "lzma -so d /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | tar xvC /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "-f - >&1";1338 stream4 << "mkdir -p '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1339 stream4 << "echo \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile'\n"; 1340 stream4 << "lzma -so d '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | tar xvC '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "' -f - >&1"; 1259 1341 file4.close(); 1260 1342 } … … 1263 1345 extractProc = new Q3Process( this ); 1264 1346 extractProc->addArgument( "sh" ); 1265 extractProc->addArgument( "/PCBSD/tmp/.extractsys.sh" );1347 extractProc->addArgument( patchTmpDir + "/.extractsys.sh" ); 1266 1348 1267 1349 connect( extractProc, SIGNAL(processExited()), this, SLOT(slotSysExtractFinished() ) ); … … 1271 1353 UpdaterStatusDialog->show(); 1272 1354 1273 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );1355 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok ); 1274 1356 if ( UpdaterStatusDialog->isShown() ) 1275 1357 { … … 1294 1376 1295 1377 // Make the checksum.sh script now 1296 QFile file4( "/PCBSD/tmp/.installsys.sh" );1378 QFile file4( patchTmpDir + "/.installsys.sh" ); 1297 1379 if ( file4.open( IO_WriteOnly ) ) { 1298 1380 QTextStream stream4( &file4 ); 1299 1381 stream4 << "#!/bin/sh\n"; 1300 stream4 << "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma\n\n";1301 stream4 << "cd /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);1302 stream4 << " \nPATCHDIR=\"/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";1303 stream4 << "cd $PATCHDIR\n";1382 stream4 << "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'\n\n"; 1383 stream4 << "cd '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1384 stream4 << "PATCHDIR=\"" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n"; 1385 stream4 << "cd \"${PATCHDIR}\"\n"; 1304 1386 stream4 << "sh update.sh >&1 2>&1\n"; 1305 1387 stream4 << "if [ \"$?\" = \"0\" ]\n"; 1306 1388 stream4 << "then\n"; 1307 1389 stream4 << " cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[currentSysWorkingItem] + " /PCBSD/SystemUpdater/system-updates/installed/" + SysUpdatePatchFile[currentSysWorkingItem] + "\n"; 1308 stream4 << " rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";1309 stream4 << " rm /PCBSD/tmp/.extractsys.sh\n";1310 stream4 << " rm /PCBSD/tmp/.installsys.sh\n";1311 stream4 << " rm /PCBSD/tmp/.syschecksum.sh\n";1390 stream4 << " rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1391 stream4 << " rm '" + patchTmpDir + "/.extractsys.sh'\n"; 1392 stream4 << " rm '" + patchTmpDir + "/.installsys.sh'\n"; 1393 stream4 << " rm '" + patchTmpDir + "/.syschecksum.sh'\n"; 1312 1394 stream4 << " exit 0\n"; 1313 1395 stream4 << "else\n"; 1314 stream4 << " rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";1315 stream4 << " rm /PCBSD/tmp/.extractsys.sh\n";1316 stream4 << " rm /PCBSD/tmp/.installsys.sh\n";1317 stream4 << " rm /PCBSD/tmp/.syschecksum.sh\n";1396 stream4 << " rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1397 stream4 << " rm '" + patchTmpDir + "/.extractsys.sh'\n"; 1398 stream4 << " rm '" + patchTmpDir + "/.installsys.sh'\n"; 1399 stream4 << " rm '" + patchTmpDir + "/.syschecksum.sh'\n"; 1318 1400 stream4 << " exit 1\n"; 1319 1401 stream4 << "fi\n"; … … 1324 1406 installProc = new Q3Process( this ); 1325 1407 installProc->addArgument( "sh" ); 1326 installProc->addArgument( "/PCBSD/tmp/.installsys.sh" );1408 installProc->addArgument( patchTmpDir + "/.installsys.sh" ); 1327 1409 1328 1410 connect( installProc, SIGNAL(processExited()), this, SLOT(slotSysInstallFinished() ) ); … … 1331 1413 1332 1414 if ( ! installProc->start() ) { 1333 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );1415 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok ); 1334 1416 exit(15); 1335 1417 } … … 1566 1648 checkPBIProc->addArgument( progName ); 1567 1649 checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI] ); 1650 1651 if ( useProxyServer ) 1652 { 1653 QString proxyArgPort; 1654 proxyArgPort.setNum(proxyServerPort); 1655 1656 QString proxyArgUrl = proxyServerUrl; 1657 1658 // Check if we need to remove a http:// 1659 if ( proxyServerUrl.indexOf("http://") == 0 ) 1660 { 1661 proxyArgUrl.remove(0, 7); 1662 } 1663 1664 checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort ); 1665 1666 } else { 1667 checkPBIProc->addArgument( "DISABLE" ); 1668 } 1669 1568 1670 1569 1671 connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) ); … … 1701 1803 UpdaterStatusDialog->show(); 1702 1804 1805 // Lets set the patch tmpdir variable now 1806 if ( useCustomTmpDir ) 1807 { 1808 patchTmpDir = customTmpDir; 1809 } else { 1810 patchTmpDir = PATCHTMPDIR_DEFAULT; 1811 } 1812 1813 // Make sure this tmpdir exists 1814 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 1703 1815 1704 1816 // Get our list of PBIs ready to be updated … … 1765 1877 UpdaterStatusDialog->show(); 1766 1878 1767 QMessageBox::critical( this->contextMenu(), tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );1879 QMessageBox::critical( 0, tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok ); 1768 1880 1769 1881 // Set the status that this failed … … 1865 1977 1866 1978 // Make sure that any old PBI is removed first 1867 QFile tmpfile("/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi"); 1979 system("rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' >/dev/null 2>/dev/null"); 1980 QFile tmpfile( patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi"); 1868 1981 if ( tmpfile.exists() ) 1869 1982 { 1870 1983 tmpfile.remove(); 1871 1984 } 1872 1873 1874 copyJob = KIO::copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 1985 1986 copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 1875 1987 1876 1988 connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); … … 1921 2033 { 1922 2034 1923 if ( upgradePBIProc->exitStatus() != 0)2035 if ( upgradePBIProc->exitStatus() == 255) 1924 2036 { 1925 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("The updated version of " + PBIProgName[currentWorkingPBI] + " " + tr("failed the integrity check! Please try updating this PBI again later.")), QMessageBox::Ok );2037 QMessageBox::critical( 0, tr("Online Update"), tr("The updated version of %s failed the integrity check! Please try updating this PBI again later.", PBIProgName[currentWorkingPBI] ), QMessageBox::Ok ); 1926 2038 // Update the status on the previous download to finished 2039 status = tr("Failed!"); 2040 UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) ); 2041 } else if ( upgradePBIProc->exitStatus() == 256 ) { 2042 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading %s You may need to re-install this PBI manually.", PBIProgName[currentWorkingPBI]), QMessageBox::Ok ); 1927 2043 status = tr("Failed!"); 1928 2044 UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) ); … … 1958 2074 1959 2075 1960 QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );2076 QMessageBox::information( 0, tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok ); 1961 2077 if ( UpdaterStatusDialog->isShown() ) 1962 2078 { … … 2011 2127 2012 2128 // Make the checksum.sh script now 2013 QFile file4( "/PCBSD/tmp/.upgradepbi.sh" );2129 QFile file4( patchTmpDir + "/.upgradepbi.sh" ); 2014 2130 if ( file4.open( IO_WriteOnly ) ) { 2015 2131 QTextStream stream4( &file4 ); … … 2017 2133 stream4 << "DISPLAY="" ; export DISPLAY\n"; 2018 2134 stream4 << "\n"; 2019 stream4 << "MD5=\"`cat /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi| md5`\"\n";2135 stream4 << "MD5=\"`cat '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' | md5`\"\n"; 2020 2136 stream4 << "if [ \"${MD5}\" != \"" + PBIProgMD5[currentWorkingPBI] + "\" ]\n"; 2021 2137 stream4 << "then\n"; 2022 stream4 << " rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";2138 stream4 << " rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2023 2139 stream4 << " exit 255\n"; 2024 2140 stream4 << "fi\n"; … … 2037 2153 stream4 << "echo 'SETSTEPS: 2'\n"; 2038 2154 stream4 << "echo 'MSG: Installing " + NewProgDirName + "'\n"; 2039 stream4 << "chmod 755 /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n"; 2040 stream4 << "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi -text -accept\n"; 2041 stream4 << "\n"; 2155 stream4 << "chmod 755 '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2156 stream4 << "'" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' -text -accept\n"; 2157 stream4 << "if [ \"$?\" != \"0\" ]\n"; 2158 stream4 << "then\n"; 2159 stream4 << " rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2160 stream4 << " rm '" + patchTmpDir + "/.upgradepbi.sh'\n"; 2161 stream4 << " exit 256\n"; 2162 stream4 << "fi\n"; 2042 2163 stream4 << "echo 'SETSTEPS: 3'\n"; 2043 2164 stream4 << "echo 'MSG: Finished installing " + NewProgDirName + "'\n"; 2044 stream4 << "rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n"; 2165 stream4 << "rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2166 stream4 << "rm '" + patchTmpDir + "/.upgradepbi.sh'\n"; 2167 stream4 << "exit 0\n"; 2045 2168 file4.close(); 2046 2169 } … … 2049 2172 upgradePBIProc = new Q3Process( this ); 2050 2173 upgradePBIProc->addArgument( "sh" ); 2051 upgradePBIProc->addArgument( "/PCBSD/tmp/.upgradepbi.sh" );2174 upgradePBIProc->addArgument( patchTmpDir + "/.upgradepbi.sh" ); 2052 2175 2053 2176 connect( upgradePBIProc, SIGNAL(processExited()), this, SLOT(slotStartPBIInstall() ) ); … … 2055 2178 2056 2179 if ( ! upgradePBIProc->start() ) { 2057 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );2180 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok ); 2058 2181 exit(15); 2059 2182 } 2060 2061 2062 2063 2183 2064 2184 } … … 2076 2196 { 2077 2197 tmp = upgradePBIProc->readLineStdout(); 2198 2078 2199 2079 2200 if ( tmp.find("TOTALSTEPS:" ) == 0) … … 2105 2226 2106 2227 } 2228 2229 2230 void UpdaterTray::slotLaunchKDEProxyConfig() 2231 { 2232 QString command; 2233 command = "su " + username + " -c 'kcmshell4 proxy' &"; 2234 system(command); 2235 } -
pcbsd/branches/7.0/SystemUpdater/UpdaterTray.h
r2600 r2940 54 54 void slotChangeRunStartup(); 55 55 void slotTrayActivated(QSystemTrayIcon::ActivationReason reason); 56 void slotLaunchKDEProxyConfig(); 56 57 57 58 protected: … … 62 63 void loadUpdaterPrefs(); 63 64 void loadPatchData(QString patchFile, int patchNum); 64 65 65 KJob *copyJob; 66 bool useCustomTmpDir; 67 QString customTmpDir; 68 bool useProxyServer; 69 QString proxyServerUrl; 70 int proxyServerPort; 71 QString patchTmpDir; 66 72 }; 67 73 -
pcbsd/trunk/SystemUpdater/SystemUpdater.cpp
r2780 r2940 24 24 listViewSysUpdates->hideColumn( 1 ); 25 25 26 disableConfUpdates = false; 27 26 28 27 29 … … 36 38 connect( listViewSysUpdates, SIGNAL(doubleClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysDoubleClicked( Q3ListViewItem *, const QPoint &, int) ) ); 37 39 // Connect to a right-clicked slot as well 38 connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) ); 39 40 connect( listViewSysUpdates, SIGNAL(rightButtonClicked ( Q3ListViewItem *, const QPoint &, int ) ), this, SLOT(slotSysRightClicked( Q3ListViewItem *, const QPoint &, int) ) ); 41 42 // Connect the pushViewDetails button 43 connect( pushDetails, SIGNAL( clicked() ), this, SLOT( slotViewDetailsClicked() ) ); 44 45 // Connect the Custom Tmpdir Checkbox 46 connect( checkTMPDIR, SIGNAL( clicked() ), this, SLOT( slotCustomTmpClicked() ) ); 47 connect( checkProxy, SIGNAL( clicked() ), this, SLOT( slotProxyClicked() ) ); 48 connect( pushTMPDIR, SIGNAL( clicked() ), this, SLOT( slotSelectCustomTmp() ) ); 49 connect( pushConfigProxy, SIGNAL( clicked() ), this, SLOT( slotConfigKDEProxy() ) ); 50 51 // Connect slots to emit signal when settings change 52 connect( lineTMPDIR, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 53 connect( lineProxyServer, SIGNAL( textChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 54 connect( spinProxyPort, SIGNAL( valueChanged(const QString &) ), this, SLOT( slotConfigChanged() ) ); 55 56 } 57 58 59 void systemUpdater::slotViewDetailsClicked() 60 { 61 if ( listViewSysUpdates->currentItem() != 0 ) 62 { 63 bool ok; 64 int idnum = listViewSysUpdates->currentItem()->text(1).toInt(&ok); 65 emit signalOpenSysDetails(idnum); 66 } 40 67 } 41 68 … … 94 121 void systemUpdater::slotConfigChanged() 95 122 { 96 emit signalConfigChanged(); 123 if (! disableConfUpdates ) 124 { 125 emit signalConfigChanged(); 126 } 97 127 } 98 128 … … 405 435 emit signalCheckPBIUpdatesClicked(); 406 436 } 437 438 // Set if we are using a custom TmpDir 439 void systemUpdater::setUseCustomTmp( bool enabled ) 440 { 441 checkTMPDIR->setChecked(enabled); 442 lineTMPDIR->setEnabled(enabled); 443 pushTMPDIR->setEnabled(enabled); 444 } 445 446 // Set the custom Tmpdir being used 447 void systemUpdater::setUseCustomDirName( QString tmpdir ) 448 { 449 lineTMPDIR->setText(tmpdir); 450 } 451 452 // Set Proxy Usage 453 void systemUpdater::setUseProxy( bool enabled ) 454 { 455 checkProxy->setChecked(enabled); 456 groupProxySettings->setEnabled(enabled); 457 } 458 459 // Set the Proxy being used 460 void systemUpdater::setUseProxySettings( QString proxyURL, int portnum ) 461 { 462 lineProxyServer->setText(proxyURL); 463 spinProxyPort->setValue(portnum); 464 } 465 466 467 bool systemUpdater::getCustomTmpEnabled() 468 { 469 return checkTMPDIR->isChecked(); 470 } 471 472 473 QString systemUpdater::getCustomTmpDir() 474 { 475 return lineTMPDIR->text(); 476 } 477 478 bool systemUpdater::getProxyEnabled() 479 { 480 return checkProxy->isChecked(); 481 } 482 483 484 QString systemUpdater::getProxyUrl() 485 { 486 return lineProxyServer->text(); 487 } 488 489 int systemUpdater::getProxyPort() 490 { 491 return spinProxyPort->value(); 492 } 493 494 495 void systemUpdater::slotCustomTmpClicked() 496 { 497 if ( checkTMPDIR->isChecked() ) 498 { 499 lineTMPDIR->setEnabled(true); 500 pushTMPDIR->setEnabled(true); 501 } else { 502 lineTMPDIR->setEnabled(false); 503 pushTMPDIR->setEnabled(false); 504 } 505 506 slotConfigChanged(); 507 } 508 509 void systemUpdater::slotProxyClicked() 510 { 511 if ( checkProxy->isChecked() ) 512 { 513 groupProxySettings->setEnabled(true); 514 } else { 515 groupProxySettings->setEnabled(false); 516 } 517 518 slotConfigChanged(); 519 } 520 521 void systemUpdater::slotSelectCustomTmp() 522 { 523 524 QString newDir = QFileDialog::getExistingDirectory( 525 "/", 526 this, 527 tr("Select Temp directory"), 528 tr("Select Temp directory"), 529 TRUE ); 530 531 // Check if the user just hit cancel 532 if ( newDir.isEmpty() ) 533 { 534 return; 535 } 536 537 lineTMPDIR->setText(newDir); 538 539 } 540 541 void systemUpdater::slotDisableConfUpdates(bool status) 542 { 543 // Set if we need to ignore updating the conf file, because a conf load is taking place 544 disableConfUpdates = status; 545 } 546 547 548 // Launches the kcmshell4 proxy command to allow the user to modify proxy settings 549 void systemUpdater::slotConfigKDEProxy() 550 { 551 emit signalLaunchKDEProxy(); 552 } -
pcbsd/trunk/SystemUpdater/SystemUpdater.h
r2780 r2940 30 30 public slots: 31 31 void programInit(); 32 void slotViewDetailsClicked(); 32 33 void slotClose(); 33 34 void slotUserClickedCheckSysUpdates(); … … 53 54 void clearPBIList(); 54 55 void setRunAtStartupConfig( bool enabled ); 56 void setUseCustomTmp( bool enabled ); 57 void setUseCustomDirName( QString tmpdir ); 58 void setUseProxy( bool enabled ); 59 void setUseProxySettings( QString proxyURL, int portnum ); 55 60 bool getStartupConfig(); 61 bool getCustomTmpEnabled(); 62 QString getCustomTmpDir(); 63 bool getProxyEnabled(); 64 QString getProxyUrl(); 65 int getProxyPort(); 56 66 void slotRescanPBIUpdatesClicked(); 57 58 67 void slotDisableConfUpdates(bool status); 59 68 60 69 private slots: 70 void slotCustomTmpClicked(); 71 void slotProxyClicked(); 72 void slotSelectCustomTmp(); 73 void slotConfigKDEProxy(); 61 74 62 75 private: … … 65 78 QString standAlone[150]; 66 79 QString reboot[150]; 80 bool disableConfUpdates; 67 81 68 82 … … 75 89 void signalUpdatePBI(); 76 90 void signalCheckPBIUpdatesClicked(); 91 void signalLaunchKDEProxy(); 77 92 } ; 78 93 #endif // SYSTEMUPDATER_H -
pcbsd/trunk/SystemUpdater/SystemUpdater.qrc
r2131 r2940 1 1 <RCC> 2 2 <qresource> 3 <file>folder.png</file> 3 4 <file>sysupdater.png</file> 4 5 </qresource> 5 6 </RCC> 6 -
pcbsd/trunk/SystemUpdater/SystemUpdater.ui
r2131 r2940 6 6 <x>0</x> 7 7 <y>0</y> 8 <width>5 42</width>9 <height> 353</height>8 <width>596</width> 9 <height>508</height> 10 10 </rect> 11 11 </property> … … 75 75 </property> 76 76 <widget class="QWidget" name="Widget8" > 77 <property name="geometry" >78 <rect>79 <x>0</x>80 <y>0</y>81 <width>524</width>82 <height>275</height>83 </rect>84 </property>85 77 <attribute name="title" > 86 78 <string>System Updates</string> … … 107 99 <item> 108 100 <layout class="QGridLayout" > 109 <item row="1" column="0" colspan=" 2" >101 <item row="1" column="0" colspan="3" > 110 102 <widget class="Q3ListView" name="listViewSysUpdates" > 111 103 <property name="sizePolicy" > … … 151 143 </widget> 152 144 </item> 153 <item row="0" column="0" colspan=" 2" >145 <item row="0" column="0" colspan="3" > 154 146 <widget class="QLabel" name="textLabel6" > 155 147 <property name="sizePolicy" > … … 170 162 </widget> 171 163 </item> 172 <item row="2" column=" 1" >164 <item row="2" column="2" > 173 165 <spacer name="spacer2" > 174 166 <property name="orientation" > … … 190 182 <property name="text" > 191 183 <string>Select All</string> 184 </property> 185 </widget> 186 </item> 187 <item row="2" column="1" > 188 <widget class="QPushButton" name="pushDetails" > 189 <property name="text" > 190 <string>View Details</string> 192 191 </property> 193 192 </widget> … … 329 328 </widget> 330 329 <widget class="QWidget" name="Widget9" > 331 <property name="geometry" >332 <rect>333 <x>0</x>334 <y>0</y>335 <width>524</width>336 <height>275</height>337 </rect>338 </property>339 330 <attribute name="title" > 340 331 <string>PBI Updates</string> … … 577 568 </widget> 578 569 <widget class="QWidget" name="TabPage" > 579 <property name="geometry" >580 <rect>581 <x>0</x>582 <y>0</y>583 <width>524</width>584 <height>275</height>585 </rect>586 </property>587 570 <attribute name="title" > 588 571 <string>Configuration</string> 589 572 </attribute> 590 <layout class="Q VBoxLayout" >591 <item >573 <layout class="QGridLayout" name="gridLayout_2" > 574 <item row="0" column="0" > 592 575 <widget class="QCheckBox" name="checkSystemUpdatesConfig" > 593 576 <property name="text" > … … 596 579 </widget> 597 580 </item> 598 <item >581 <item row="1" column="0" > 599 582 <widget class="QCheckBox" name="checkPBIUpdatesConfig" > 600 583 <property name="text" > … … 603 586 </widget> 604 587 </item> 605 <item >588 <item row="2" column="0" > 606 589 <widget class="QCheckBox" name="checkRunAtStartup" > 607 590 <property name="text" > … … 610 593 </widget> 611 594 </item> 612 <item> 595 <item row="3" column="0" > 596 <layout class="QHBoxLayout" name="horizontalLayout" > 597 <item> 598 <widget class="QCheckBox" name="checkTMPDIR" > 599 <property name="text" > 600 <string>Specify custom temporary directory</string> 601 </property> 602 </widget> 603 </item> 604 <item> 605 <spacer name="horizontalSpacer" > 606 <property name="orientation" > 607 <enum>Qt::Horizontal</enum> 608 </property> 609 <property name="sizeType" > 610 <enum>QSizePolicy::Minimum</enum> 611 </property> 612 <property name="sizeHint" stdset="0" > 613 <size> 614 <width>40</width> 615 <height>20</height> 616 </size> 617 </property> 618 </spacer> 619 </item> 620 <item> 621 <widget class="QLineEdit" name="lineTMPDIR" > 622 <property name="readOnly" > 623 <bool>true</bool> 624 </property> 625 </widget> 626 </item> 627 <item> 628 <widget class="QPushButton" name="pushTMPDIR" > 629 <property name="sizePolicy" > 630 <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > 631 <horstretch>0</horstretch> 632 <verstretch>0</verstretch> 633 </sizepolicy> 634 </property> 635 <property name="minimumSize" > 636 <size> 637 <width>28</width> 638 <height>28</height> 639 </size> 640 </property> 641 <property name="maximumSize" > 642 <size> 643 <width>28</width> 644 <height>28</height> 645 </size> 646 </property> 647 <property name="text" > 648 <string/> 649 </property> 650 <property name="icon" > 651 <iconset resource="SystemUpdater.qrc" > 652 <normaloff>:/folder.png</normaloff>:/folder.png</iconset> 653 </property> 654 <property name="iconSize" > 655 <size> 656 <width>20</width> 657 <height>20</height> 658 </size> 659 </property> 660 </widget> 661 </item> 662 </layout> 663 </item> 664 <item row="4" column="0" > 665 <widget class="QCheckBox" name="checkProxy" > 666 <property name="text" > 667 <string>Specify proxy for update check</string> 668 </property> 669 </widget> 670 </item> 671 <item row="5" column="0" > 672 <widget class="QGroupBox" name="groupProxySettings" > 673 <property name="title" > 674 <string>Proxy Settings</string> 675 </property> 676 <layout class="QGridLayout" name="gridLayout" > 677 <item row="0" column="0" > 678 <layout class="QHBoxLayout" name="horizontalLayout_2" > 679 <item> 680 <widget class="QLabel" name="label" > 681 <property name="text" > 682 <string>Proxy Server</string> 683 </property> 684 </widget> 685 </item> 686 <item> 687 <widget class="QLineEdit" name="lineProxyServer" /> 688 </item> 689 <item> 690 <widget class="QLabel" name="label_2" > 691 <property name="text" > 692 <string>Port</string> 693 </property> 694 </widget> 695 </item> 696 <item> 697 <widget class="QSpinBox" name="spinProxyPort" > 698 <property name="maximum" > 699 <number>9999</number> 700 </property> 701 <property name="value" > 702 <number>8080</number> 703 </property> 704 </widget> 705 </item> 706 </layout> 707 </item> 708 </layout> 709 </widget> 710 </item> 711 <item row="6" column="0" > 712 <layout class="QHBoxLayout" name="horizontalLayout_3" > 713 <item> 714 <spacer name="horizontalSpacer_2" > 715 <property name="orientation" > 716 <enum>Qt::Horizontal</enum> 717 </property> 718 <property name="sizeHint" stdset="0" > 719 <size> 720 <width>40</width> 721 <height>20</height> 722 </size> 723 </property> 724 </spacer> 725 </item> 726 <item> 727 <widget class="QPushButton" name="pushConfigProxy" > 728 <property name="text" > 729 <string>Configure Download Proxy</string> 730 </property> 731 </widget> 732 </item> 733 <item> 734 <spacer name="horizontalSpacer_3" > 735 <property name="orientation" > 736 <enum>Qt::Horizontal</enum> 737 </property> 738 <property name="sizeHint" stdset="0" > 739 <size> 740 <width>40</width> 741 <height>20</height> 742 </size> 743 </property> 744 </spacer> 745 </item> 746 </layout> 747 </item> 748 <item row="7" column="0" > 613 749 <spacer name="spacer8" > 614 750 <property name="orientation" > … … 626 762 </spacer> 627 763 </item> 628 <item >764 <item row="8" column="0" > 629 765 <spacer name="spacer9" > 630 766 <property name="orientation" > -
pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
r2908 r2940 34 34 #define UPDATE_MSEC 1000 * 60 * 60 * 12 35 35 36 36 /* Change this to switch the default patch tmpdir */ 37 #define PATCHTMPDIR_DEFAULT "/usr/local/tmp" 37 38 38 39 … … 137 138 // If the user wants to view details about a particular update 138 139 connect( SystemUpdaterDialog, SIGNAL(signalOpenSysDetails(int)), this, SLOT(slotOpenSysDetails(int) ) ); 140 connect( SystemUpdaterDialog, SIGNAL(signalLaunchKDEProxy()), this, SLOT(slotLaunchKDEProxyConfig() ) ); 139 141 140 142 // Signal if the user wants to start a system update … … 154 156 155 157 156 // Get the username of the person running X158 // Get the username of the person running X 157 159 username = getlogin(); 158 159 160 160 161 // Set the tray icon that we are checking for updates … … 247 248 getUpdatesDir->addArgument( "sh"); 248 249 getUpdatesDir->addArgument( "/PCBSD/SystemUpdater/bin/getUpdatesDir.sh"); 250 if ( useProxyServer ) 251 { 252 QString proxyArgPort; 253 proxyArgPort.setNum(proxyServerPort); 254 255 QString proxyArgUrl = proxyServerUrl; 256 257 // Check if we need to remove a http:// 258 if ( proxyServerUrl.indexOf("http://") == 0 ) 259 { 260 proxyArgUrl.remove(0, 7); 261 } 262 263 getUpdatesDir->addArgument( proxyArgUrl + ":" + proxyArgPort ); 264 265 } else { 266 getUpdatesDir->addArgument( "DISABLE" ); 267 } 249 268 250 269 // Connect the exited signal and start the process … … 252 271 //connect( SetupScript, SIGNAL(readyReadStdout()), this, SLOT(readyReadScriptOutput2() ) ); 253 272 if ( ! getUpdatesDir->start() ) { 254 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok );273 QMessageBox::information( 0, tr("Error!"), tr("Error running updates1 script! "), QMessageBox::Ok ); 255 274 } 256 275 … … 269 288 if ( getUpdatesDir->exitStatus() != 0 ) 270 289 { 271 QMessageBox::warning( this->contextMenu(), tr("Update Error!"), tr("Could not contact the PC-BSD update server!"), QMessageBox::Ok );290 QMessageBox::warning( 0, tr("Update Error!"), tr("Could not contact the PC-BSD update server! Please check your internet connection or proxy settings under 'configure'"), QMessageBox::Ok ); 272 291 } 273 292 … … 280 299 connect( readSysUpdates, SIGNAL(processExited()), this, SLOT(slotReadSystemUpdates() ) ); 281 300 if ( ! readSysUpdates->start() ) { 282 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok );301 QMessageBox::information( 0, tr("Error!"), tr("Error running updates2 script! "), QMessageBox::Ok ); 283 302 } 284 303 … … 644 663 645 664 646 647 648 649 650 651 665 // Check if the user wants to check for PBI updates and save it 652 666 bool enablePBICheck = SystemUpdaterDialog->getPBIUpdateConfig(); … … 662 676 checkPBIUpdatesFrequently = enablePBICheck; 663 677 664 } 665 666 667 668 669 670 678 679 // Check if the user has enabled a custom tmpdir 680 useCustomTmpDir = SystemUpdaterDialog->getCustomTmpEnabled(); 681 settings.writeEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", useCustomTmpDir ); 682 683 // Load the custom tmpdir string 684 customTmpDir = SystemUpdaterDialog->getCustomTmpDir(); 685 settings.writeEntry( "/PC-BSD/SystemUpdater/customTmpDir", customTmpDir ); 686 687 useProxyServer = SystemUpdaterDialog->getProxyEnabled(); 688 settings.setValue( "/PC-BSD/SystemUpdater/useProxyServer", useProxyServer ); 689 690 proxyServerUrl = SystemUpdaterDialog->getProxyUrl(); 691 settings.setValue( "/PC-BSD/SystemUpdater/proxyServerUrl", proxyServerUrl ); 692 693 proxyServerPort = SystemUpdaterDialog->getProxyPort(); 694 settings.setValue( "/PC-BSD/SystemUpdater/proxyServerPort", proxyServerPort ); 695 696 697 } 671 698 672 699 void UpdaterTray::loadUpdaterPrefs() { 673 700 // Load the user preferences for the System Updater 701 bool ok; 674 702 QSettings settings; 675 //settings.setPath( "PC-BSD", "SystemUpdater" ); 703 704 // Disable updating the conf file until we are done loading it 705 SystemUpdaterDialog->slotDisableConfUpdates(true); 676 706 677 707 bool enableSysCheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckSysUpdatesConfig", TRUE ); … … 679 709 checkSysUpdatesFrequently = enableSysCheck; 680 710 681 682 711 bool enablePBICheck = settings.readBoolEntry( "/PC-BSD/SystemUpdater/CheckPBIUpdatesConfig", TRUE ); 683 712 SystemUpdaterDialog->setPBIUpdateConfig(enablePBICheck); … … 688 717 contextMenu()->setItemChecked ( 6, enableStartup ); 689 718 690 } 691 692 693 694 695 719 // Check if we are using a custom tmpdir 720 useCustomTmpDir = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useCustomTmpDir", false ); 721 SystemUpdaterDialog->setUseCustomTmp( useCustomTmpDir ); 722 723 // Load a custom tmpdir 724 customTmpDir= PATCHTMPDIR_DEFAULT; 725 customTmpDir = settings.value("/PC-BSD/SystemUpdater/customTmpDir", customTmpDir).toString(); 726 SystemUpdaterDialog->setUseCustomDirName( customTmpDir ); 727 728 // Load if the user wants to use a proxy server 729 useProxyServer = settings.readBoolEntry( "/PC-BSD/SystemUpdater/useProxyServer", false ); 730 SystemUpdaterDialog->setUseProxy( useProxyServer ); 731 732 // Load Proxy Server Settings 733 proxyServerUrl = settings.value( "/PC-BSD/SystemUpdater/proxyServerUrl" ).toString(); 734 735 settings.value("/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 736 if ( ok ) { 737 proxyServerPort = settings.value( "/PC-BSD/SystemUpdater/proxyServerPort").toInt(&ok); 738 } else { 739 proxyServerPort = 8080; 740 } 741 SystemUpdaterDialog->setUseProxySettings( proxyServerUrl, proxyServerPort ); 742 743 SystemUpdaterDialog->slotDisableConfUpdates(false); 744 745 } 696 746 697 747 … … 700 750 slotStartUpdateCheck(); 701 751 } 702 703 704 705 706 752 707 753 … … 794 840 bool ok; 795 841 842 // Lets set the patch tmpdir variable now 843 if ( useCustomTmpDir ) 844 { 845 patchTmpDir = customTmpDir; 846 } else { 847 patchTmpDir = PATCHTMPDIR_DEFAULT; 848 } 849 850 // Make sure this tmpdir exists 851 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 852 853 796 854 797 855 // Get the output of the .df command 798 command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' / tmp' > /PCBSD/tmp/.dfoutput";856 command = "df -m | grep -v '^devfs' | grep -v 'linprocfs' | grep -v '^Filesystem' | grep -v ' /proc' | grep -v ' /tmp' > '" + patchTmpDir + "/.dfoutput'"; 799 857 FILE *filecmd = popen(command,"r"); 800 858 pclose(filecmd); … … 816 874 i = 0; 817 875 // Open our df file, and read it line-by-line 818 QFile file( "/PCBSD/tmp/.dfoutput" );876 QFile file( patchTmpDir + "/.dfoutput" ); 819 877 if ( file.open( IO_ReadOnly ) ) { 820 878 QTextStream stream( &file ); … … 823 881 CheckDFParts[i] = tmp.simplifyWhiteSpace(); 824 882 825 //QMessageBox::critical( this->contextMenu(), tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok);883 //QMessageBox::critical( 0, tr("DF"), "Read Line:" + CheckDFParts[i], QMessageBox::Ok); 826 884 i++; 827 885 } 828 886 // Make sure the last in our array is empty 829 887 CheckDFParts[i]=""; 888 file.close(); 889 file.remove(); 830 890 } 831 891 832 892 833 installLoc = "/PCBSD/tmp"; 893 if ( useCustomTmpDir ) 894 { 895 installLoc = customTmpDir; 896 } else { 897 installLoc = PATCHTMPDIR_DEFAULT; 898 } 834 899 835 900 // Now determine which partition we have selected … … 864 929 { 865 930 // Not enough room, warn the user how much they will need 866 QMessageBox::critical( this->contextMenu(), tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates"), QMessageBox::Ok );931 QMessageBox::critical( 0, tr("System Updater"), tr("Error: Not enough free disk space for these updates! You will need " + tmp.setNum(progSize) + "MB to install the selected updates. Please select a different partition or free up some space to continue."), QMessageBox::Ok ); 867 932 return; 868 933 } else { … … 872 937 873 938 } else { 874 QMessageBox::critical( this->contextMenu(), tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok);939 QMessageBox::critical( 0, tr("ERROR:"), tr("Error determining remaining disk space!"), QMessageBox::Ok); 875 940 } 876 941 … … 890 955 void UpdaterTray::slotStartSystemUpdate() 891 956 { 892 // The user is ready to start some system updates 957 // The user is ready to start some system updates 958 959 960 // Lets set the patch tmpdir variable now 961 if ( useCustomTmpDir ) 962 { 963 patchTmpDir = customTmpDir; 964 } else { 965 patchTmpDir = PATCHTMPDIR_DEFAULT; 966 } 967 968 // Make sure this tmpdir exists 969 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 893 970 894 971 // Change the program status and update the tray icon … … 945 1022 UpdaterStatusDialog->show(); 946 1023 947 QMessageBox::warning( this->contextMenu(), tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok );1024 QMessageBox::warning( 0, tr("Online Update"), tr("One or more updates will require a reboot. You will be prompted to restart after the update is finished."), QMessageBox::Ok ); 948 1025 requiresSysReboot = 1; 949 1026 } … … 965 1042 void UpdaterTray::slotDownloadSysUpdate() 966 1043 { 967 QString status, id, tmp ;1044 QString status, id, tmp, command; 968 1045 bool startNewDownload = false, ok; 969 1046 int getNextItem = 0; … … 1054 1131 UpdaterStatusDialog->setLabelSysUpdateStatus(status); 1055 1132 1056 UpdaterStatusDialog->setProgressTotalSteps(100); 1133 UpdaterStatusDialog->setProgressTotalSteps(100); 1134 1135 command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'"; 1136 FILE *file = popen(command,"r"); 1137 pclose(file); 1057 1138 1058 1139 // Make sure that any old patch is removed first 1059 QFile tmpfile( "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma");1140 QFile tmpfile( patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma"); 1060 1141 if ( tmpfile.exists() ) 1061 1142 { 1062 1143 tmpfile.remove(); 1063 1144 } 1064 1065 copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 1145 1146 1147 copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo); 1066 1148 1067 1149 connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); … … 1079 1161 QString tmp; 1080 1162 1081 // This function starts the internal checksum to ensure the PBIis intact1163 // This function starts the internal checksum to ensure the update is intact 1082 1164 1083 1165 tmp = tr("Checking data integrity..."); … … 1085 1167 1086 1168 // Make the checksum.sh script now 1087 QFile file4( "/PCBSD/tmp/.syschecksum.sh" );1169 QFile file4( patchTmpDir + "/.syschecksum.sh" ); 1088 1170 if ( file4.open( IO_WriteOnly ) ) { 1089 1171 QTextStream stream4( &file4 ); 1090 stream4 << "cat /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma| md5 >&1";1172 stream4 << "cat '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | md5 >&1"; 1091 1173 file4.close(); 1092 1174 } … … 1094 1176 checksumProc = new Q3Process( this ); 1095 1177 checksumProc->addArgument( "sh" ); 1096 checksumProc->addArgument( "/PCBSD/tmp/.syschecksum.sh" );1178 checksumProc->addArgument( patchTmpDir + "/.syschecksum.sh" ); 1097 1179 //connect( checksumProc, SIGNAL(processExited()), this, SLOT( slotChecksumFinished() ) ); 1098 1180 connect( checksumProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadSysMD5() ) ); 1099 1181 if ( !checksumProc->start() ) { 1100 QMessageBox::information( this->contextMenu(), tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok );1182 QMessageBox::information( 0, tr("Error!"), tr("Error running internal checksum Script! "), QMessageBox::Ok ); 1101 1183 } 1102 1184 … … 1124 1206 1125 1207 // Remove the bad patch 1126 command = "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma";1208 command = "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'"; 1127 1209 FILE *file = popen(command,"r"); 1128 1210 pclose(file); … … 1134 1216 UpdaterStatusDialog->show(); 1135 1217 1136 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok );1218 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while downloading. Please check your connection or try again later."), QMessageBox::Ok ); 1137 1219 1138 1220 if ( UpdaterStatusDialog->isShown() ) … … 1216 1298 if ( requiresSysReboot == 1) 1217 1299 { 1218 QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok);1300 QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed! Your system will need to reboot to finish."), QMessageBox::Ok); 1219 1301 } else { 1220 1302 QMessageBox::information( 0, tr("Online Update"), tr("Updates successfully installed!"), QMessageBox::Ok ); … … 1249 1331 1250 1332 1251 // Make the checksum.shscript now1252 QFile file4( "/PCBSD/tmp/.extractsys.sh" );1333 // Make the extract script now 1334 QFile file4( patchTmpDir + "/.extractsys.sh" ); 1253 1335 if ( file4.open( IO_WriteOnly ) ) { 1254 1336 QTextStream stream4( &file4 ); 1255 1337 stream4 << "#!/bin/sh\n"; 1256 stream4 << "mkdir -p /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);1257 stream4 << " \necho \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile\n";1258 stream4 << "lzma -so d /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma | tar xvC /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "-f - >&1";1338 stream4 << "mkdir -p '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1339 stream4 << "echo \"" + SysUpdatePatchFile[currentSysWorkingItem] + "\" > '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) +"/patchFile'\n"; 1340 stream4 << "lzma -so d '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma' | tar xvC '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "' -f - >&1"; 1259 1341 file4.close(); 1260 1342 } … … 1263 1345 extractProc = new Q3Process( this ); 1264 1346 extractProc->addArgument( "sh" ); 1265 extractProc->addArgument( "/PCBSD/tmp/.extractsys.sh" );1347 extractProc->addArgument( patchTmpDir + "/.extractsys.sh" ); 1266 1348 1267 1349 connect( extractProc, SIGNAL(processExited()), this, SLOT(slotSysExtractFinished() ) ); … … 1271 1353 UpdaterStatusDialog->show(); 1272 1354 1273 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok );1355 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while extracting. Please try again later."), QMessageBox::Ok ); 1274 1356 if ( UpdaterStatusDialog->isShown() ) 1275 1357 { … … 1294 1376 1295 1377 // Make the checksum.sh script now 1296 QFile file4( "/PCBSD/tmp/.installsys.sh" );1378 QFile file4( patchTmpDir + "/.installsys.sh" ); 1297 1379 if ( file4.open( IO_WriteOnly ) ) { 1298 1380 QTextStream stream4( &file4 ); 1299 1381 stream4 << "#!/bin/sh\n"; 1300 stream4 << "rm /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma\n\n";1301 stream4 << "cd /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem);1302 stream4 << " \nPATCHDIR=\"/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n";1303 stream4 << "cd $PATCHDIR\n";1382 stream4 << "rm '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma'\n\n"; 1383 stream4 << "cd '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1384 stream4 << "PATCHDIR=\"" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "\" ; export PATCHDIR\n"; 1385 stream4 << "cd \"${PATCHDIR}\"\n"; 1304 1386 stream4 << "sh update.sh >&1 2>&1\n"; 1305 1387 stream4 << "if [ \"$?\" = \"0\" ]\n"; 1306 1388 stream4 << "then\n"; 1307 1389 stream4 << " cp /PCBSD/SystemUpdater/system-updates/available/" + SysUpdatePatchFile[currentSysWorkingItem] + " /PCBSD/SystemUpdater/system-updates/installed/" + SysUpdatePatchFile[currentSysWorkingItem] + "\n"; 1308 stream4 << " rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";1309 stream4 << " rm /PCBSD/tmp/.extractsys.sh\n";1310 stream4 << " rm /PCBSD/tmp/.installsys.sh\n";1311 stream4 << " rm /PCBSD/tmp/.syschecksum.sh\n";1390 stream4 << " rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1391 stream4 << " rm '" + patchTmpDir + "/.extractsys.sh'\n"; 1392 stream4 << " rm '" + patchTmpDir + "/.installsys.sh'\n"; 1393 stream4 << " rm '" + patchTmpDir + "/.syschecksum.sh'\n"; 1312 1394 stream4 << " exit 0\n"; 1313 1395 stream4 << "else\n"; 1314 stream4 << " rm -rf /PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + "\n";1315 stream4 << " rm /PCBSD/tmp/.extractsys.sh\n";1316 stream4 << " rm /PCBSD/tmp/.installsys.sh\n";1317 stream4 << " rm /PCBSD/tmp/.syschecksum.sh\n";1396 stream4 << " rm -rf '" + patchTmpDir + "/patch" + tmp.setNum(currentSysWorkingItem) + "'\n"; 1397 stream4 << " rm '" + patchTmpDir + "/.extractsys.sh'\n"; 1398 stream4 << " rm '" + patchTmpDir + "/.installsys.sh'\n"; 1399 stream4 << " rm '" + patchTmpDir + "/.syschecksum.sh'\n"; 1318 1400 stream4 << " exit 1\n"; 1319 1401 stream4 << "fi\n"; … … 1324 1406 installProc = new Q3Process( this ); 1325 1407 installProc->addArgument( "sh" ); 1326 installProc->addArgument( "/PCBSD/tmp/.installsys.sh" );1408 installProc->addArgument( patchTmpDir + "/.installsys.sh" ); 1327 1409 1328 1410 connect( installProc, SIGNAL(processExited()), this, SLOT(slotSysInstallFinished() ) ); … … 1331 1413 1332 1414 if ( ! installProc->start() ) { 1333 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok );1415 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while installing. Please try again later."), QMessageBox::Ok ); 1334 1416 exit(15); 1335 1417 } … … 1566 1648 checkPBIProc->addArgument( progName ); 1567 1649 checkPBIProc->addArgument( PBIProgVer[currentWorkingPBI] ); 1650 1651 if ( useProxyServer ) 1652 { 1653 QString proxyArgPort; 1654 proxyArgPort.setNum(proxyServerPort); 1655 1656 QString proxyArgUrl = proxyServerUrl; 1657 1658 // Check if we need to remove a http:// 1659 if ( proxyServerUrl.indexOf("http://") == 0 ) 1660 { 1661 proxyArgUrl.remove(0, 7); 1662 } 1663 1664 checkPBIProc->addArgument( proxyArgUrl + ":" + proxyArgPort ); 1665 1666 } else { 1667 checkPBIProc->addArgument( "DISABLE" ); 1668 } 1669 1568 1670 1569 1671 connect( checkPBIProc, SIGNAL(readyReadStdout()), this, SLOT(slotReadPBIStatusResults() ) ); … … 1701 1803 UpdaterStatusDialog->show(); 1702 1804 1805 // Lets set the patch tmpdir variable now 1806 if ( useCustomTmpDir ) 1807 { 1808 patchTmpDir = customTmpDir; 1809 } else { 1810 patchTmpDir = PATCHTMPDIR_DEFAULT; 1811 } 1812 1813 // Make sure this tmpdir exists 1814 system("mkdir -p '" + patchTmpDir + "' >/dev/null 2>/dev/null"); 1703 1815 1704 1816 // Get our list of PBIs ready to be updated … … 1765 1877 UpdaterStatusDialog->show(); 1766 1878 1767 QMessageBox::critical( this->contextMenu(), tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok );1879 QMessageBox::critical( 0, tr("Online Update"), PBIProgName[currentWorkingPBI] + ": " + tr("An error occured while downloading. Please try again later."), QMessageBox::Ok ); 1768 1880 1769 1881 // Set the status that this failed … … 1865 1977 1866 1978 // Make sure that any old PBI is removed first 1867 QFile tmpfile("/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi"); 1979 system("rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' >/dev/null 2>/dev/null"); 1980 QFile tmpfile( patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi"); 1868 1981 if ( tmpfile.exists() ) 1869 1982 { 1870 1983 tmpfile.remove(); 1871 1984 } 1872 1873 1874 copyJob = KIO::copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 1985 1986 copyJob = KIO::copy(URL, patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo); 1875 1987 1876 1988 connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong))); … … 1921 2033 { 1922 2034 1923 if ( upgradePBIProc->exitStatus() != 0)2035 if ( upgradePBIProc->exitStatus() == 255) 1924 2036 { 1925 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("The updated version of " + PBIProgName[currentWorkingPBI] + " " + tr("failed the integrity check! Please try updating this PBI again later.")), QMessageBox::Ok );2037 QMessageBox::critical( 0, tr("Online Update"), tr("The updated version of %s failed the integrity check! Please try updating this PBI again later.", PBIProgName[currentWorkingPBI] ), QMessageBox::Ok ); 1926 2038 // Update the status on the previous download to finished 2039 status = tr("Failed!"); 2040 UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) ); 2041 } else if ( upgradePBIProc->exitStatus() == 256 ) { 2042 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading %s You may need to re-install this PBI manually.", PBIProgName[currentWorkingPBI]), QMessageBox::Ok ); 1927 2043 status = tr("Failed!"); 1928 2044 UpdaterStatusDialog->updateStatusListBoxItem(status, id.setNum(currentWorkingPBI) ); … … 1958 2074 1959 2075 1960 QMessageBox::information( this->contextMenu(), tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok );2076 QMessageBox::information( 0, tr("Online Update"), tr("PBI Upgrades finished!"), QMessageBox::Ok ); 1961 2077 if ( UpdaterStatusDialog->isShown() ) 1962 2078 { … … 2011 2127 2012 2128 // Make the checksum.sh script now 2013 QFile file4( "/PCBSD/tmp/.upgradepbi.sh" );2129 QFile file4( patchTmpDir + "/.upgradepbi.sh" ); 2014 2130 if ( file4.open( IO_WriteOnly ) ) { 2015 2131 QTextStream stream4( &file4 ); … … 2017 2133 stream4 << "DISPLAY="" ; export DISPLAY\n"; 2018 2134 stream4 << "\n"; 2019 stream4 << "MD5=\"`cat /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi| md5`\"\n";2135 stream4 << "MD5=\"`cat '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' | md5`\"\n"; 2020 2136 stream4 << "if [ \"${MD5}\" != \"" + PBIProgMD5[currentWorkingPBI] + "\" ]\n"; 2021 2137 stream4 << "then\n"; 2022 stream4 << " rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n";2138 stream4 << " rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2023 2139 stream4 << " exit 255\n"; 2024 2140 stream4 << "fi\n"; … … 2037 2153 stream4 << "echo 'SETSTEPS: 2'\n"; 2038 2154 stream4 << "echo 'MSG: Installing " + NewProgDirName + "'\n"; 2039 stream4 << "chmod 755 /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n"; 2040 stream4 << "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi -text -accept\n"; 2041 stream4 << "\n"; 2155 stream4 << "chmod 755 '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2156 stream4 << "'" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi' -text -accept\n"; 2157 stream4 << "if [ \"$?\" != \"0\" ]\n"; 2158 stream4 << "then\n"; 2159 stream4 << " rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2160 stream4 << " rm '" + patchTmpDir + "/.upgradepbi.sh'\n"; 2161 stream4 << " exit 256\n"; 2162 stream4 << "fi\n"; 2042 2163 stream4 << "echo 'SETSTEPS: 3'\n"; 2043 2164 stream4 << "echo 'MSG: Finished installing " + NewProgDirName + "'\n"; 2044 stream4 << "rm /PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi\n"; 2165 stream4 << "rm '" + patchTmpDir + "/" + tmp.setNum(currentWorkingPBI) + ".pbi'\n"; 2166 stream4 << "rm '" + patchTmpDir + "/.upgradepbi.sh'\n"; 2167 stream4 << "exit 0\n"; 2045 2168 file4.close(); 2046 2169 } … … 2049 2172 upgradePBIProc = new Q3Process( this ); 2050 2173 upgradePBIProc->addArgument( "sh" ); 2051 upgradePBIProc->addArgument( "/PCBSD/tmp/.upgradepbi.sh" );2174 upgradePBIProc->addArgument( patchTmpDir + "/.upgradepbi.sh" ); 2052 2175 2053 2176 connect( upgradePBIProc, SIGNAL(processExited()), this, SLOT(slotStartPBIInstall() ) ); … … 2055 2178 2056 2179 if ( ! upgradePBIProc->start() ) { 2057 QMessageBox::critical( this->contextMenu(), tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok );2180 QMessageBox::critical( 0, tr("Online Update"), tr("An error occured while upgrading. Please try again later."), QMessageBox::Ok ); 2058 2181 exit(15); 2059 2182 } 2060 2061 2062 2063 2183 2064 2184 } … … 2076 2196 { 2077 2197 tmp = upgradePBIProc->readLineStdout(); 2198 2078 2199 2079 2200 if ( tmp.find("TOTALSTEPS:" ) == 0) … … 2105 2226 2106 2227 } 2228 2229 2230 void UpdaterTray::slotLaunchKDEProxyConfig() 2231 { 2232 QString command; 2233 command = "su " + username + " -c 'kcmshell4 proxy' &"; 2234 system(command); 2235 } -
pcbsd/trunk/SystemUpdater/UpdaterTray.h
r2600 r2940 54 54 void slotChangeRunStartup(); 55 55 void slotTrayActivated(QSystemTrayIcon::ActivationReason reason); 56 void slotLaunchKDEProxyConfig(); 56 57 57 58 protected: … … 62 63 void loadUpdaterPrefs(); 63 64 void loadPatchData(QString patchFile, int patchNum); 64 65 65 KJob *copyJob; 66 bool useCustomTmpDir; 67 QString customTmpDir; 68 bool useProxyServer; 69 QString proxyServerUrl; 70 int proxyServerPort; 71 QString patchTmpDir; 66 72 }; 67 73
